diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-12 15:37:20 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-12-12 15:37:20 +0200 |
commit | ef07b24ad3431496372d3cfd2884b0609b940e27 (patch) | |
tree | e8a23f15dabc3fd5e2d34c87619c698da478f2ef /src/ui/text.h | |
parent | 8864cc5aee3b134b0ffc5f53c1593645f4109f8c (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.h | 21 |
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 | } |
129 | iLocalDef iBool isEmoji_Char(iChar c) { | 129 | iLocalDef 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 | ||
142 | extern int gap_Text; /* affected by content font size */ | 143 | extern int gap_Text; /* affected by content font size */ |
143 | 144 | ||
144 | void init_Text (SDL_Renderer *); | 145 | void init_Text (SDL_Renderer *); |
145 | void deinit_Text (void); | 146 | void deinit_Text (void); |
146 | 147 | ||
147 | void setContentFont_Text (enum iTextFont font); | 148 | void setContentFont_Text (enum iTextFont font); |
148 | void setHeadingFont_Text (enum iTextFont font); | 149 | void setHeadingFont_Text (enum iTextFont font); |
149 | void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */ | 150 | void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */ |
150 | void resetFonts_Text (void); | 151 | void resetFonts_Text (void); |
151 | 152 | ||
152 | int lineHeight_Text (int fontId); | 153 | int lineHeight_Text (int fontId); |
153 | iInt2 measure_Text (int fontId, const char *text); | 154 | iInt2 measure_Text (int fontId, const char *text); |
154 | iInt2 measureRange_Text (int fontId, iRangecc text); | 155 | iInt2 measureRange_Text (int fontId, iRangecc text); |
155 | iRect visualBounds_Text (int fontId, iRangecc text); | 156 | iRect visualBounds_Text (int fontId, iRangecc text); |
156 | iInt2 advance_Text (int fontId, const char *text); | 157 | iInt2 advance_Text (int fontId, const char *text); |
157 | iInt2 advanceN_Text (int fontId, const char *text, size_t n); /* `n` in characters */ | 158 | iInt2 advanceN_Text (int fontId, const char *text, size_t n); /* `n` in characters */ |
158 | iInt2 advanceRange_Text (int fontId, iRangecc text); | 159 | iInt2 advanceRange_Text (int fontId, iRangecc text); |
159 | iInt2 advanceWrapRange_Text (int fontId, int maxWidth, iRangecc text); | 160 | iInt2 advanceWrapRange_Text (int fontId, int maxWidth, iRangecc text); |
160 | 161 | ||
161 | iInt2 tryAdvance_Text (int fontId, iRangecc text, int width, const char **endPos); | 162 | iInt2 tryAdvance_Text (int fontId, iRangecc text, int width, const char **endPos); |