summaryrefslogtreecommitdiff
path: root/src/ui/text.h
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-07-01 07:34:41 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-07-01 07:34:41 +0300
commit5fec4c221b860ef33a45ced9919bc356d6dbb3d3 (patch)
tree60627a0331482fe16d1395fae8a397dae866ab5e /src/ui/text.h
parentb264791f65730b5e6c2414415cc4f4f1cb9253d8 (diff)
Text: Working on HarfBuzz
Diffstat (limited to 'src/ui/text.h')
-rw-r--r--src/ui/text.h22
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
164void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...); 165void drawAlign_Text (int fontId, iInt2 pos, int color, enum iAlignment align, const char *text, ...);
165void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...); 166void drawCentered_Text (int fontId, iRect rect, iBool alignVisual, int color, const char *text, ...);
166void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text); 167void drawCenteredRange_Text (int fontId, iRect rect, iBool alignVisual, int color, iRangecc text);
167void drawCenteredOutline_Text(int fontId, iRect rect, iBool alignVisual, int outlineColor, int fillColor, const char *text, ...); 168void drawCenteredOutline_Text(int fontId, iRect rect, iBool alignVisual, int outlineColor,
169 int fillColor, const char *text, ...);
168void drawString_Text (int fontId, iInt2 pos, int color, const iString *text); 170void drawString_Text (int fontId, iInt2 pos, int color, const iString *text);
169void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text); 171void drawRange_Text (int fontId, iInt2 pos, int color, iRangecc text);
170void drawRangeN_Text (int fontId, iInt2 pos, int color, iRangecc text, size_t maxLen); 172void 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
172void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */ 174void drawBoundRange_Text (int fontId, iInt2 pos, int boundWidth, int color, iRangecc text); /* bound does not wrap */
173int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */ 175int drawWrapRange_Text (int fontId, iInt2 pos, int maxWidth, int color, iRangecc text); /* returns new Y */
174 176
177iDeclareType(WrapText)
178
179struct 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
191iRect measure_WrapText (iWrapText *, int fontId);
192iInt2 advance_WrapText (iWrapText *, int fontId);
193void draw_WrapText (iWrapText *, int fontId, iInt2 pos, int color);
194
175SDL_Texture * glyphCache_Text (void); 195SDL_Texture * glyphCache_Text (void);
176 196
177enum iTextBlockMode { quadrants_TextBlockMode, shading_TextBlockMode }; 197enum iTextBlockMode { quadrants_TextBlockMode, shading_TextBlockMode };