Skip to content

Commit 56d5624

Browse files
committed
Merge pull request #111355 from bruvzg/zero_w_2
Enforce zero width spaces and joiners with missing font. Do not warn about missing non-visual characters.
2 parents fda0e83 + fda161f commit 56d5624

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

modules/text_server_adv/text_server_adv.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6742,6 +6742,11 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star
67426742
p_sd->descent = MAX(p_sd->descent, Math::round(get_hex_code_box_size(fs, gl.index).x * 0.5));
67436743
}
67446744
}
6745+
bool zero_w = (p_sd->preserve_control) ? (p_sd->text[i] == 0x200B || p_sd->text[i] == 0xFEFF) : ((p_sd->text[i] >= 0x200B && p_sd->text[i] <= 0x200D) || p_sd->text[i] == 0x2060 || p_sd->text[i] == 0xFEFF);
6746+
if (zero_w) {
6747+
gl.index = 0;
6748+
gl.advance = 0.0;
6749+
}
67456750

67466751
p_sd->width += gl.advance;
67476752

@@ -6885,7 +6890,7 @@ void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_star
68856890
#endif
68866891

68876892
gl.index = glyph_info[i].codepoint;
6888-
bool zero_w = (p_sd->preserve_control) ? (p_sd->text[glyph_info[i].cluster] == 0x200B || p_sd->text[glyph_info[i].cluster] == 0xFEF) : (p_sd->text[glyph_info[i].cluster] >= 0x200B && p_sd->text[glyph_info[i].cluster] <= 0x200D) || p_sd->text[glyph_info[i].cluster] == 0x2060 || p_sd->text[glyph_info[i].cluster] == 0xFEFF;
6893+
bool zero_w = (p_sd->preserve_control) ? (p_sd->text[glyph_info[i].cluster] == 0x200B || p_sd->text[glyph_info[i].cluster] == 0xFEFF) : ((p_sd->text[glyph_info[i].cluster] >= 0x200B && p_sd->text[glyph_info[i].cluster] <= 0x200D) || p_sd->text[glyph_info[i].cluster] == 0x2060 || p_sd->text[glyph_info[i].cluster] == 0xFEFF);
68896894
if (zero_w) {
68906895
gl.index = 0;
68916896
gl.advance = 0.0;

scene/gui/label.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ PackedStringArray Label::get_configuration_warnings() const {
649649
const Glyph *glyph = TS->shaped_text_get_glyphs(para.text_rid);
650650
int64_t glyph_count = TS->shaped_text_get_glyph_count(para.text_rid);
651651
for (int64_t i = 0; i < glyph_count; i++) {
652-
if (glyph[i].font_rid == RID()) {
652+
if (glyph[i].font_rid == RID() && glyph[i].index != 0) {
653653
warnings.push_back(RTR("The current font does not support rendering one or more characters used in this Label's text."));
654654
break;
655655
}

0 commit comments

Comments
 (0)