summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2009-01-07 23:45:22 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2009-01-07 23:45:22 +0000
commita46d5ae6533e46d3522e0a45c3c9d5ded0ea5394 (patch)
treeaf99c6afa61afe1f8f7bd45eee2301a87d9eb748
parenta457bf39f99b744bc7c0fa8064d0a0d3d1961078 (diff)
downloadpango-a46d5ae6533e46d3522e0a45c3c9d5ded0ea5394.tar.gz
Bug 566941 – Add PANGO_ATTRIBUTE_INDEX_FROM_TEXT_BEGINNING and
2009-01-07 Behdad Esfahbod <behdad@gnome.org> Bug 566941 – Add PANGO_ATTRIBUTE_INDEX_FROM_TEXT_BEGINNING and PANGO_ATTRIBUTE_INDEX_TO_TEXT_END * docs/pango-sections.txt: * docs/tmpl/text-attributes.sgml: * pango/pango-attributes.c (pango_attribute_init): * pango/pango-attributes.h: Add two new public macros: PANGO_ATTRIBUTE_INDEX_FROM_TEXT_BEGINNING PANGO_ATTRIBUTE_INDEX_TO_TEXT_END svn path=/trunk/; revision=2793
-rw-r--r--ChangeLog14
-rw-r--r--docs/pango-sections.txt2
-rw-r--r--docs/tmpl/text-attributes.sgml19
-rw-r--r--pango/pango-attributes.c10
-rw-r--r--pango/pango-attributes.h3
5 files changed, 44 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index c5bd6000..8b81a39f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2009-01-07 Behdad Esfahbod <behdad@gnome.org>
+
+ Bug 566941 – Add PANGO_ATTRIBUTE_INDEX_FROM_TEXT_BEGINNING and
+ PANGO_ATTRIBUTE_INDEX_TO_TEXT_END
+
+ * docs/pango-sections.txt:
+ * docs/tmpl/text-attributes.sgml:
+ * pango/pango-attributes.c (pango_attribute_init):
+ * pango/pango-attributes.h:
+ Add two new public macros:
+
+ PANGO_ATTRIBUTE_INDEX_FROM_TEXT_BEGINNING
+ PANGO_ATTRIBUTE_INDEX_TO_TEXT_END
+
2009-01-06 Behdad Esfahbod <behdad@gnome.org>
Bug 551469 – Fold '@' to '-' when parsing PangoLanguages
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index ec33700d..b4809b50 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -319,6 +319,8 @@ PangoAttrType
PANGO_TYPE_ATTR_TYPE
PangoAttrClass
PangoAttribute
+PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING
+PANGO_ATTR_INDEX_TO_TEXT_END
PangoAttrString
PangoAttrLanguage
PangoAttrColor
diff --git a/docs/tmpl/text-attributes.sgml b/docs/tmpl/text-attributes.sgml
index edf2922d..050fe594 100644
--- a/docs/tmpl/text-attributes.sgml
+++ b/docs/tmpl/text-attributes.sgml
@@ -90,6 +90,25 @@ By default an attribute will have an all-inclusive range of [0,%G_MAXUINT].
@end_index: end index of the range (in bytes). The character at this index
is not included in the range.
+<!-- ##### MACRO PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING ##### -->
+<para>
+This value can be used to set the start_index member of a #PangoAttribute
+such that the attribute covers from the beginning of the text.
+</para>
+
+Since: 1.24
+
+
+<!-- ##### MACRO PANGO_ATTR_INDEX_TO_TEXT_END ##### -->
+<para>
+This value can be used to set the end_index member of a #PangoAttribute
+such that the attribute covers to the end of the text.
+</para>
+
+Since: 1.24
+
+
+
<!-- ##### STRUCT PangoAttrString ##### -->
<para>
The #PangoAttrString structure is used to represent attributes with
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 49cca1e4..2ca8f2c1 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -113,8 +113,10 @@ pango_attr_type_get_name (PangoAttrType type)
* @attr: a #PangoAttribute
* @klass: a #PangoAttributeClass
*
- * Initializes @attr's klass to @klass, it's start_index to zero,
- * and end_index to %G_MAXUINT such that the attribute applies
+ * Initializes @attr's klass to @klass,
+ * it's start_index to %PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING
+ * and end_index to %PANGO_ATTR_INDEX_TO_TEXT_END
+ * such that the attribute applies
* to the entire text by default.
*
* Since: 1.20
@@ -127,8 +129,8 @@ pango_attribute_init (PangoAttribute *attr,
g_return_if_fail (klass != NULL);
attr->klass = klass;
- attr->start_index = 0;
- attr->end_index = G_MAXUINT;
+ attr->start_index = PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING;
+ attr->end_index = PANGO_ATTR_INDEX_TO_TEXT_END;
}
/**
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index d4ce8404..866e35dd 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -101,6 +101,9 @@ typedef enum {
PANGO_UNDERLINE_ERROR
} PangoUnderline;
+#define PANGO_ATTR_INDEX_FROM_TEXT_BEGINNING 0
+#define PANGO_ATTR_INDEX_TO_TEXT_END G_MAXUINT
+
struct _PangoAttribute
{
const PangoAttrClass *klass;