summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2007-01-16 09:52:02 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2007-01-16 09:52:02 +0000
commit56e7902a63f2036ea46a386c9d80827d6420f143 (patch)
tree6363106a16cc800436c945d09d88bbad951b5997 /pango/pango-attributes.c
parent7a102793913cb7a1a0eefbbfc9d5c0d04c9eb868 (diff)
downloadpango-56e7902a63f2036ea46a386c9d80827d6420f143.tar.gz
New attribute types PANGO_ATTR_GRAVITY and PANGO_ATTR_GRAVITY_HINT. New
2007-01-16 Behdad Esfahbod <behdad@gnome.org> * pango/pango-attributes.h: * pango/pango-attributes.c: New attribute types PANGO_ATTR_GRAVITY and PANGO_ATTR_GRAVITY_HINT. New public functions: pango_attr_gravity_new() pango_attr_gravity_hint_new() * pango/pango-context.c (update_attr_iterator), (itemize_state_init), (itemize_state_add_character), (get_shaper_and_font), (itemize_state_update_for_new_run): Handle gravity and gravity_hint attributes. * pango/pango-utils.h: * pango/pango-utils.c: New public function: pango_parse_enum() * pango/pango-markup.c (span_parse_func): Parse gravity and gravity_hint attributes for <span>. Optimize a bit. * pango/pango-markup.c (parse_absolute_size), (attr_strcmp), (span_parse_int), (span_parse_boolean), (span_parse_color), (span_parse_enum), (span_parse_func): Use pango_scan_int(), pango_color_parse(), and pango_parse_enum(). Also, ignore '-' and '_' differences when matching attribute names for <span>. * examples/renderdemo.c (parse_enum), (parse_ellipsis), (parse_gravity), (parse_gravity_hint), (parse_hinting), (parse_wrap): Use a generic parse_enum() that uses pango_parse_enum(). * modules/basic/basic-fc.c (basic_engine_shape): * pango/pangofc-fontmap.c (pango_fc_make_pattern): Use PANGO_GRAVITY_IS_VERTICAL(). * pango/pango.def: * docs/pango-sections.txt: * docs/tmpl/text-attributes.sgml: * docs/tmpl/utils.sgml: Update. svn path=/trunk/; revision=2145
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r--pango/pango-attributes.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 7f997461..ea46dd6a 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -968,6 +968,61 @@ pango_attr_shape_new (const PangoRectangle *ink_rect,
NULL, NULL, NULL);
}
+/**
+ * pango_attr_gravity_new:
+ * @gravity: the gravity value; should not be %PANGO_GRAVITY_AUTO.
+ *
+ * Create a new gravity attribute.
+ *
+ * Return value: the newly allocated #PangoAttribute, which should be
+ * freed with pango_attribute_destroy().
+ *
+ * Since: 1.16
+ **/
+PangoAttribute *
+pango_attr_gravity_new (PangoGravity gravity)
+{
+ static const PangoAttrClass klass = {
+ PANGO_ATTR_GRAVITY,
+ pango_attr_int_copy,
+ pango_attr_int_destroy,
+ pango_attr_int_equal
+ };
+
+ g_return_val_if_fail (gravity != PANGO_GRAVITY_AUTO, NULL);
+
+ return pango_attr_int_new (&klass, (int)gravity);
+}
+
+/**
+ * pango_attr_gravity_hint_new:
+ * @hint: the gravity hint value.
+ *
+ * Create a new gravity hint attribute.
+ *
+ * Return value: the newly allocated #PangoAttribute, which should be
+ * freed with pango_attribute_destroy().
+ *
+ * Since: 1.16
+ **/
+PangoAttribute *
+pango_attr_gravity_hint_new (PangoGravityHint hint)
+{
+ static const PangoAttrClass klass = {
+ PANGO_ATTR_GRAVITY_HINT,
+ pango_attr_int_copy,
+ pango_attr_int_destroy,
+ pango_attr_int_equal
+ };
+
+ return pango_attr_int_new (&klass, (int)hint);
+}
+
+
+/*
+ * Attribute List
+ */
+
GType
pango_attr_list_get_type (void)
{