[pango/introspection-fixes: 7/8] layout: Add some api for introspection




commit 6735e96058a007da315670aef1bc770e816e5d98
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 9 23:35:19 2021 -0400

    layout: Add some api for introspection
    
    Add accessors for PangoLayoutLine fields.
    
    Fixes: #553

 pango/pango-layout.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 pango/pango-layout.h |  9 ++++++++
 2 files changed, 74 insertions(+)
---
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
@@ -4516,6 +4516,71 @@ G_DEFINE_BOXED_TYPE (PangoLayoutLine, pango_layout_line,
                      pango_layout_line_ref,
                      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`
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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]