diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-01 07:34:41 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-07-01 07:34:41 +0300 |
commit | 5fec4c221b860ef33a45ced9919bc356d6dbb3d3 (patch) | |
tree | 60627a0331482fe16d1395fae8a397dae866ab5e /src/ui/text.h | |
parent | b264791f65730b5e6c2414415cc4f4f1cb9253d8 (diff) |
Text: Working on HarfBuzz
Diffstat (limited to 'src/ui/text.h')
-rw-r--r-- | src/ui/text.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/ui/text.h b/src/ui/text.h index 5a099142..fe42a308 100644 --- a/src/ui/text.h +++ b/src/ui/text.h | |||
@@ -24,6 +24,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
24 | 24 | ||
25 | #include <the_Foundation/rect.h> | 25 | #include <the_Foundation/rect.h> |
26 | #include <the_Foundation/string.h> | 26 | #include <the_Foundation/string.h> |
27 | #include <the_Foundation/vec2.h> | ||
27 | 28 | ||
28 | #include <SDL_render.h> | 29 | #include <SDL_render.h> |
29 | 30 | ||
@@ -164,7 +165,8 @@ void draw_Text (int fontId, iInt2 pos, int color, const char *t | |||
164 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); | 165 | void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); |
165 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); | 166 | void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); |
166 | void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text); | 167 | void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text); |
167 | void drawCenteredOutline_Text(int fontId, iRect rect, iBool alignVisual, int outlineColor, int fillColor, const char *text, ...); | 168 | void drawCenteredOutline_Text(int fontId, iRect rect, iBool alignVisual, int outlineColor, |
169 | int fillColor, const char *text, ...); | ||
168 | void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); | 170 | void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); |
169 | void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); | 171 | void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); |
170 | void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen); | 172 | void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen); |
@@ -172,6 +174,24 @@ void drawOutline_Text (int fontId, iInt2 pos, int outlineColor, int fi | |||
172 | void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ | 174 | void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ |
173 | int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ | 175 | int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ |
174 | 176 | ||
177 | iDeclareType(WrapText) | ||
178 | |||
179 | struct Impl_WrapText { | ||
180 | /* arguments */ | ||
181 | iRangecc text; | ||
182 | int maxWidth; | ||
183 | iBool (*wrapFunc)(iWrapText *, iRangecc wrappedText, int advance); | ||
184 | void * context; | ||
185 | /* output */ | ||
186 | iInt2 cursor_out; | ||
187 | /* internal */ | ||
188 | iRangecc wrapRange_; | ||
189 | }; | ||
190 | |||
191 | iRect measure_WrapText (iWrapText *, int fontId); | ||
192 | iInt2 advance_WrapText (iWrapText *, int fontId); | ||
193 | void draw_WrapText (iWrapText *, int fontId, iInt2 pos, int color); | ||
194 | |||
175 | SDL_Texture * glyphCache_Text (void); | 195 | SDL_Texture * glyphCache_Text (void); |
176 | 196 | ||
177 | enum iTextBlockMode { quadrants_TextBlockMode, shading_TextBlockMode }; | 197 | enum iTextBlockMode { quadrants_TextBlockMode, shading_TextBlockMode }; |