[pango/visible-things: 2/12] Add attributes for visible spaces, ignorables and LS



commit 02e6675a4411edbb7b7454cfc370aed9edde0cae
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jul 13 15:49:25 2019 -0400

    Add attributes for visible spaces, ignorables and LS

 docs/pango-sections.txt  |  3 ++
 pango/pango-attributes.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++++
 pango/pango-attributes.h | 14 ++++++++-
 3 files changed, 95 insertions(+), 1 deletion(-)
---
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 9d08d0b2..d794113c 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -413,6 +413,9 @@ pango_color_parse
 pango_color_copy
 pango_color_free
 pango_color_to_string
+pango_attr_show_ignorables_new
+pango_attr_show_space_new
+pango_attr_show_line_separators_new
 <SUBSECTION>
 PangoAttrList
 PANGO_TYPE_ATTR_LIST
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 54b13795..a9500879 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -1179,6 +1179,85 @@ pango_attr_background_alpha_new (guint16 alpha)
   return pango_attr_int_new (&klass, (int)alpha);
 }
 
+/**
+ * pango_attr_show_ignorables_new:
+ * @show: %TRUE to render ignorable characters
+ *
+ * Create a new show ignorables attribute.
+ *
+ * If @show is %TRUE, ignorable characters will be rendered
+ * visibly.
+ *
+ * Return value: (transfer full): the newly allocated #PangoAttribute,
+ *               which should be freed with pango_attribute_destroy().
+ *
+ * Since: 1.44
+ **/
+PangoAttribute *
+pango_attr_show_ignorables_new (gboolean show)
+{
+  static const PangoAttrClass klass = {
+    PANGO_ATTR_SHOW_IGNORABLES,
+    pango_attr_int_copy,
+    pango_attr_int_destroy,
+    pango_attr_int_equal,
+  };
+
+  return pango_attr_int_new (&klass, (int)show);
+}
+
+/**
+ * pango_attr_show_space_new:
+ * @show: %TRUE if we should render spaces
+ *
+ * Create a new show space attribute.
+ *
+ * If @show is %TRUE, spaces will be rendered visibly.
+ *
+ * Return value: (transfer full): the newly allocated #PangoAttribute,
+ *               which should be freed with pango_attribute_destroy().
+ *
+ * Since: 1.44
+ **/
+PangoAttribute *
+pango_attr_show_space_new (gboolean show)
+{
+  static const PangoAttrClass klass = {
+    PANGO_ATTR_SHOW_SPACE,
+    pango_attr_int_copy,
+    pango_attr_int_destroy,
+    pango_attr_int_equal,
+  };
+
+  return pango_attr_int_new (&klass, (int)show);
+}
+
+/**
+ * pango_attr_show_line_separators_new:
+ * @show: %TRUE if we should render line separators
+ *
+ * Create a new show line separators attribute.
+ *
+ * If @show is %TRUE, line separtors will be rendered visibly.
+ *
+ * Return value: (transfer full): the newly allocated #PangoAttribute,
+ *               which should be freed with pango_attribute_destroy().
+ *
+ * Since: 1.44
+ **/
+PangoAttribute *
+pango_attr_show_line_separators_new (gboolean show)
+{
+  static const PangoAttrClass klass = {
+    PANGO_ATTR_SHOW_LINE_SEPARATORS,
+    pango_attr_int_copy,
+    pango_attr_int_destroy,
+    pango_attr_int_equal,
+  };
+
+  return pango_attr_int_new (&klass, (int)show);
+}
+
 /*
  * Attribute List
  */
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index cff495b2..1ba9eca5 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -147,6 +147,9 @@ typedef struct _PangoAttrIterator PangoAttrIterator;
  * @PANGO_ATTR_FONT_FEATURES: OpenType font features (#PangoAttrString). Since 1.38
  * @PANGO_ATTR_FOREGROUND_ALPHA: foreground alpha (#PangoAttrInt). Since 1.38
  * @PANGO_ATTR_BACKGROUND_ALPHA: background alpha (#PangoAttrInt). Since 1.38
+ * @PANGO_ATTR_SHOW_IGNORABLES: whether to render ignorable charactrs visibly (#PangoAttrInt). Since 1.44
+ * @PANGO_ATTR_SHOW_SPACE: whether to render space visibly (#PangoAttrInt). Since 1.44
+ * @PANGO_ATTR_SHOW_LINE_SEPARATORS: whether to render line separators visibly (#PangoAttrInt). Since 1.44
  *
  * The #PangoAttrType
  * distinguishes between different types of attributes. Along with the
@@ -182,7 +185,10 @@ typedef enum
   PANGO_ATTR_GRAVITY_HINT,     /* PangoAttrInt */
   PANGO_ATTR_FONT_FEATURES,    /* PangoAttrString */
   PANGO_ATTR_FOREGROUND_ALPHA, /* PangoAttrInt */
-  PANGO_ATTR_BACKGROUND_ALPHA  /* PangoAttrInt */
+  PANGO_ATTR_BACKGROUND_ALPHA, /* PangoAttrInt */
+  PANGO_ATTR_SHOW_IGNORABLES,   /* PangoAttrInt */
+  PANGO_ATTR_SHOW_SPACE,        /* PangoAttrInt */
+  PANGO_ATTR_SHOW_LINE_SEPARATORS, /* PangoAttrInt */
 } PangoAttrType;
 
 /**
@@ -522,6 +528,12 @@ PANGO_AVAILABLE_IN_1_38
 PangoAttribute *pango_attr_foreground_alpha_new (guint16 alpha);
 PANGO_AVAILABLE_IN_1_38
 PangoAttribute *pango_attr_background_alpha_new (guint16 alpha);
+PANGO_AVAILABLE_IN_1_44
+PangoAttribute *pango_attr_show_ignorables_new  (gboolean show);
+PANGO_AVAILABLE_IN_1_44
+PangoAttribute *pango_attr_show_space_new       (gboolean show);
+PANGO_AVAILABLE_IN_1_44
+PangoAttribute *pango_attr_show_line_separators_new (gboolean show);
 
 PANGO_AVAILABLE_IN_ALL
 GType              pango_attr_list_get_type      (void) G_GNUC_CONST;


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