diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-06-09 19:01:15 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-06-09 19:01:15 +0300 |
commit | f63ed76597b462c60b3a6ad89f8c165ffb87d00c (patch) | |
tree | 2aca3537930bce28acff14c0cee0a11fa1988661 /src/ui/text.h | |
parent | 5f9685010addd4a0f04c13f889856084381dd1c6 (diff) | |
parent | ee17ef3d0135027fbc4ff816dd9e793b4bb0b883 (diff) |
Merge branch 'dev' into work/typesetter
# Conflicts:
# src/gmdocument.c
# src/ui/documentwidget.c
# src/ui/inputwidget.h
Diffstat (limited to 'src/ui/text.h')
-rw-r--r-- | src/ui/text.h | 35 |
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 | ||
107 | iLocalDef iBool isJapanese_FontId(enum iFontId id) { | 112 | iLocalDef iBool isJapanese_FontId(enum iFontId id) { |
@@ -124,6 +129,8 @@ extern int gap_Text; /* affected by content font size */ | |||
124 | void init_Text (SDL_Renderer *); | 129 | void init_Text (SDL_Renderer *); |
125 | void deinit_Text (void); | 130 | void deinit_Text (void); |
126 | 131 | ||
132 | void loadUserFonts_Text (void); /* based on Prefs */ | ||
133 | |||
127 | void setContentFont_Text (enum iTextFont font); | 134 | void setContentFont_Text (enum iTextFont font); |
128 | void setHeadingFont_Text (enum iTextFont font); | 135 | void setHeadingFont_Text (enum iTextFont font); |
129 | void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */ | 136 | void setContentFontSize_Text (float fontSizeFactor); /* affects all except `default*` fonts */ |
@@ -151,13 +158,15 @@ void setOpacity_Text (float opacity); | |||
151 | 158 | ||
152 | void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */ | 159 | void cache_Text (int fontId, iRangecc text); /* pre-render glyphs */ |
153 | 160 | ||
154 | void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); | 161 | void draw_Text (int fontId, iInt2 pos, int color, const char *text, ...); |
155 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); | 162 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); |
156 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); | 163 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); |
157 | void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); | 164 | void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text); |
158 | void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); | 165 | void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); |
159 | void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ | 166 | void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); |
160 | int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ | 167 | void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen); |
168 | void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ | ||
169 | int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ | ||
161 | 170 | ||
162 | SDL_Texture * glyphCache_Text (void); | 171 | SDL_Texture * glyphCache_Text (void); |
163 | 172 | ||