summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-10-24 05:43:57 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-10-24 05:43:57 +0000
commit4c0ae27426d686e6bd9365b4d0f02d444e6cf667 (patch)
tree2852ed499c62068218f932306faa27c4fb36a9cc
parentb178da14dabd63937c3867f6d5cbb29f7a31d69f (diff)
downloadpango-4c0ae27426d686e6bd9365b4d0f02d444e6cf667.tar.gz
Bug 469641 – Initialize attribute start/end to [0..MAXUINT]
2007-10-24 Behdad Esfahbod <behdad@gnome.org> Bug 469641 – Initialize attribute start/end to [0..MAXUINT] * pango/pango-attributes.h: * pango/pango-attributes.c: New public API: pango_attribute_init() * pango/pango-attributes.c: (pango_attr_string_new), (pango_attr_language_new), (pango_attr_color_new), (pango_attr_int_new), (pango_attr_float_new), (pango_attr_size_new_internal), (pango_attr_font_desc_new), (pango_attr_shape_new_with_data): Initialize attributes using pango_attribute_init(). * pango/pango.def: * docs/pango-docs.sgml: * docs/pango-sections.txt: * docs/tmpl/text-attributes.sgml: Update. svn path=/trunk/; revision=2458
-rw-r--r--ChangeLog23
-rw-r--r--docs/pango-docs.sgml3
-rw-r--r--docs/pango-sections.txt1
-rw-r--r--docs/tmpl/glyphs.sgml1
-rw-r--r--docs/tmpl/text-attributes.sgml12
-rw-r--r--pango/pango-attributes.c43
-rw-r--r--pango/pango-attributes.h14
-rw-r--r--pango/pango.def1
8 files changed, 79 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index c4f058db..ce72a53d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
2007-10-24 Behdad Esfahbod <behdad@gnome.org>
+ Bug 469641 – Initialize attribute start/end to [0..MAXUINT]
+
+ * pango/pango-attributes.h:
+ * pango/pango-attributes.c:
+ New public API:
+
+ pango_attribute_init()
+
+ * pango/pango-attributes.c:
+ (pango_attr_string_new), (pango_attr_language_new),
+ (pango_attr_color_new), (pango_attr_int_new),
+ (pango_attr_float_new), (pango_attr_size_new_internal),
+ (pango_attr_font_desc_new), (pango_attr_shape_new_with_data):
+ Initialize attributes using pango_attribute_init().
+
+ * pango/pango.def:
+ * docs/pango-docs.sgml:
+ * docs/pango-sections.txt:
+ * docs/tmpl/text-attributes.sgml:
+ Update.
+
+2007-10-24 Behdad Esfahbod <behdad@gnome.org>
+
Bug 471577 – GBoxed GType for PangoGlyphItem
* pango/pango-glyph-item.h:
diff --git a/docs/pango-docs.sgml b/docs/pango-docs.sgml
index 3c82eeec..3c4cc567 100644
--- a/docs/pango-docs.sgml
+++ b/docs/pango-docs.sgml
@@ -121,4 +121,7 @@
<index id="index-1.18" role="1.18">
<title>Index of new symbols in 1.18</title>
</index>
+ <index id="index-1.20" role="1.20">
+ <title>Index of new symbols in 1.20</title>
+ </index>
</book>
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 4ff5160a..df043d75 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -325,6 +325,7 @@ PangoAttrShape
PangoAttrSize
pango_parse_markup
pango_attr_type_register
+pango_attribute_init
pango_attribute_copy
pango_attribute_equal
pango_attribute_destroy
diff --git a/docs/tmpl/glyphs.sgml b/docs/tmpl/glyphs.sgml
index edf06acb..46a2b2f0 100644
--- a/docs/tmpl/glyphs.sgml
+++ b/docs/tmpl/glyphs.sgml
@@ -517,6 +517,7 @@ The #GObject type for #PangoGlyphString.
The #GObject type for #PangoGlyphItem.
</para>
+@Since: 1.20
<!-- ##### FUNCTION pango_glyph_item_split ##### -->
diff --git a/docs/tmpl/text-attributes.sgml b/docs/tmpl/text-attributes.sgml
index 79f9ac94..f2f66fdc 100644
--- a/docs/tmpl/text-attributes.sgml
+++ b/docs/tmpl/text-attributes.sgml
@@ -81,7 +81,8 @@ The #PangoAttribute structure represents the common portions of all
attributes. Particular types of attributes include this structure
as their initial portion. The common portion of the attribute holds
the range to which the value in the type-specific part of the attribute
-applies.
+applies and should be initialized using pango_attribute_init().
+By default an attribute will have an all-inclusive range of [0,%G_MAXUINT].
</para>
@klass: the class structure holding information about the type of the attribute
@@ -194,6 +195,15 @@ set font size.
@Returns:
+<!-- ##### FUNCTION pango_attribute_init ##### -->
+<para>
+
+</para>
+
+@attr:
+@klass:
+
+
<!-- ##### FUNCTION pango_attribute_copy ##### -->
<para>
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 1b864678..0c98539d 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -71,6 +71,29 @@ pango_attr_type_register (const gchar *name)
}
/**
+ * pango_attribute_init:
+ * @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
+ * to the entire text by default.
+ *
+ * Since: 1.20
+ **/
+void
+pango_attribute_init (PangoAttribute *attr,
+ const PangoAttrClass *klass)
+{
+ g_return_if_fail (attr != NULL);
+ g_return_if_fail (klass != NULL);
+
+ attr->klass = klass;
+ attr->start_index = 0;
+ attr->end_index = G_MAXUINT;
+}
+
+/**
* pango_attribute_copy:
* @attr: a #PangoAttribute
*
@@ -158,8 +181,7 @@ pango_attr_string_new (const PangoAttrClass *klass,
const char *str)
{
PangoAttrString *result = g_slice_new (PangoAttrString);
-
- result->attr.klass = klass;
+ pango_attribute_init (&result->attr, klass);
result->value = g_strdup (str);
return (PangoAttribute *)result;
@@ -231,11 +253,8 @@ pango_attr_language_new (PangoLanguage *language)
pango_attr_language_equal
};
- g_return_val_if_fail (language != NULL, NULL);
-
result = g_slice_new (PangoAttrLanguage);
-
- result->attr.klass = &klass;
+ pango_attribute_init (&result->attr, &klass);
result->value = language;
return (PangoAttribute *)result;
@@ -279,7 +298,7 @@ pango_attr_color_new (const PangoAttrClass *klass,
guint16 blue)
{
PangoAttrColor *result = g_slice_new (PangoAttrColor);
- result->attr.klass = klass;
+ pango_attribute_init (&result->attr, &klass);
result->color.red = red;
result->color.green = green;
result->color.blue = blue;
@@ -370,7 +389,7 @@ pango_attr_int_new (const PangoAttrClass *klass,
int value)
{
PangoAttrInt *result = g_slice_new (PangoAttrInt);
- result->attr.klass = klass;
+ pango_attribute_init (&result->attr, &klass);
result->value = value;
return (PangoAttribute *)result;
@@ -407,7 +426,7 @@ pango_attr_float_new (const PangoAttrClass *klass,
double value)
{
PangoAttrFloat *result = g_slice_new (PangoAttrFloat);
- result->attr.klass = klass;
+ pango_attribute_init (&result->attr, klass);
result->value = value;
return (PangoAttribute *)result;
@@ -462,7 +481,7 @@ pango_attr_size_new_internal (int size,
};
result = g_slice_new (PangoAttrSize);
- result->attr.klass = absolute ? &absolute_klass : &klass;
+ pango_attribute_init (&result->attr, absolute ? &absolute_klass : &klass);
result->size = size;
result->absolute = absolute;
@@ -640,7 +659,7 @@ pango_attr_font_desc_new (const PangoFontDescription *desc)
};
PangoAttrFontDesc *result = g_slice_new (PangoAttrFontDesc);
- result->attr.klass = &klass;
+ pango_attribute_init (&result->attr, &klass);
result->desc = pango_font_description_copy (desc);
return (PangoAttribute *)result;
@@ -936,7 +955,7 @@ pango_attr_shape_new_with_data (const PangoRectangle *ink_rect,
g_return_val_if_fail (logical_rect != NULL, NULL);
result = g_slice_new (PangoAttrShape);
- result->attr.klass = &klass;
+ pango_attribute_init (&result->attr, &klass);
result->ink_rect = *ink_rect;
result->logical_rect = *logical_rect;
result->data = data;
diff --git a/pango/pango-attributes.h b/pango/pango-attributes.h
index 98ee9868..ad7a0861 100644
--- a/pango/pango-attributes.h
+++ b/pango/pango-attributes.h
@@ -176,12 +176,14 @@ struct _PangoAttrFontDesc
PangoFontDescription *desc;
};
-PangoAttrType pango_attr_type_register (const gchar *name);
-
-PangoAttribute * pango_attribute_copy (const PangoAttribute *attr);
-void pango_attribute_destroy (PangoAttribute *attr);
-gboolean pango_attribute_equal (const PangoAttribute *attr1,
- const PangoAttribute *attr2) G_GNUC_PURE;
+PangoAttrType pango_attr_type_register (const gchar *name);
+
+void pango_attribute_init (PangoAttribute *attr,
+ const PangoAttrClass *klass);
+PangoAttribute * pango_attribute_copy (const PangoAttribute *attr);
+void pango_attribute_destroy (PangoAttribute *attr);
+gboolean pango_attribute_equal (const PangoAttribute *attr1,
+ const PangoAttribute *attr2) G_GNUC_PURE;
PangoAttribute *pango_attr_language_new (PangoLanguage *language);
PangoAttribute *pango_attr_family_new (const char *family);
diff --git a/pango/pango.def b/pango/pango.def
index 3f822f6c..06ff66d7 100644
--- a/pango/pango.def
+++ b/pango/pango.def
@@ -43,6 +43,7 @@ EXPORTS
pango_attr_underline_new
pango_attr_variant_new
pango_attr_weight_new
+ pango_attribute_init
pango_attribute_copy
pango_attribute_destroy
pango_attribute_equal