From 0610dd4f3064220a2e8fb1d8dc120044eb6c64a8 Mon Sep 17 00:00:00 2001 From: scuri Date: Tue, 23 Jun 2009 03:18:33 +0000 Subject: *** empty log message *** --- src/sim/cdfontex.c | 20 ++++---------------- src/sim/sim_text.c | 4 ++-- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'src/sim') 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 */ -- cgit v1.2.3