summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2023-04-12 10:08:51 +0300
committerYuri Sizov <yuris@humnom.net>2023-04-24 16:28:28 +0200
commite071fb226374e027eedf5660294288a683b422a7 (patch)
treed71e1417e4ef81a5d5ad63fda93ef49f2bd4ffe5 /servers
parentd4c9ca39758ef0fb9ed27f8473faed5690994fef (diff)
[TextServer] Use dedicated flag for object replacement characters.
(cherry picked from commit d904516e553426dae1fa40566e3fe67f6213e769)
Diffstat (limited to 'servers')
-rw-r--r--servers/text_server.cpp3
-rw-r--r--servers/text_server.h9
2 files changed, 7 insertions, 5 deletions
diff --git a/servers/text_server.cpp b/servers/text_server.cpp
index 027109b67d..69ba3dafb2 100644
--- a/servers/text_server.cpp
+++ b/servers/text_server.cpp
@@ -546,6 +546,7 @@ void TextServer::_bind_methods() {
BIND_BITFIELD_FLAG(GRAPHEME_IS_UNDERSCORE);
BIND_BITFIELD_FLAG(GRAPHEME_IS_CONNECTED);
BIND_BITFIELD_FLAG(GRAPHEME_IS_SAFE_TO_INSERT_TATWEEL);
+ BIND_BITFIELD_FLAG(GRAPHEME_IS_EMBEDDED_OBJECT);
/* Hinting */
BIND_ENUM_CONSTANT(HINTING_NONE);
@@ -1448,7 +1449,7 @@ void TextServer::shaped_text_draw(const RID &p_shaped, const RID &p_canvas, cons
if (glyphs[i].font_rid != RID()) {
font_draw_glyph(glyphs[i].font_rid, p_canvas, glyphs[i].font_size, ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, p_color);
- } else if (hex_codes && ((glyphs[i].flags & GRAPHEME_IS_VIRTUAL) != GRAPHEME_IS_VIRTUAL)) {
+ } else if (hex_codes && ((glyphs[i].flags & GRAPHEME_IS_VIRTUAL) != GRAPHEME_IS_VIRTUAL) && ((glyphs[i].flags & GRAPHEME_IS_EMBEDDED_OBJECT) != GRAPHEME_IS_EMBEDDED_OBJECT)) {
TextServer::draw_hex_code_box(p_canvas, glyphs[i].font_size, ofs + Vector2(glyphs[i].x_off, glyphs[i].y_off), glyphs[i].index, p_color);
}
if (orientation == ORIENTATION_HORIZONTAL) {
diff --git a/servers/text_server.h b/servers/text_server.h
index 2c6a8af682..7490a48b51 100644
--- a/servers/text_server.h
+++ b/servers/text_server.h
@@ -125,18 +125,19 @@ public:
};
enum GraphemeFlag {
- GRAPHEME_IS_VALID = 1 << 0, // Glyph is valid.
- GRAPHEME_IS_RTL = 1 << 1, // Glyph is right-to-left.
- GRAPHEME_IS_VIRTUAL = 1 << 2, // Glyph is not part of source string (added by fit_to_width function, do not affect caret movement).
+ GRAPHEME_IS_VALID = 1 << 0, // Grapheme is valid.
+ GRAPHEME_IS_RTL = 1 << 1, // Grapheme is right-to-left.
+ GRAPHEME_IS_VIRTUAL = 1 << 2, // Grapheme is not part of source string (added by fit_to_width function, do not affect caret movement).
GRAPHEME_IS_SPACE = 1 << 3, // Is whitespace (for justification and word breaks).
GRAPHEME_IS_BREAK_HARD = 1 << 4, // Is line break (mandatory break, e.g. "\n").
GRAPHEME_IS_BREAK_SOFT = 1 << 5, // Is line break (optional break, e.g. space).
GRAPHEME_IS_TAB = 1 << 6, // Is tab or vertical tab.
- GRAPHEME_IS_ELONGATION = 1 << 7, // Elongation (e.g. kashida), glyph can be duplicated or truncated to fit line to width.
+ GRAPHEME_IS_ELONGATION = 1 << 7, // Elongation (e.g. kashida), grapheme can be duplicated or truncated to fit line to width.
GRAPHEME_IS_PUNCTUATION = 1 << 8, // Punctuation, except underscore (can be used as word break, but not line break or justifiction).
GRAPHEME_IS_UNDERSCORE = 1 << 9, // Underscore (can be used as word break).
GRAPHEME_IS_CONNECTED = 1 << 10, // Connected to previous grapheme.
GRAPHEME_IS_SAFE_TO_INSERT_TATWEEL = 1 << 11, // It is safe to insert a U+0640 before this grapheme for elongation.
+ GRAPHEME_IS_EMBEDDED_OBJECT = 1 << 12, // Grapheme is an object replacement character for the embedded object.
};
enum Hinting {