summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/cdfontex.c20
-rw-r--r--src/sim/sim_text.c4
2 files changed, 6 insertions, 18 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)
diff --git a/src/sim/sim_text.c b/src/sim/sim_text.c
index 7172e16..86821ce 100644
--- a/src/sim/sim_text.c
+++ b/src/sim/sim_text.c
@@ -305,8 +305,8 @@ void simGetPenPos(cdCanvas* canvas, int x, int y, const char* s, FT_Matrix *matr
int old_invert_yaxis = canvas->invert_yaxis;
int w, h, ascent, height, baseline;
- cdCanvasGetTextSize(canvas, s, &w, &h);
- cdCanvasGetFontDim(canvas, NULL, &height, &ascent, NULL);
+ cdgettextsizeSIM(canvas->ctxcanvas, s, &w, &h);
+ cdgetfontdimSIM(canvas->ctxcanvas, NULL, &height, &ascent, NULL);
baseline = height - ascent;
/* in this case we are always upwards */