diff options
author | scuri <scuri> | 2009-06-23 20:55:28 +0000 |
---|---|---|
committer | scuri <scuri> | 2009-06-23 20:55:28 +0000 |
commit | f658209d25477c490bf1892e68a0fd1384c1dded (patch) | |
tree | 1d4a2a1088db5ad62acaa3f97f13ccc8906c33b1 /src/sim/cdfontex.c | |
parent | 0610dd4f3064220a2e8fb1d8dc120044eb6c64a8 (diff) |
*** empty log message ***
Diffstat (limited to 'src/sim/cdfontex.c')
-rw-r--r-- | src/sim/cdfontex.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/sim/cdfontex.c b/src/sim/cdfontex.c index b0617a9..bafa5e7 100644 --- a/src/sim/cdfontex.c +++ b/src/sim/cdfontex.c @@ -620,19 +620,22 @@ static void cdFontEx(cdCanvas* canvas, const char* type_face, int style, int siz } } -static void cdGetFontDimEx(int *max_width, int *line_height, int *ascent, int *descent) +void cdgetfontdimEX(cdCtxCanvas* ctxcanvas, int *max_width, int *line_height, int *ascent, int *descent) { + cdCanvas* canvas = ((cdCtxCanvasBase*)ctxcanvas)->canvas; + cdFontEx(canvas, canvas->font_type_face, canvas->font_style, canvas->font_size); if (line_height) *line_height = font.line_height; if (max_width) *max_width = font.max_width; if (ascent) *ascent = font.ascent; if (descent) *descent = font.descent; } -static void cdGetTextSizeEx(const char *s, int *width, int *height) +void cdgettextsizeEX(cdCtxCanvas* ctxcanvas, const char *s, int len, int *width, int *height) { int i = 0, w = 0; - - while (s[i] != '\0') + cdCanvas* canvas = ((cdCtxCanvasBase*)ctxcanvas)->canvas; + cdFontEx(canvas, canvas->font_type_face, canvas->font_style, canvas->font_size); + while (i < len) { w += font.CharWidth(s[i]); i++; @@ -641,17 +644,3 @@ static void cdGetTextSizeEx(const char *s, int *width, int *height) if (height) *height = font.line_height; if (width) *width = w; } - -void cdgetfontdimEX(cdCtxCanvas* ctxcanvas, int *max_width, int *height, int *ascent, int *descent) -{ - cdCanvas* canvas = ((cdCtxCanvasBase*)ctxcanvas)->canvas; - cdFontEx(canvas, canvas->font_type_face, canvas->font_style, canvas->font_size); - cdGetFontDimEx(max_width, height, ascent, descent); -} - -void cdgettextsizeEX(cdCtxCanvas* ctxcanvas, const char *s, int *width, int *height) -{ - cdCanvas* canvas = ((cdCtxCanvasBase*)ctxcanvas)->canvas; - cdFontEx(canvas, canvas->font_type_face, canvas->font_style, canvas->font_size); - cdGetTextSizeEx(s, width, height); -} |