From: Dana Jansens Date: Tue, 3 Jun 2003 20:31:03 +0000 (+0000) Subject: add shadows.. supposedly X-Git-Tag: gl-oldtheme~52 X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=06a8a2c8806f8a1b9b132c94bc5942e645f0eb90;p=dana%2Fopenbox.git add shadows.. supposedly --- diff --git a/glft/render.c b/glft/render.c index 730e47fb..3590ad6a 100644 --- a/glft/render.c +++ b/glft/render.c @@ -50,17 +50,12 @@ void GlftRenderGlyph(FT_Face face, struct GlftGlyph *g) g_free(padbuf); } -void GlftRenderString(struct GlftFont *font, const char *str, int bytes, - struct GlftColor *color, int x, int y) +static void drawstring(struct GlftFont *font, const char *str, int bytes, + struct GlftColor *color, int x, int y) { const char *c; struct GlftGlyph *g, *p = NULL; - if (!g_utf8_validate(str, bytes, NULL)) { - GlftDebug("Invalid UTF-8 in string\n"); - return; - } - glColor4f(color->r, color->g, color->b, color->a); glPushMatrix(); glTranslatef(x, y, 0.0); @@ -94,6 +89,29 @@ void GlftRenderString(struct GlftFont *font, const char *str, int bytes, glPopMatrix(); } +void GlftRenderString(struct GlftFont *font, const char *str, int bytes, + struct GlftColor *color, int x, int y) +{ + if (!g_utf8_validate(str, bytes, NULL)) { + GlftDebug("Invalid UTF-8 in string\n"); + return; + } + + drawstring(font, str, bytes, color, x, y); + if (font->shadow && font->shadow_alpha != 0) { + struct GlftColor c; + if (font->shadow_alpha > 0) { + c.r = c.g = c.b = 0.0; + c.a = font->shadow_alpha; + } else { + c.r = c.g = c.b = 1.0; + c.a = -font->shadow_alpha; + } + drawstring(font, str, bytes, &c, + x + font->shadow_offset, y + font->shadow_offset); + } +} + void GlftMeasureString(struct GlftFont *font, const char *str, int bytes,