summaryrefslogtreecommitdiff
path: root/src/ui/text.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-12 15:37:20 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-12 15:37:20 +0200
commitef07b24ad3431496372d3cfd2884b0609b940e27 (patch)
treee8a23f15dabc3fd5e2d34c87619c698da478f2ef /src/ui/text.h
parent8864cc5aee3b134b0ffc5f53c1593645f4109f8c (diff)
New monospace font; flexible mono spacing
Iosevka replaces Fira Mono as the monospace font. Emojis are now allowed to be wider than normal monospace glyphs. However, if whitespace permits, the original monospacing is restored. IssueID #73
Diffstat (limited to 'src/ui/text.h')
-rw-r--r--src/ui/text.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/ui/text.h b/src/ui/text.h
index 6728bb62..5867a84b 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -127,7 +127,8 @@ iLocalDef iBool isDefaultIgnorable_Char(iChar c) {
127 c == 0xfeff; 127 c == 0xfeff;
128} 128}
129iLocalDef iBool isEmoji_Char(iChar c) { 129iLocalDef iBool isEmoji_Char(iChar c) {
130 return (c >= 0x1f300 && c < 0x1f700) || (c >= 0x1f900 && c <= 0x1f9ff); 130 return (c >= 0x1f300 && c < 0x1f700) || (c >= 0x1f7e0 && c <= 0x1f7eb) ||
131 (c >= 0x1f900 && c <= 0x1f9ff);
131} 132}
132 133
133#define emojiVariationSelector_Char ((iChar) 0xfe0f) 134#define emojiVariationSelector_Char ((iChar) 0xfe0f)
@@ -141,21 +142,21 @@ enum iTextFont {
141 142
142extern int gap_Text; /* affected by content font size */ 143extern int gap_Text; /* affected by content font size */
143 144
144void init_Text (SDL_Renderer *); 145void init_Text (SDL_Renderer *);
145void deinit_Text (void); 146void deinit_Text (void);
146 147
147void setContentFont_Text (enum iTextFont font); 148void setContentFont_Text (enum iTextFont font);
148void setHeadingFont_Text (enum iTextFont font); 149void setHeadingFont_Text (enum iTextFont font);
149void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */ 150void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */
150void resetFonts_Text (void); 151void resetFonts_Text (void);
151 152
152int lineHeight_Text (int fontId); 153int lineHeight_Text (int fontId);
153iInt2 measure_Text (int fontId, const char *text); 154iInt2 measure_Text (int fontId, const char *text);
154iInt2 measureRange_Text (int fontId, iRangecc text); 155iInt2 measureRange_Text (int fontId, iRangecc text);
155iRect visualBounds_Text (int fontId, iRangecc text); 156iRect visualBounds_Text (int fontId, iRangecc text);
156iInt2 advance_Text (int fontId, const char *text); 157iInt2 advance_Text (int fontId, const char *text);
157iInt2 advanceN_Text (int fontId, const char *text, size_t n); /* `n` in characters */ 158iInt2 advanceN_Text (int fontId, const char *text, size_t n); /* `n` in characters */
158iInt2 advanceRange_Text (int fontId, iRangecc text); 159iInt2 advanceRange_Text (int fontId, iRangecc text);
159iInt2 advanceWrapRange_Text (int fontId, int maxWidth, iRangecc text); 160iInt2 advanceWrapRange_Text (int fontId, int maxWidth, iRangecc text);
160 161
161iInt2 tryAdvance_Text (int fontId, iRangecc text, int width, const char **endPos); 162iInt2 tryAdvance_Text (int fontId, iRangecc text, int width, const char **endPos);