when drawing and measuring strings in "flow" mode, don't ellipsize so that lines can wrap
This commit is contained in:
parent
7b4556b211
commit
0da49e82ae
1 changed files with 18 additions and 12 deletions
|
@ -148,11 +148,13 @@ static void font_measure_full(const RrFont *f, const gchar *str,
|
||||||
if (flow) {
|
if (flow) {
|
||||||
pango_layout_set_single_paragraph_mode(f->layout, FALSE);
|
pango_layout_set_single_paragraph_mode(f->layout, FALSE);
|
||||||
pango_layout_set_width(f->layout, maxwidth * PANGO_SCALE);
|
pango_layout_set_width(f->layout, maxwidth * PANGO_SCALE);
|
||||||
|
pango_layout_set_ellipsize(f->layout, PANGO_ELLIPSIZE_NONE);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* single line mode */
|
/* single line mode */
|
||||||
pango_layout_set_single_paragraph_mode(f->layout, TRUE);
|
pango_layout_set_single_paragraph_mode(f->layout, TRUE);
|
||||||
pango_layout_set_width(f->layout, -1);
|
pango_layout_set_width(f->layout, -1);
|
||||||
|
pango_layout_set_ellipsize(f->layout, PANGO_ELLIPSIZE_MIDDLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pango_layout_get_pixel_extents lies! this is the right way to get the
|
/* pango_layout_get_pixel_extents lies! this is the right way to get the
|
||||||
|
@ -240,19 +242,23 @@ void RrFontDraw(XftDraw *d, RrTextureText *t, RrRect *area)
|
||||||
w -= 4;
|
w -= 4;
|
||||||
h = area->height;
|
h = area->height;
|
||||||
|
|
||||||
switch (t->ellipsize) {
|
if (t->flow)
|
||||||
case RR_ELLIPSIZE_NONE:
|
|
||||||
ell = PANGO_ELLIPSIZE_NONE;
|
ell = PANGO_ELLIPSIZE_NONE;
|
||||||
break;
|
else {
|
||||||
case RR_ELLIPSIZE_START:
|
switch (t->ellipsize) {
|
||||||
ell = PANGO_ELLIPSIZE_START;
|
case RR_ELLIPSIZE_NONE:
|
||||||
break;
|
ell = PANGO_ELLIPSIZE_NONE;
|
||||||
case RR_ELLIPSIZE_MIDDLE:
|
break;
|
||||||
ell = PANGO_ELLIPSIZE_MIDDLE;
|
case RR_ELLIPSIZE_START:
|
||||||
break;
|
ell = PANGO_ELLIPSIZE_START;
|
||||||
case RR_ELLIPSIZE_END:
|
break;
|
||||||
ell = PANGO_ELLIPSIZE_END;
|
case RR_ELLIPSIZE_MIDDLE:
|
||||||
break;
|
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_text(t->font->layout, t->string, -1);
|
||||||
|
|
Loading…
Reference in a new issue