summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/text.c16
-rw-r--r--src/ui/text.h16
2 files changed, 28 insertions, 4 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 }
diff --git a/src/ui/text.h b/src/ui/text.h
index 5bae8e2a..a0b2dc1a 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -114,11 +114,21 @@ enum iFontId {
114iLocalDef iBool isJapanese_FontId(enum iFontId id) { 114iLocalDef iBool isJapanese_FontId(enum iFontId id) {
115 return id >= defaultJapanese_FontId && id <= hugeJapanese_FontId; 115 return id >= defaultJapanese_FontId && id <= hugeJapanese_FontId;
116} 116}
117iLocalDef iBool isVariationSelector_Char(iChar ch) { 117iLocalDef iBool isVariationSelector_Char(iChar c) {
118 return ch >= 0xfe00 && ch <= 0xfe0f; 118 return (c >= 0xfe00 && c <= 0xfe0f) || (c >= 0xe0100 && c <= 0xe0121);
119}
120iLocalDef iBool isFitzpatrickType_Char(iChar c) {
121 return c >= 0x1f3fb && c <= 0x1f3ff;
122}
123iLocalDef iBool isDefaultIgnorable_Char(iChar c) {
124 return c == 0x115f || (c >= 0x200b && c <= 0x200e) || c == 0x2060 || c == 0x2061 ||
125 c == 0xfeff;
126}
127iLocalDef iBool isEmoji_Char(iChar c) {
128 return (c >= 0x1f300 && c < 0x1f700) || (c >= 0x1f900 && c <= 0x1f9ff);
119} 129}
120 130
121#define variationSelectorEmoji_Char ((iChar) 0xfe0f) 131#define emojiVariationSelector_Char ((iChar) 0xfe0f)
122 132
123enum iTextFont { 133enum iTextFont {
124 nunito_TextFont, 134 nunito_TextFont,