[pango/line-breaker: 11/18] Add PangoSimpleLayout




commit 6eb806a71aa6e9c5909e0e284109ec01fc0aad6a
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 14 22:47:31 2022 -0500

    Add PangoSimpleLayout
    
    This is a simplified reimplementation of PangoLayout
    around PangoLineBreaker and PangoLines.

 pango/meson.build           |   1 +
 pango/pango-simple-layout.c | 710 ++++++++++++++++++++++++++++++++++++++++++++
 pango/pango-simple-layout.h |  80 +++++
 pango/pango.h               |   1 +
 4 files changed, 792 insertions(+)
---
diff --git a/pango/meson.build b/pango/meson.build
index 4f9612e8..884b6465 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -34,6 +34,7 @@ pango_sources = [
   'pango-line.c',
   'pango-line-breaker.c',
   'pango-lines.c',
+  'pango-simple-layout.c',
 ]
 
 pango_headers = [
diff --git a/pango/pango-simple-layout.c b/pango/pango-simple-layout.c
new file mode 100644
index 00000000..66f09a40
--- /dev/null
+++ b/pango/pango-simple-layout.c
@@ -0,0 +1,710 @@
+#include "config.h"
+
+#include "pango-simple-layout.h"
+#include "pango-line-breaker.h"
+#include "pango-lines.h"
+#include "pango-enum-types.h"
+
+
+/* {{{ PangoSimpleLayout implementation */
+
+struct _PangoSimpleLayout
+{
+  GObject parent_instance;
+
+  PangoContext *context;
+  char *text;
+  PangoAttrList *attrs;
+  int width;
+  PangoTabArray *tabs;
+  PangoWrapMode wrap;
+  int indent;
+  PangoAlignmentMode alignment;
+  PangoEllipsizeMode ellipsize;
+
+  PangoLines *lines;
+};
+
+struct _PangoSimpleLayoutClass
+{
+  GObjectClass parent_class;
+};
+
+enum
+{
+  PROP_CONTEXT = 1,
+  PROP_TEXT,
+  PROP_ATTRIBUTES,
+  PROP_WIDTH,
+  PROP_TABS,
+  PROP_WRAP,
+  PROP_INDENT,
+  PROP_ALIGNMENT,
+  PROP_ELLIPSIZE,
+  PROP_LINES,
+  NUM_PROPERTIES
+};
+
+static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
+
+G_DEFINE_TYPE (PangoSimpleLayout, pango_simple_layout, G_TYPE_OBJECT)
+
+static void
+pango_simple_layout_init (PangoSimpleLayout *layout)
+{
+  layout->width = -1;
+  layout->wrap = PANGO_WRAP_WORD;
+  layout->indent = 0;
+  layout->alignment = PANGO_ALIGNMENT_LEFT;
+  layout->ellipsize = PANGO_ELLIPSIZE_NONE;
+}
+
+static void
+pango_simple_layout_finalize (GObject *object)
+{
+  PangoSimpleLayout *layout = PANGO_SIMPLE_LAYOUT (object);
+
+  g_object_unref (layout->context);
+  g_free (layout->text);
+  g_clear_pointer (&layout->attrs, pango_attr_list_unref);
+  g_clear_pointer (&layout->tabs, pango_tab_array_free);
+  g_clear_object (&layout->lines);
+
+  G_OBJECT_CLASS (pango_simple_layout_parent_class)->finalize (object);
+}
+
+static void
+pango_simple_layout_set_property (GObject      *object,
+                                  guint         prop_id,
+                                  const GValue *value,
+                                  GParamSpec   *pspec)
+{
+  PangoSimpleLayout *layout = PANGO_SIMPLE_LAYOUT (object);
+
+  switch (prop_id)
+    {
+    case PROP_CONTEXT:
+      layout->context = g_value_dup_object (value);
+      break;
+
+    case PROP_TEXT:
+      pango_simple_layout_set_text (layout, g_value_get_string (value), -1);
+      break;
+
+    case PROP_ATTRIBUTES:
+      pango_simple_layout_set_attributes (layout, g_value_get_boxed (value));
+      break;
+
+    case PROP_WIDTH:
+      pango_simple_layout_set_width (layout, g_value_get_int (value));
+      break;
+
+    case PROP_TABS:
+      pango_simple_layout_set_tabs (layout, g_value_get_boxed (value));
+      break;
+
+    case PROP_WRAP:
+      pango_simple_layout_set_wrap (layout, g_value_get_enum (value));
+      break;
+
+    case PROP_INDENT:
+      pango_simple_layout_set_indent (layout, g_value_get_int (value));
+      break;
+
+    case PROP_ALIGNMENT:
+      pango_simple_layout_set_alignment (layout, g_value_get_enum (value));
+      break;
+
+    case PROP_ELLIPSIZE:
+      pango_simple_layout_set_ellipsize (layout, g_value_get_enum (value));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+pango_simple_layout_get_property (GObject      *object,
+                                  guint         prop_id,
+                                  GValue       *value,
+                                  GParamSpec   *pspec)
+{
+  PangoSimpleLayout *layout = PANGO_SIMPLE_LAYOUT (object);
+
+  switch (prop_id)
+    {
+    case PROP_CONTEXT:
+      g_value_set_object (value, layout->context);
+      break;
+
+    case PROP_TEXT:
+      g_value_set_string (value, layout->text);
+      break;
+
+    case PROP_ATTRIBUTES:
+      g_value_set_boxed (value, layout->attrs);
+      break;
+
+    case PROP_WIDTH:
+      g_value_set_int (value, layout->width);
+      break;
+
+    case PROP_TABS:
+      g_value_set_boxed (value, layout->tabs);
+      break;
+
+    case PROP_WRAP:
+      g_value_set_enum (value, layout->wrap);
+      break;
+
+    case PROP_INDENT:
+      g_value_set_int (value, layout->indent);
+      break;
+
+    case PROP_ALIGNMENT:
+      g_value_set_enum (value, layout->alignment);
+      break;
+
+    case PROP_ELLIPSIZE:
+      g_value_set_enum (value, layout->ellipsize);
+      break;
+
+    case PROP_LINES:
+      g_value_set_object (value, pango_simple_layout_get_lines (layout));
+      break;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      break;
+    }
+}
+
+static void
+pango_simple_layout_class_init (PangoSimpleLayoutClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  object_class->finalize = pango_simple_layout_finalize;
+  object_class->set_property = pango_simple_layout_set_property;
+  object_class->get_property = pango_simple_layout_get_property;
+
+  props[PROP_CONTEXT] = g_param_spec_object ("context", "context", "context",
+                                             PANGO_TYPE_CONTEXT,
+                                             G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+  props[PROP_TEXT] = g_param_spec_string ("text", "text", "text",
+                                          NULL,
+                                          G_PARAM_READWRITE);
+  props[PROP_ATTRIBUTES] = g_param_spec_boxed ("attributes", "attributes", "attributes",
+                                               PANGO_TYPE_ATTR_LIST,
+                                               G_PARAM_READWRITE);
+  props[PROP_WIDTH] = g_param_spec_int ("width", "width", "width",
+                                        -1, G_MAXINT, -1,
+                                        G_PARAM_READWRITE);
+  props[PROP_TABS] = g_param_spec_boxed ("tabs", "tabs", "tabs",
+                                         PANGO_TYPE_TAB_ARRAY,
+                                         G_PARAM_READWRITE);
+  props[PROP_WRAP] = g_param_spec_enum ("wrap", "wrap", "wrap",
+                                        PANGO_TYPE_WRAP_MODE,
+                                        PANGO_WRAP_WORD,
+                                        G_PARAM_READWRITE);
+  props[PROP_INDENT] = g_param_spec_int ("indent", "indent", "indent",
+                                         G_MININT, G_MAXINT, 0,
+                                         G_PARAM_READWRITE);
+  props[PROP_ALIGNMENT] = g_param_spec_enum ("alignment", "alignment", "alignment",
+                                             PANGO_TYPE_ALIGNMENT_MODE,
+                                             PANGO_ALIGNMENT_LEFT,
+                                             G_PARAM_READWRITE);
+  props[PROP_ELLIPSIZE] = g_param_spec_enum ("ellipsize", "ellipsize", "ellipsize",
+                                             PANGO_TYPE_ELLIPSIZE_MODE,
+                                             PANGO_ELLIPSIZE_NONE,
+                                             G_PARAM_READWRITE);
+  props[PROP_LINES] = g_param_spec_object ("lines", "lines", "lines",
+                                           PANGO_TYPE_LINES,
+                                           G_PARAM_READABLE);
+
+  g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
+}
+
+/*  }}} */
+/* {{{ Utilities */
+
+static void
+layout_changed (PangoSimpleLayout *layout)
+{
+  g_clear_object (&layout->lines);
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_LINES]);
+}
+
+static void
+compute_lines (PangoSimpleLayout *layout)
+{
+  PangoLineBreaker *breaker;
+  int x, y, width;
+  gboolean first_line;
+
+  breaker = pango_line_breaker_new (layout->context);
+  pango_line_breaker_add_text (breaker, layout->text, -1, layout->attrs);
+
+  layout->lines = pango_lines_new ();
+
+  x = y = 0;
+  first_line = TRUE;
+  while (!pango_line_breaker_done (breaker))
+    {
+      PangoLine *line;
+      PangoRectangle ext;
+
+      if (first_line == (layout->indent > 0))
+        {
+          x = abs (layout->indent);
+          width = layout->width - x;
+        }
+      else
+        {
+          x = 0;
+          width = layout->width;
+        }
+
+      line = pango_line_breaker_next_line (breaker,
+                                           x, width,
+                                           layout->wrap,
+                                           layout->ellipsize,
+                                           layout->alignment);
+
+      pango_lines_add_line (layout->lines, line, x, y);
+
+      pango_line_get_extents (line, &ext);
+      y += ext.height;
+      first_line = FALSE;
+    }
+
+  g_object_unref (breaker);
+}
+
+/* }}} */
+/* {{{ Public API */
+
+/**
+ * pango_simple_layout_new:
+ * @context: a `PangoContext`
+ *
+ * Creates a new `PangoSimpleLayout` with attribute initialized to
+ * default values for a particular `PangoContext`
+ *
+ * Return value: a newly allocated `PangoLayout`
+ */
+PangoSimpleLayout *
+pango_simple_layout_new (PangoContext *context)
+{
+  PangoSimpleLayout *layout;
+
+  g_return_val_if_fail (context != NULL, NULL);
+
+  layout = g_object_new (PANGO_TYPE_SIMPLE_LAYOUT, NULL);
+  layout->context = g_object_ref (context);
+
+  return layout;
+}
+
+/**
+ * pango_simple_layout_get_context:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Retrieves the `PangoContext` used for this layout.
+ *
+ * Return value: (transfer none): the `PangoContext` for the layout
+ */
+PangoContext *
+pango_simple_layout_get_context (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), NULL);
+
+  return layout->context;
+}
+
+/**
+ * pango_simple_layout_set_text:
+ * @layout: a `PangoSimpleLayout`
+ * @text: the text
+ * @length: maximum length of @text, in bytes. -1 indicates that
+ *   the string is nul-terminated
+ *
+ * Sets the text of the layout.
+ */
+void
+pango_simple_layout_set_text (PangoSimpleLayout *layout,
+                              const char        *text,
+                              int                length)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+
+  if (length < 0)
+    length = strlen (text);
+
+  g_free (layout->text);
+  layout->text = g_strndup (text, length);
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_TEXT]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_text:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the text in the layout.
+ *
+ * The returned text should not be freed or modified.
+ *
+ * Return value: (transfer none): the text in the @layout
+ */
+const char *
+pango_simple_layout_get_text (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), NULL);
+
+  return layout->text;
+}
+
+/**
+ * pango_simple_layout_set_attributes:
+ * @layout: a `PangoSimpleLayout`
+ * @attrs: (nullable) (transfer none): a `PangoAttrList`
+ *
+ * Sets the attributes for a layout object.
+ *
+ * References @attrs, so the caller can unref its reference.
+ */
+void
+pango_simple_layout_set_attributes (PangoSimpleLayout *layout,
+                                    PangoAttrList     *attrs)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+
+  g_clear_pointer (&layout->attrs, pango_attr_list_unref);
+  layout->attrs = attrs;
+  if (layout->attrs)
+    pango_attr_list_ref (layout->attrs);
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_ATTRIBUTES]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_attributes:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the attribute list for the layout, if any.
+ *
+ * Return value: (transfer none) (nullable): a `PangoAttrList`
+ */
+PangoAttrList *
+pango_simple_layout_get_attributes (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), NULL);
+
+  return layout->attrs;
+}
+
+/**
+ * pango_simple_layout_set_width:
+ * @layout: a `PangoSimpleLayout`.
+ * @width: the desired width in Pango units, or -1 to indicate that no
+ *   wrapping or ellipsization should be performed.
+ *
+ * Sets the width to which the lines of the layout should
+ * be wrapped or ellipsized.
+ *
+ * The default value is -1: no width set.
+ */
+void
+pango_simple_layout_set_width (PangoSimpleLayout *layout,
+                               int                width)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+  g_return_if_fail (width >= -1);
+
+  if (layout->width == width)
+    return;
+
+  layout->width = width;
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_WIDTH]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_width:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the width to which the lines of the layout should wrap.
+ *
+ * Return value: the width in Pango units, or -1 if no width set.
+ */
+int
+pango_simple_layout_get_width (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), -1);
+
+  return layout->width;
+}
+
+/**
+ * pango_simple_layout_set_tabs:
+ * @layout: a `PangoSimpleLayout`
+ * @tabs: (nullable): a `PangoTabArray`
+ *
+ * Sets the tabs to use for @layout, overriding the default tabs.
+ *
+ * `PangoSimpleLayout` will place content at the next tab position
+ * whenever it meets a Tab character (U+0009).
+ *
+ * By default, tabs are every 8 spaces. If @tabs is %NULL, the
+ * default tabs are reinstated. @tabs is copied into the layout;
+ * you must free your copy of @tabs yourself.
+ *
+ * Note that tabs and justification conflict with each other:
+ * Justification will move content away from its tab-aligned
+ * positions. The same is true for alignments other than
+ * %PANGO_ALIGNMENT_LEFT.
+ */
+void
+pango_simple_layout_set_tabs (PangoSimpleLayout *layout,
+                              PangoTabArray     *tabs)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+
+  if (layout->tabs == tabs)
+    return;
+
+  g_clear_pointer (&layout->tabs, pango_tab_array_free);
+  layout->tabs = pango_tab_array_copy (tabs);
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_TABS]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_tabs:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the current `PangoTabArray` used by this layout.
+ *
+ * If no `PangoTabArray` has been set, then the default tabs are
+ * in use and %NULL is returned. Default tabs are every 8 spaces.
+ *
+ * Return value: (transfer none) (nullable): the tabs for this layout
+ */
+PangoTabArray *
+pango_simple_layout_get_tabs (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), NULL);
+
+  return layout->tabs;
+}
+
+/**
+ * pango_simple_layout_set_wrap:
+ * @layout: a `PangoSimpleLayout`
+ * @wrap: the wrap mode
+ *
+ * Sets the wrap mode.
+ *
+ * The wrap mode only has effect if a width is set on the layout
+ * with [method@Pango.SimpleLayout.set_width]. To turn off wrapping,
+ * set the width to -1.
+ *
+ * The default value is %PANGO_WRAP_WORD.
+ */
+void
+pango_simple_layout_set_wrap (PangoSimpleLayout *layout,
+                              PangoWrapMode      wrap)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+
+  if (layout->wrap == wrap)
+    return;
+
+  layout->wrap = wrap;
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_WRAP]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_wrap:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the wrap mode for the layout.
+ *
+ * Return value: active wrap mode.
+ */
+PangoWrapMode
+pango_simple_layout_get_wrap (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), PANGO_WRAP_WORD);
+
+  return layout->wrap;
+}
+
+/**
+ * pango_simple_layout_set_indent:
+ * @layout: a `PangoSimpleLayout`
+ * @indent: the amount by which to indent
+ *
+ * Sets the width in Pango units to indent each paragraph.
+ *
+ * A negative value of @indent will produce a hanging indentation.
+ * That is, the first line will have the full width, and subsequent
+ * lines will be indented by the absolute value of @indent.
+ *
+ * The default value is 0.
+ */
+void
+pango_simple_layout_set_indent (PangoSimpleLayout *layout,
+                                int                indent)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+
+  if (layout->indent == indent)
+    return;
+
+  layout->indent = indent;
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_INDENT]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_indent:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the paragraph indent width in Pango units.
+ *
+ * A negative value indicates a hanging indentation.
+ *
+ * Return value: the indent in Pango units
+ */
+int
+pango_simple_layout_get_indent (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), 0);
+
+  return layout->indent;
+}
+
+/**
+ * pango_simple_layout_set_alignment:
+ * @layout: a `PangoSimpleLayout`
+ * @alignment: the alignment
+ *
+ * Sets the alignment for the layout: how short lines are
+ * positioned within the horizontal space available.
+ *
+ * The default alignment is %PANGO_ALIGNMENT_LEFT.
+ */
+void
+pango_simple_layout_set_alignment (PangoSimpleLayout  *layout,
+                                   PangoAlignmentMode  alignment)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+
+  if (layout->alignment == alignment)
+    return;
+
+  layout->alignment = alignment;
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_ALIGNMENT]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_alignment:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the alignment for the layout: how short lines are
+ * positioned within the horizontal space available.
+ *
+ * Return value: the alignment
+ */
+PangoAlignmentMode
+pango_simple_layout_get_alignment (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), PANGO_ALIGNMENT_LEFT);
+
+  return layout->alignment;
+}
+
+/**
+ * pango_simple_layout_set_ellipsize:
+ * @layout: a `PangoSimpleLayout`
+ * @ellipsize: the new ellipsization mode for @layout
+ *
+ * Sets the type of ellipsization being performed for @layout.
+ *
+ * Depending on the ellipsization mode @ellipsize text is removed
+ * from the start, middle, or end of text so they fit within the
+ * width of layout set with [method@Pango.SimpleLayout.set_width].
+ *
+ * The default value is %PANGO_ELLIPSIZE_NONE.
+ */
+void
+pango_simple_layout_set_ellipsize (PangoSimpleLayout  *layout,
+                                   PangoEllipsizeMode  ellipsize)
+{
+  g_return_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout));
+
+  if (layout->ellipsize == ellipsize)
+    return;
+
+  layout->ellipsize = ellipsize;
+
+  g_object_notify_by_pspec (G_OBJECT (layout), props[PROP_ELLIPSIZE]);
+  layout_changed (layout);
+}
+
+/**
+ * pango_simple_layout_get_ellipsize:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the type of ellipsization being performed for @layout.
+ *
+ * See [method@Pango.SimpleLayout.set_ellipsize].
+ *
+ * Return value: the current ellipsization mode for @layout
+ */
+PangoEllipsizeMode
+pango_simple_layout_get_ellipsize (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), PANGO_ELLIPSIZE_NONE);
+
+  return layout->ellipsize;
+}
+
+/**
+ * pango_simple_layout_get_lines:
+ * @layout: a `PangoSimpleLayout`
+ *
+ * Gets the lines of the @layout.
+ *
+ * Return value: (element-type Pango.Lines) (transfer none): a
+ *   `PangoLines` object with the lines of @layout. The object
+ *   will become invalid when any property of @layout is changed.
+ *   Take a reference to keep it
+ */
+PangoLines *
+pango_simple_layout_get_lines (PangoSimpleLayout *layout)
+{
+  g_return_val_if_fail (PANGO_IS_SIMPLE_LAYOUT (layout), NULL);
+
+  if (!layout->lines)
+    compute_lines (layout);
+
+  return layout->lines;
+}
+
+/* }}} */
+
+/* vim:set foldmethod=marker expandtab: */
diff --git a/pango/pango-simple-layout.h b/pango/pango-simple-layout.h
new file mode 100644
index 00000000..60c8d2c2
--- /dev/null
+++ b/pango/pango-simple-layout.h
@@ -0,0 +1,80 @@
+#pragma once
+
+#include <glib-object.h>
+#include <pango/pango-types.h>
+#include <pango/pango-attributes.h>
+#include <pango/pango-lines.h>
+
+G_BEGIN_DECLS
+
+#define PANGO_TYPE_SIMPLE_LAYOUT pango_simple_layout_get_type ()
+
+G_DECLARE_FINAL_TYPE (PangoSimpleLayout, pango_simple_layout, PANGO, SIMPLE_LAYOUT, GObject);
+
+PANGO_AVAILABLE_IN_ALL
+PangoSimpleLayout *     pango_simple_layout_new            (PangoContext       *context);
+
+PANGO_AVAILABLE_IN_ALL
+PangoContext *          pango_simple_layout_get_context    (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_text       (PangoSimpleLayout  *layout,
+                                                            const char         *text,
+                                                            int                 length);
+PANGO_AVAILABLE_IN_ALL
+const char *            pango_simple_layout_get_text       (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_attributes (PangoSimpleLayout  *layout,
+                                                            PangoAttrList      *attrs);
+
+PANGO_AVAILABLE_IN_ALL
+PangoAttrList *         pango_simple_layout_get_attributes (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_width      (PangoSimpleLayout  *layout,
+                                                            int                 width);
+
+PANGO_AVAILABLE_IN_ALL
+int                     pango_simple_layout_get_width      (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_tabs       (PangoSimpleLayout  *layout,
+                                                            PangoTabArray      *tabs);
+
+PANGO_AVAILABLE_IN_ALL
+PangoTabArray *         pango_simple_layout_get_tabs       (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_wrap       (PangoSimpleLayout  *layout,
+                                                            PangoWrapMode       wrap);
+
+PANGO_AVAILABLE_IN_ALL
+PangoWrapMode           pango_simple_layout_get_wrap       (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_indent     (PangoSimpleLayout  *layout,
+                                                            int                 indent);
+
+PANGO_AVAILABLE_IN_ALL
+int                     pango_simple_layout_get_indent     (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_alignment  (PangoSimpleLayout  *layout,
+                                                            PangoAlignmentMode  alignment);
+
+PANGO_AVAILABLE_IN_ALL
+PangoAlignmentMode      pango_simple_layout_get_alignment  (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+void                    pango_simple_layout_set_ellipsize  (PangoSimpleLayout  *layout,
+                                                            PangoEllipsizeMode  ellipsize);
+
+PANGO_AVAILABLE_IN_ALL
+PangoEllipsizeMode      pango_simple_layout_get_ellipsize  (PangoSimpleLayout  *layout);
+
+PANGO_AVAILABLE_IN_ALL
+PangoLines *            pango_simple_layout_get_lines      (PangoSimpleLayout  *layout);
+
+
+G_END_DECLS
diff --git a/pango/pango.h b/pango/pango.h
index 9890d57f..d6228dc3 100644
--- a/pango/pango.h
+++ b/pango/pango.h
@@ -49,6 +49,7 @@
 #include <pango/pango-markup.h>
 #include <pango/pango-renderer.h>
 #include <pango/pango-script.h>
+#include <pango/pango-simple-layout.h>
 #include <pango/pango-tabs.h>
 #include <pango/pango-types.h>
 #include <pango/pango-utils.h>


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