X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Ffont.c;h=00f456fc71a5b9ec4a53422c6729ce64ffa1088a;hb=d193fc4a3df76815dc5835941d7b11ee9a79afe6;hp=a099c0930812a01bffb2b0be794a817a6f2e43cc;hpb=700e551390a86ffdb92ddc061914ec7687658d18;p=chaz%2Fopenbox diff --git a/render/font.c b/render/font.c index a099c093..00f456fc 100644 --- a/render/font.c +++ b/render/font.c @@ -28,7 +28,7 @@ static gboolean started = FALSE; static void font_startup(void) { if (!XftInit(0)) { - g_warning(_("Couldn't initialize Xft.\n")); + g_warning(_("Couldn't initialize Xft.")); exit(EXIT_FAILURE); } FcNameRegisterObjectTypes(objs, (sizeof(objs) / sizeof(objs[0]))); @@ -56,6 +56,7 @@ static RrFont *openfont(const RrInstance *inst, char *fontstring) return NULL; match = XftFontMatch(RrDisplay(inst), RrScreen(inst), pat, &res); + FcPatternDestroy(pat); if (!match) return NULL; @@ -152,7 +153,7 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) gint x,y,w,h; XftColor c; GString *text; - gint mw, em, mh; + gint mw, mh; size_t l; gboolean shortened = FALSE; @@ -171,12 +172,11 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) shortened = TRUE; /* remove a character from the middle */ text = g_string_erase(text, l-- / 2, 1); - em = ELIPSES_LENGTH(t->font); /* if the elipses are too large, don't show them at all */ - if (em > area->width) + if (ELIPSES_LENGTH(t->font) > area->width) shortened = FALSE; font_measure_full(t->font, text->str, &mw, &mh); - mw += em; + mw += ELIPSES_LENGTH(t->font); } if (shortened) { text = g_string_insert(text, (l + 1) / 2, ELIPSES);