summaryrefslogtreecommitdiff
path: root/src/sim/cdfontex.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/cdfontex.c')
-rw-r--r--src/sim/cdfontex.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/sim/cdfontex.c b/src/sim/cdfontex.c
index 699b06f..b0617a9 100644
--- a/src/sim/cdfontex.c
+++ b/src/sim/cdfontex.c
@@ -630,28 +630,16 @@ static void cdGetFontDimEx(int *max_width, int *line_height, int *ascent, int *d
static void cdGetTextSizeEx(const char *s, int *width, int *height)
{
- int i = 0, numlin = 1, max_line_width = 0, line_width = 0;
+ int i = 0, w = 0;
while (s[i] != '\0')
{
- if (s[i] == '\n')
- {
- numlin++;
- line_width = 0;
- }
- else
- {
- line_width += font.CharWidth(s[i]);
- }
-
- if (line_width > max_line_width)
- max_line_width = line_width;
-
+ w += font.CharWidth(s[i]);
i++;
}
- if (height) *height = numlin * font.line_height;
- if (width) *width = max_line_width;
+ if (height) *height = font.line_height;
+ if (width) *width = w;
}
void cdgetfontdimEX(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent)