summaryrefslogtreecommitdiff
path: root/src/ui/text.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-08 19:14:54 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-08 19:14:54 +0200
commiteae5e61bba99c97af3d8b27dab39d50aedeb3b04 (patch)
treeb8c932a745f77845f79aea464d5195ce36109ee9 /src/ui/text.c
parent6efe7e2916c2391538aa41d6c2226f8c1a9cafc3 (diff)
Text: Ignore Unicode joiners and modifiers
The fonts bundled with Lagrange currently do not have all the latest Unicode symbols, so we'll ignore the joiners and modifiers for gender and skin color. A better option would be to fall back to system-provided text rendering, if that is available. IssueID #81
Diffstat (limited to 'src/ui/text.c')
-rw-r--r--src/ui/text.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index a8be33b6..ae4b1714 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -665,6 +665,17 @@ static iRect run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe
665 } 665 }
666 } 666 }
667 iChar ch = nextChar_(&chPos, text.end); 667 iChar ch = nextChar_(&chPos, text.end);
668 if (ch == 0x200d) { /* zero-width joiner */
669 /* We don't have the composited Emojis. */
670 if (isEmoji_Char(prevCh)) {
671 /* skip */
672 ch = nextChar_(&chPos, text.end);
673 ch = nextChar_(&chPos, text.end);
674 }
675 else {
676 printf("it's %x\n", prevCh);
677 }
678 }
668 if (isVariationSelector_Char(ch)) { 679 if (isVariationSelector_Char(ch)) {
669 /* TODO: VS15: Should peek ahead for this and prefer the Emoji font. */ 680 /* TODO: VS15: Should peek ahead for this and prefer the Emoji font. */
670 ch = nextChar_(&chPos, text.end); /* just ignore */ 681 ch = nextChar_(&chPos, text.end); /* just ignore */
@@ -712,6 +723,9 @@ static iRect run_Font_(iFont *d, enum iRunMode mode, iRangecc text, size_t maxLe
712 prevCh = 0; 723 prevCh = 0;
713 continue; 724 continue;
714 } 725 }
726 if (isDefaultIgnorable_Char(ch) || isFitzpatrickType_Char(ch)) {
727 continue;
728 }
715 } 729 }
716 const iGlyph *glyph = glyph_Font_(d, ch); 730 const iGlyph *glyph = glyph_Font_(d, ch);
717 int x1 = xpos; 731 int x1 = xpos;
@@ -1000,7 +1014,7 @@ iString *renderBlockChars_Text(const iBlock *fontData, int height, enum iTextBlo
1000 size_t strRemain = length_String(text); 1014 size_t strRemain = length_String(text);
1001 iConstForEach(String, i, text) { 1015 iConstForEach(String, i, text) {
1002 if (!strRemain) break; 1016 if (!strRemain) break;
1003 if (i.value == variationSelectorEmoji_Char) { 1017 if (isVariationSelector_Char(i.value) || isDefaultIgnorable_Char(i.value)) {
1004 strRemain--; 1018 strRemain--;
1005 continue; 1019 continue;
1006 } 1020 }