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.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ui/text.c b/src/ui/text.c
index d35b470c..54b0a9da 100644
--- a/src/ui/text.c
+++ b/src/ui/text.c
@@ -1237,7 +1237,7 @@ iInt2 advanceN_Text(int fontId, const char *text, size_t n) {
1237 return init_I2(advance, lineHeight_Text(fontId)); 1237 return init_I2(advance, lineHeight_Text(fontId));
1238} 1238}
1239 1239
1240static void drawBounded_Text_(int fontId, iInt2 pos, int xposBound, int color, iRangecc text) { 1240static void drawBoundedN_Text_(int fontId, iInt2 pos, int xposBound, int color, iRangecc text, size_t maxLen) {
1241 iText *d = &text_; 1241 iText *d = &text_;
1242 iFont *font = font_Text_(fontId); 1242 iFont *font = font_Text_(fontId);
1243 const iColor clr = get_Color(color & mask_ColorId); 1243 const iColor clr = get_Color(color & mask_ColorId);
@@ -1248,11 +1248,16 @@ static void drawBounded_Text_(int fontId, iInt2 pos, int xposBound, int color, i
1248 (color & fillBackground_ColorId ? fillBackground_RunMode : 0) | 1248 (color & fillBackground_ColorId ? fillBackground_RunMode : 0) |
1249 runFlagsFromId_(fontId), 1249 runFlagsFromId_(fontId),
1250 .text = text, 1250 .text = text,
1251 .maxLen = maxLen,
1251 .pos = pos, 1252 .pos = pos,
1252 .xposLayoutBound = xposBound, 1253 .xposLayoutBound = xposBound,
1253 .color = color & mask_ColorId }); 1254 .color = color & mask_ColorId });
1254} 1255}
1255 1256
1257static void drawBounded_Text_(int fontId, iInt2 pos, int xposBound, int color, iRangecc text) {
1258 drawBoundedN_Text_(fontId, pos, xposBound, color, text, 0);
1259}
1260
1256static void draw_Text_(int fontId, iInt2 pos, int color, iRangecc text) { 1261static void draw_Text_(int fontId, iInt2 pos, int color, iRangecc text) {
1257 drawBounded_Text_(fontId, pos, 0, color, text); 1262 drawBounded_Text_(fontId, pos, 0, color, text);
1258} 1263}
@@ -1295,6 +1300,10 @@ void drawRange_Text(int fontId, iInt2 pos, int color, iRangecc text) {
1295 draw_Text_(fontId, pos, color, text); 1300 draw_Text_(fontId, pos, color, text);
1296} 1301}
1297 1302
1303void drawRangeN_Text(int fontId, iInt2 pos, int color, iRangecc text, size_t maxChars) {
1304 drawBoundedN_Text_(fontId, pos, 0, color, text, maxChars);
1305}
1306
1298iInt2 advanceWrapRange_Text(int fontId, int maxWidth, iRangecc text) { 1307iInt2 advanceWrapRange_Text(int fontId, int maxWidth, iRangecc text) {
1299 iInt2 size = zero_I2(); 1308 iInt2 size = zero_I2();
1300 const char *endp; 1309 const char *endp;