diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-24 23:21:24 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-01-25 15:31:25 -0500 |
commit | 3164c9756406ea4261827c1e7a88cc88e9238c0e (patch) | |
tree | b4e1be47e5f650d7dc2815c42ac2182343e78a9e | |
parent | ccfd2e4f490c2d3a796bd3f64bf610988a23ff11 (diff) | |
download | pango-3164c9756406ea4261827c1e7a88cc88e9238c0e.tar.gz |
layout: undo an accidental removal
-rw-r--r-- | pango/pango-layout.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 43c7d9ad..8fe2e5f5 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -1645,6 +1645,85 @@ pango_layout_get_character_count (PangoLayout *layout) } /* }}} */ +/* {{{ Output getters */ + +/** + * pango_layout_get_lines: + * @layout: a `PangoLayout` + * + * Gets the lines of the @layout. + * + * The returned object will become invalid when any + * property of @layout is changed. Take a reference + * to keep it. + * + * Return value: (transfer none): a `PangoLines` object + * with the lines of @layout + */ +PangoLines * +pango_layout_get_lines (PangoLayout *layout) +{ + g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); + + ensure_lines (layout); + + return layout->lines; +} + +/** + * pango_layout_get_log_attrs: + * @layout: a `PangoLayout` + * @n_attrs: (out): return location for the length of the array + * + * Gets the `PangoLogAttr` array for the content + * of @layout. + * + * The returned array becomes invalid when + * any properties of @layout change. Make a + * copy if you want to keep it. + * + * Returns: (transfer none): the `PangoLogAttr` array + */ +const PangoLogAttr * +pango_layout_get_log_attrs (PangoLayout *layout, + int *n_attrs) +{ + PangoLayoutLine *line; + + g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); + + ensure_lines (layout); + + line = pango_lines_get_line (layout->lines, 0, NULL, NULL); + + if (n_attrs) + *n_attrs = line->data->n_chars + 1; + + return line->data->log_attrs; +} + +/** + * pango_layout_get_iter: + * @layout: a `PangoLayout` + * + * Returns an iterator to iterate over the visual extents + * of the layout. + * + * This is a convenience wrapper for [method@Pango.Lines.get_iter]. + * + * Returns: the new `PangoLayoutIter` + */ +PangoLayoutIter * +pango_layout_get_iter (PangoLayout *layout) +{ + g_return_val_if_fail (PANGO_IS_LAYOUT (layout), NULL); + + ensure_lines (layout); + + return pango_lines_get_iter (layout->lines); +} + +/* }}} */ /* }}} */ /* vim:set foldmethod=marker expandtab: */ |