summaryrefslogtreecommitdiff
path: root/src/ui/text.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/text.c')
-rw-r--r--src/ui/text.c9
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
1348void 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
1353SDL_Texture *glyphCache_Text(void) { 1356SDL_Texture *glyphCache_Text(void) {