summaryrefslogtreecommitdiff
path: root/pango/ellipsize.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-01-15 01:20:44 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-01-15 01:20:44 +0000
commit0946d48d16c30e5b64e3ad946454324a3628be08 (patch)
tree8e77638d0945c3e92d8435710bd683861014394f /pango/ellipsize.c
parent7f7dbc1ecc87f11c03aea4a37e2011af3dd9b308 (diff)
downloadpango-0946d48d16c30e5b64e3ad946454324a3628be08.tar.gz
Bug 469313 – Add pango_layout_set_height() Bug 508179 – PangoGlyphUnit
2008-01-14 Behdad Esfahbod <behdad@gnome.org> Bug 469313 – Add pango_layout_set_height() Bug 508179 – PangoGlyphUnit confusion * pango/pango-layout.h: * pango/pango-layout-private.h: * pango/pango-layout.c: * pango/ellipsize.c (_pango_layout_line_ellipsize): New public API: pango_layout_set_height() See docs for semantics. Currently only negative height values (number of lines) is implemented. * pango-view/viewer-render.c (make_layout), (output_body), (parse_options): Implement --height. * pango/pango.def: * docs/pango-sections.txt: * docs/tmpl/layout.sgml: Update. 2008-01-14 Behdad Esfahbod <behdad@gnome.org> Bug 508179 – PangoGlyphUnit confusion * pango/pangowin32.c: * pango/glyphstring.c: * pango/pango-layout.c (process_item): Remove all traces of #PangoGlyphUnit svn path=/trunk/; revision=2542
Diffstat (limited to 'pango/ellipsize.c')
-rw-r--r--pango/ellipsize.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index aa49720d..71e291a0 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -723,22 +723,16 @@ current_width (EllipsizeState *state)
**/
gboolean
_pango_layout_line_ellipsize (PangoLayoutLine *line,
- PangoAttrList *attrs)
+ PangoAttrList *attrs,
+ int goal_width)
{
EllipsizeState state;
- int goal_width;
gboolean is_ellipsized = FALSE;
- if (line->layout->ellipsize == PANGO_ELLIPSIZE_NONE ||
- line->layout->width < 0)
- goto ret;
+ g_return_val_if_fail (line->layout->ellipsize != PANGO_ELLIPSIZE_NONE && goal_width >= 0, is_ellipsized);
init_state (&state, line, attrs);
- goal_width = state.layout->width;
- if (state.layout->indent > 0 && state.layout->alignment != PANGO_ALIGN_CENTER)
- goal_width -= state.layout->indent;
-
if (state.total_width <= goal_width)
goto out;
@@ -758,6 +752,6 @@ _pango_layout_line_ellipsize (PangoLayoutLine *line,
out:
free_state (&state);
- ret:
+
return is_ellipsized;
}