summaryrefslogtreecommitdiff
path: root/pango/pango-attributes.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-01-09 00:12:39 +0000
committerOwen Taylor <otaylor@src.gnome.org>2005-01-09 00:12:39 +0000
commitcc6ac36dd3c7e5ef39b9f21ef77596a159f2100e (patch)
treee1b8ffc1c14d449a41946d22ea5d1c6ddf9115d8 /pango/pango-attributes.c
parent75f4ad29adce645ddb837e662c9d71ccfbf60154 (diff)
downloadpango-cc6ac36dd3c7e5ef39b9f21ef77596a159f2100e.tar.gz
Add checks for Cairo
Sat Jan 8 16:46:37 2005 Owen Taylor <otaylor@redhat.com> * configure.in: Add checks for Cairo * pango/Makefile.am: Add libpangocairo. * pango/pangocairo-font.c pango/pangocairo-fontmap.c pango/pangocairo.h pango/pangocairo-private.h pango/pangocairo-fcfont.c pango/pangocairo-fcfontmap.c pango/pangocairo-fc.h: Start of a Cairo/FreeType backend. * pango/pangofc-fontmap.[ch]: Add a "get_render_key" virtual function to allow subclasses to specialize the details of how caching works. Add a default implementation that's a little more sophisticated than what was there before. * pango/pangoft2-private.h pangofc-font.c pangoft2.c: Move default implementations of has_char(), get_glyph() to the base class. * pango/pangofc-private.h pango/pangoft2-private.h: Move PANGO_UNITS_26_6 and friends to pango/pangofc-private.h. * examples/renderdemo.[ch] examples/pangoft2topgm.c examples/xftview.c: Allow passing in a custom function to transform drawing. * examples/Makefile.am examples/cairoview.c: Add a Cairo/Xlib example program. * examples/cairosimple.c: Simple Cairo example with output to a PNG. * pango/pango-layout.c (pango_layout_line_get_extents): Fix bug where line ink rect was always including 0, 0.
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r--pango/pango-attributes.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c
index 3191c029..edf0d966 100644
--- a/pango/pango-attributes.c
+++ b/pango/pango-attributes.c
@@ -402,8 +402,11 @@ static PangoAttribute *
pango_attr_size_copy (const PangoAttribute *attr)
{
const PangoAttrSize *size_attr = (PangoAttrSize *)attr;
-
- return pango_attr_size_new_internal (size_attr->size, size_attr->absolute);
+
+ if (attr->klass->type == PANGO_ATTR_ABSOLUTE_SIZE)
+ return pango_attr_size_new_absolute (size_attr->size);
+ else
+ return pango_attr_size_new (size_attr->size);
}
static void
@@ -419,8 +422,7 @@ pango_attr_size_equal (const PangoAttribute *attr1,
const PangoAttrSize *size_attr1 = (const PangoAttrSize *)attr1;
const PangoAttrSize *size_attr2 = (const PangoAttrSize *)attr2;
- return (size_attr1->size == size_attr2->size &&
- size_attr1->absolute == size_attr2->absolute);
+ return size_attr1->size == size_attr2->size;
}
static PangoAttribute *
@@ -428,15 +430,22 @@ pango_attr_size_new_internal (int size,
gboolean absolute)
{
PangoAttrSize *result;
+
static const PangoAttrClass klass = {
PANGO_ATTR_SIZE,
pango_attr_size_copy,
pango_attr_size_destroy,
pango_attr_size_equal
};
+ static const PangoAttrClass absolute_klass = {
+ PANGO_ATTR_ABSOLUTE_SIZE,
+ pango_attr_size_copy,
+ pango_attr_size_destroy,
+ pango_attr_size_equal
+ };
result = g_new (PangoAttrSize, 1);
- result->attr.klass = &klass;
+ result->attr.klass = absolute ? &absolute_klass : &klass;
result->size = size;
result->absolute = absolute;
@@ -458,8 +467,8 @@ pango_attr_size_new (int size)
}
/**
- * pango_attr_size_absolute_new:
- * @size: the font size, in #PANGO_SCALE<!-- -->ths of a device units.
+ * pango_attr_size_new_absolute:
+ * @size: the font size, in #PANGO_SCALE<!-- -->ths of a device unit.
*
* Create a new font-size attribute in device units.
*
@@ -1676,10 +1685,14 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator,
if (!(mask & PANGO_FONT_MASK_SIZE))
{
mask |= PANGO_FONT_MASK_SIZE;
- if (((PangoAttrSize *)attr)->absolute)
- pango_font_description_set_absolute_size (desc, ((PangoAttrSize *)attr)->size);
- else
- pango_font_description_set_size (desc, ((PangoAttrSize *)attr)->size);
+ pango_font_description_set_size (desc, ((PangoAttrSize *)attr)->size);
+ }
+ break;
+ case PANGO_ATTR_ABSOLUTE_SIZE:
+ if (!(mask & PANGO_FONT_MASK_SIZE))
+ {
+ mask |= PANGO_FONT_MASK_SIZE;
+ pango_font_description_set_absolute_size (desc, ((PangoAttrSize *)attr)->size);
}
break;
case PANGO_ATTR_SCALE: