summaryrefslogtreecommitdiff
path: root/src/ui/text.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/text.h')
-rw-r--r--src/ui/text.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/ui/text.h b/src/ui/text.h
index 044ddd32..2f2bcf3a 100644
--- a/src/ui/text.h
+++ b/src/ui/text.h
@@ -67,12 +67,16 @@ enum iFontId {
67 monospaceSmall_FontId, 67 monospaceSmall_FontId,
68 monospace_FontId, 68 monospace_FontId,
69 /* extra content fonts */ 69 /* extra content fonts */
70 defaultContentSized_FontId, /* UI font but sized to regular_FontId */ 70 defaultContentRegular_FontId, /* UI font but sized to regular_FontId */
71 regularMonospace_FontId, 71 defaultContentSmall_FontId, /* UI font but sized smaller */
72 /* symbols and scripts */ 72 /* symbols and scripts */
73 symbols_FontId, 73 userSymbols_FontId,
74 emoji_FontId = symbols_FontId + max_FontSize, 74 iosevka_FontId = userSymbols_FontId + max_FontSize,
75 japanese_FontId = emoji_FontId + max_FontSize, 75 symbols_FontId = iosevka_FontId + max_FontSize,
76 symbols2_FontId = symbols_FontId + max_FontSize,
77 smolEmoji_FontId = symbols2_FontId + max_FontSize,
78 notoEmoji_FontId = smolEmoji_FontId + max_FontSize,
79 japanese_FontId = notoEmoji_FontId + max_FontSize,
76 chineseSimplified_FontId = japanese_FontId + max_FontSize, 80 chineseSimplified_FontId = japanese_FontId + max_FontSize,
77 korean_FontId = chineseSimplified_FontId + max_FontSize, 81 korean_FontId = chineseSimplified_FontId + max_FontSize,
78 arabic_FontId = korean_FontId + max_FontSize, 82 arabic_FontId = korean_FontId + max_FontSize,
@@ -91,7 +95,7 @@ enum iFontId {
91 uiInput_FontId = defaultMedium_FontId, 95 uiInput_FontId = defaultMedium_FontId,
92 uiContent_FontId = defaultMedium_FontId, 96 uiContent_FontId = defaultMedium_FontId,
93 uiContentBold_FontId = defaultMediumBold_FontId, 97 uiContentBold_FontId = defaultMediumBold_FontId,
94 uiContentSymbols_FontId = symbols_FontId + uiMedium_FontSize, 98 uiContentSymbols_FontId = symbols_FontId + uiMedium_FontSize,
95 /* Document fonts: */ 99 /* Document fonts: */
96 paragraph_FontId = regular_FontId, 100 paragraph_FontId = regular_FontId,
97 firstParagraph_FontId = medium_FontId, 101 firstParagraph_FontId = medium_FontId,
@@ -102,6 +106,7 @@ enum iFontId {
102 heading2_FontId = largeBold_FontId, 106 heading2_FontId = largeBold_FontId,
103 heading3_FontId = big_FontId, 107 heading3_FontId = big_FontId,
104 banner_FontId = largeLight_FontId, 108 banner_FontId = largeLight_FontId,
109 regularMonospace_FontId = iosevka_FontId + contentRegular_FontSize
105}; 110};
106 111
107iLocalDef iBool isJapanese_FontId(enum iFontId id) { 112iLocalDef iBool isJapanese_FontId(enum iFontId id) {
@@ -124,6 +129,8 @@ extern int gap_Text; /* affected by content font size */
124void init_Text (SDL_Renderer *); 129void init_Text (SDL_Renderer *);
125void deinit_Text (void); 130void deinit_Text (void);
126 131
132void loadUserFonts_Text (void); /* based on Prefs */
133
127void setContentFont_Text (enum iTextFont font); 134void setContentFont_Text (enum iTextFont font);
128void setHeadingFont_Text (enum iTextFont font); 135void setHeadingFont_Text (enum iTextFont font);
129void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */ 136void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */
@@ -151,13 +158,15 @@ void setOpacity_Text (float opacity);
151 158
152void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */ 159void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */
153 160
154void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); 161void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...);
155void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); 162void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...);
156void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); 163void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...);
157void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); 164void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text);
158void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); 165void drawString_Text (int fontId, iInt2 pos, int color, const iString *text);
159void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ 166void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text);
160int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ 167void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen);
168void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */
169int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */
161 170
162SDL_Texture * glyphCache_Text (void); 171SDL_Texture * glyphCache_Text (void);
163 172