summaryrefslogtreecommitdiff
path: root/pango/pango-layout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2019-08-16 08:30:51 -0400
committerMatthias Clasen <mclasen@redhat.com>2019-10-31 19:47:43 -0400
commit6e3a8ad9cc915e11df720e271f0a59b8d354c5ba (patch)
tree60a0c6f3c7962c1638a6364270e771a8a3b1311f /pango/pango-layout.c
parent5ed6d2589f8c553bfdfff080b8bea5c90bfefad6 (diff)
downloadpango-6e3a8ad9cc915e11df720e271f0a59b8d354c5ba.tar.gz
Add pango_layout_get_direction
This lets callers access to resolved text direction of a layout. GTK needs this. Closes: https://gitlab.gnome.org/GNOME/pango/issues/14
Diffstat (limited to 'pango/pango-layout.c')
-rw-r--r--pango/pango-layout.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index aa542786..898a6a1c 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -2353,6 +2353,32 @@ pango_layout_line_get_char_direction (PangoLayoutLine *layout_line,
}
/**
+ * pango_layout_get_direction:
+ * @layout: a #PangoLayout
+ * @index: the byte index of the char
+ *
+ * Gets the text direction at the given character
+ * position in @layout.
+ *
+ * Returns: the text direction at @index
+ *
+ * Since: 1.46
+ */
+PangoDirection
+pango_layout_get_direction (PangoLayout *layout,
+ int index)
+{
+ PangoLayoutLine *line;
+
+ line = pango_layout_index_to_line_and_extents (layout, index, NULL);
+
+ if (line)
+ return pango_layout_line_get_char_direction (line, index);
+
+ return PANGO_DIRECTION_LTR;
+}
+
+/**
* pango_layout_get_cursor_pos:
* @layout: a #PangoLayout
* @index_: the byte index of the cursor