diff options
| author | Dana Jansens <danakj@orodu.net> | 2008-02-06 22:12:54 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2008-02-07 02:14:44 -0500 |
| commit | 9e3ce4efedd4d6178ab6bd967fa7cf0867297e57 (patch) | |
| tree | 9a36f4cbbcf053ddd4ed70ba5bc58a6bd968d193 /render/render.c | |
| parent | a01ece1353465ef471becdad3e448c32a4516f43 (diff) | |
allow font rendering to use multiple lines
Diffstat (limited to 'render/render.c')
| -rw-r--r-- | render/render.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/render/render.c b/render/render.c index 2147df01..75dead16 100644 --- a/render/render.c +++ b/render/render.c @@ -180,8 +180,6 @@ RrAppearance *RrAppearanceNew(const RrInstance *inst, gint numtex) void RrAppearanceRemoveTextures(RrAppearance *a) { - gint i; - g_free(a->texture); a->textures = 0; } @@ -387,6 +385,7 @@ gint RrMinWidth(RrAppearance *a) a->texture[i].data.text.string, a->texture[i].data.text.shadow_offset_x, a->texture[i].data.text.shadow_offset_y, + a->texture[i].data.text.flow, a->texture[i].data.text.maxwidth); w = MAX(w, m->width); g_free(m); @@ -413,6 +412,7 @@ gint RrMinHeight(RrAppearance *a) { gint i; gint l, t, r, b; + RrSize *m; gint h = 0; for (i = 0; i < a->textures; ++i) { @@ -423,8 +423,24 @@ gint RrMinHeight(RrAppearance *a) h = MAX(h, a->texture[i].data.mask.mask->height); break; case RR_TEXTURE_TEXT: - h += MAX(h, RrFontHeight(a->texture[i].data.text.font, - a->texture[i].data.text.shadow_offset_y)); + if (a->texture[i].data.text.flow) { + g_assert(a->texture[i].data.text.string != NULL); + + m = RrFontMeasureString + (a->texture[i].data.text.font, + a->texture[i].data.text.string, + a->texture[i].data.text.shadow_offset_x, + a->texture[i].data.text.shadow_offset_y, + a->texture[i].data.text.flow, + a->texture[i].data.text.maxwidth); + h += MAX(h, m->height); + g_free(m); + } + else + h += MAX(h, + RrFontHeight + (a->texture[i].data.text.font, + a->texture[i].data.text.shadow_offset_y)); break; case RR_TEXTURE_RGBA: h += MAX(h, a->texture[i].data.rgba.height); |
