X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=render%2Ffont.c;h=a32bf7ce0a5ae995f3c3bcf567d22917d2c41289;hb=7c1a00802326a608bc1baeb67731a9ab3eda8ba6;hp=48321aec63a24dd0abd7fef90925850085b2c952;hpb=3b8bcd3e3a5ccb94c8d0c832c671f1f845f2ce76;p=chaz%2Fopenbox diff --git a/render/font.c b/render/font.c index 48321aec..a32bf7ce 100644 --- a/render/font.c +++ b/render/font.c @@ -109,7 +109,6 @@ RrFont *RrFontOpen(const RrInstance *inst, const gchar *name, gint size, /* setup the layout */ pango_layout_set_font_description(out->layout, out->font_desc); pango_layout_set_single_paragraph_mode(out->layout, TRUE); - pango_layout_set_ellipsize(out->layout, PANGO_ELLIPSIZE_MIDDLE); /* get the ascent and descent */ measure_font(inst, out); @@ -207,6 +206,7 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) gint mw; PangoRectangle rect; PangoAttrList *attrlist; + PangoEllipsizeMode ell; /* center the text vertically We do this centering based on the 'baseline' since different fonts have @@ -220,8 +220,24 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area) w = area->width - 4; h = area->height; + switch (t->ellipsize) { + case RR_ELLIPSIZE_NONE: + ell = PANGO_ELLIPSIZE_NONE; + break; + case RR_ELLIPSIZE_START: + ell = PANGO_ELLIPSIZE_START; + break; + case RR_ELLIPSIZE_MIDDLE: + ell = PANGO_ELLIPSIZE_MIDDLE; + break; + case RR_ELLIPSIZE_END: + ell = PANGO_ELLIPSIZE_END; + break; + } + pango_layout_set_text(t->font->layout, t->string, -1); pango_layout_set_width(t->font->layout, w * PANGO_SCALE); + pango_layout_set_ellipsize(t->font->layout, ell); /* * * end of setting up the layout * * */