diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-27 15:02:53 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-27 15:02:53 +0300 |
commit | 3d25f624d92668377eac1f206a77267563db7edc (patch) | |
tree | f1e98c96e8896ec474fc3fe3a4c4c6697e5b6c42 /src/ui/text.c | |
parent | c73a54f3c416eb80974385f97c76f725448153aa (diff) |
DocumentWidget: Composited link numbers/letters
Draw the circle and the number/letter separately since we don't
have a font with all the glyphs.
Diffstat (limited to 'src/ui/text.c')
-rw-r--r-- | src/ui/text.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/text.c b/src/ui/text.c index 54b0a9da..980f15bd 100644 --- a/src/ui/text.c +++ b/src/ui/text.c | |||
@@ -1341,13 +1341,16 @@ void drawCentered_Text(int fontId, iRect rect, iBool alignVisual, int color, con | |||
1341 | vprintf_Block(&chars, format, args); | 1341 | vprintf_Block(&chars, format, args); |
1342 | va_end(args); | 1342 | va_end(args); |
1343 | } | 1343 | } |
1344 | const iRangecc text = range_Block(&chars); | 1344 | drawCenteredRange_Text(fontId, rect, alignVisual, color, range_Block(&chars)); |
1345 | iRect textBounds = alignVisual ? visualBounds_Text(fontId, text) | 1345 | deinit_Block(&chars); |
1346 | } | ||
1347 | |||
1348 | void drawCenteredRange_Text(int fontId, iRect rect, iBool alignVisual, int color, iRangecc text) { | ||
1349 | iRect textBounds = alignVisual ? visualBounds_Text(fontId, text) | ||
1346 | : (iRect){ zero_I2(), advanceRange_Text(fontId, text) }; | 1350 | : (iRect){ zero_I2(), advanceRange_Text(fontId, text) }; |
1347 | textBounds.pos = sub_I2(mid_Rect(rect), mid_Rect(textBounds)); | 1351 | textBounds.pos = sub_I2(mid_Rect(rect), mid_Rect(textBounds)); |
1348 | textBounds.pos.x = iMax(textBounds.pos.x, left_Rect(rect)); /* keep left edge visible */ | 1352 | textBounds.pos.x = iMax(textBounds.pos.x, left_Rect(rect)); /* keep left edge visible */ |
1349 | draw_Text_(fontId, textBounds.pos, color, text); | 1353 | draw_Text_(fontId, textBounds.pos, color, text); |
1350 | deinit_Block(&chars); | ||
1351 | } | 1354 | } |
1352 | 1355 | ||
1353 | SDL_Texture *glyphCache_Text(void) { | 1356 | SDL_Texture *glyphCache_Text(void) { |