summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-07-09 23:35:19 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-08-01 23:25:13 -0400
commit6735e96058a007da315670aef1bc770e816e5d98 (patch)
treec3208461598ee959ca2e7e294b574e784b5e8081
parent626c131eaf3c040cf01da573e4c265144aeaa78d (diff)
downloadpango-6735e96058a007da315670aef1bc770e816e5d98.tar.gz
layout: Add some api for introspection
Add accessors for PangoLayoutLine fields. Fixes: #553
-rw-r--r--pango/pango-layout.c65
-rw-r--r--pango/pango-layout.h9
2 files changed, 74 insertions, 0 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c
index f5175552..8303be2c 100644
--- a/pango/pango-layout.c
+++ b/pango/pango-layout.c
@@ -4517,6 +4517,71 @@ G_DEFINE_BOXED_TYPE (PangoLayoutLine, pango_layout_line,
pango_layout_line_unref);
/**
+ * pango_layout_line_get_start_index:
+ * @line: a `PangoLayoutLine`
+ *
+ * Returns the start index of the line, as byte index
+ * into the text of the layout.
+ *
+ * Returns: the start index of the line
+ *
+ * Since: 1.50
+ */
+int
+pango_layout_line_get_start_index (PangoLayoutLine *line)
+{
+ return line->start_index;
+}
+
+/**
+ * pango_layout_line_get_length:
+ * @line: a `PangoLayoutLine`
+ *
+ * Returns the length of the line, in bytes.
+ *
+ * Returns: the length of the line
+ *
+ * Since: 1.50
+ */
+int
+pango_layout_line_get_length (PangoLayoutLine *line)
+{
+ return line->length;
+}
+
+/**
+ * pango_layout_line_is_paragraph_start:
+ * @line: a `PangoLayoutLine`
+ *
+ * Returns whether this is the first line of the paragraph.
+ *
+ * Returns: %TRUE if this is the first line
+ *
+ * Since: 1.50
+ */
+gboolean
+pango_layout_line_is_paragraph_start (PangoLayoutLine *line)
+{
+ return line->is_paragraph_start;
+}
+
+/**
+ * pango_layout_line_get_resolved_direction:
+ * @line: a `PangoLayoutLine`
+ *
+ * Returns the resolved direction of the line.
+ *
+ * Returns: the resolved direction of the line
+ *
+ * Since: 1.50
+ */
+PangoDirection
+pango_layout_line_get_resolved_direction (PangoLayoutLine *line)
+{
+ return (PangoDirection) line->resolved_dir;
+}
+
+/**
* pango_layout_line_x_to_index:
* @line: a `PangoLayoutLine`
* @x_pos: the X offset (in Pango units) from the left edge of the line.
diff --git a/pango/pango-layout.h b/pango/pango-layout.h
index 7042ec44..34758ae3 100644
--- a/pango/pango-layout.h
+++ b/pango/pango-layout.h
@@ -347,6 +347,15 @@ PangoLayoutLine *pango_layout_line_ref (PangoLayoutLine *line);
PANGO_AVAILABLE_IN_ALL
void pango_layout_line_unref (PangoLayoutLine *line);
+PANGO_AVAILABLE_IN_1_50
+int pango_layout_line_get_start_index (PangoLayoutLine *line);
+PANGO_AVAILABLE_IN_1_50
+int pango_layout_line_get_length (PangoLayoutLine *line);
+PANGO_AVAILABLE_IN_1_50
+gboolean pango_layout_line_is_paragraph_start (PangoLayoutLine *line);
+PANGO_AVAILABLE_IN_1_50
+PangoDirection pango_layout_line_get_resolved_direction (PangoLayoutLine *line);
+
PANGO_AVAILABLE_IN_ALL
gboolean pango_layout_line_x_to_index (PangoLayoutLine *line,
int x_pos,