summaryrefslogtreecommitdiff
path: root/pango/ellipsize.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-01-16 10:36:42 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-01-16 10:36:42 +0000
commit9354b7f487b706ddb693a32fe01cdaf729f0b66b (patch)
tree99da184a9a6fdccd1ed480b5c4e65a9ee25d04a5 /pango/ellipsize.c
parent375cb212021277fd31142080a4ebb3fcf9b27a43 (diff)
downloadpango-9354b7f487b706ddb693a32fe01cdaf729f0b66b.tar.gz
Bug 363510 – Ability to query whether a PangoLayout is effectively
2007-01-16 Behdad Esfahbod <behdad@gnome.org> Bug 363510 – Ability to query whether a PangoLayout is effectively ellipsized (as opposed to the set_ellpisize()/get_ellipsize() methods which only set a request, or return the set request respectively) Patch from Milosz Derezynski * pango/pango-layout.h: * pango/ellipsize.c (_pango_layout_line_ellipsize): * pango/pango-layout-private.h: * pango/pango-layout.c (pango_layout_init), (pango_layout_copy), (pango_layout_is_ellipsized), (pango_layout_clear_lines), (pango_layout_line_postprocess): New public function: pango_layout_is_ellipsized() * pango/pango.def: * docs/tmpl/layout.sgml: * docs/pango-sections.txt: Update. svn path=/trunk/; revision=2150
Diffstat (limited to 'pango/ellipsize.c')
-rw-r--r--pango/ellipsize.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pango/ellipsize.c b/pango/ellipsize.c
index b1523afe..e392d3c9 100644
--- a/pango/ellipsize.c
+++ b/pango/ellipsize.c
@@ -717,17 +717,20 @@ current_width (EllipsizeState *state)
*
* Given a #PangoLayoutLine with the runs still in logical order, ellipsize
* it according the layout's policy to fit within the set width of the layout.
+ *
+ * Return value: whether the line had to be ellipsized
**/
-void
+gboolean
_pango_layout_line_ellipsize (PangoLayoutLine *line,
PangoAttrList *attrs)
{
EllipsizeState state;
int goal_width;
+ gboolean is_ellipsized = FALSE;
if (line->layout->ellipsize == PANGO_ELLIPSIZE_NONE ||
line->layout->width < 0)
- return;
+ goto ret;
init_state (&state, line, attrs);
@@ -750,7 +753,10 @@ _pango_layout_line_ellipsize (PangoLayoutLine *line,
g_slist_free (line->runs);
line->runs = get_run_list (&state);
+ is_ellipsized = TRUE;
out:
free_state (&state);
+ ret:
+ return is_ellipsized;
}