X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Ffont.c;h=a099c0930812a01bffb2b0be794a817a6f2e43cc;hb=854da68d0f5bed8c85c101fd6895244d60183ff5;hp=922bdb7ea7ecf96adf19c1d93858e9468224bb5a;hpb=15c77071814d2325ebc1cbb6b84f01f4b8cb7184;p=chaz%2Fopenbox diff --git a/render/font.c b/render/font.c index 922bdb7e..a099c093 100644 --- a/render/font.c +++ b/render/font.c @@ -2,13 +2,12 @@ #include "color.h" #include "mask.h" #include "theme.h" -#include "kernel/geom.h" -#include "kernel/gettext.h" -#define _(str) gettext(str) +#include "gettext.h" #include #include #include +#include #define ELIPSES "..." #define ELIPSES_LENGTH(font) \ @@ -57,7 +56,6 @@ static RrFont *openfont(const RrInstance *inst, char *fontstring) return NULL; match = XftFontMatch(RrDisplay(inst), RrScreen(inst), pat, &res); - FcPatternDestroy(pat); if (!match) return NULL; @@ -66,7 +64,6 @@ static RrFont *openfont(const RrInstance *inst, char *fontstring) if (FcPatternGetBool(match, OB_SHADOW, 0, &out->shadow) != FcResultMatch) out->shadow = FALSE; - g_message("shadow %d", out->shadow); if (FcPatternGetInteger(match, OB_SHADOW_OFFSET, 0, &out->offset) != FcResultMatch) @@ -80,6 +77,7 @@ static RrFont *openfont(const RrInstance *inst, char *fontstring) font = XftFontOpenPattern(RrDisplay(inst), match); if (!font) { + FcPatternDestroy(match); g_free(out); return NULL; } else @@ -135,7 +133,7 @@ int RrFontMeasureString(const RrFont *f, const gchar *str) { gint x, y; font_measure_full (f, str, &x, &y); - return x; + return x + 4; } int RrFontHeight(const RrFont *f) @@ -149,7 +147,7 @@ int RrFontMaxCharWidth(const RrFont *f) return (signed) f->xftfont->max_advance_width; } -void RrFontDraw(XftDraw *d, RrTextureText *t, Rect *area) +void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) { gint x,y,w,h; XftColor c; @@ -228,5 +226,7 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, Rect *area) XftDrawStringUtf8(d, &c, t->font->xftfont, x, t->font->xftfont->ascent + y, (FcChar8*)text->str, l); + + g_string_free(text, TRUE); return; }