diff options
author | Owen Taylor <otaylor@redhat.com> | 2001-09-18 20:05:20 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2001-09-18 20:05:20 +0000 |
commit | a49e070d24242c0297e6325587c4bc135e13e26c (patch) | |
tree | 0510d066cc185e9d0b1b736736da5266d259878e /pango/pango-attributes.c | |
parent | 39f3626e34e0522e0bdec591f6c0334307d39625 (diff) | |
download | pango-a49e070d24242c0297e6325587c4bc135e13e26c.tar.gz |
Up to 0.19.
Tue Sep 18 15:47:08 2001 Owen Taylor <otaylor@redhat.com>
* configure.in (PANGO_MINOR_VERSION): Up to 0.19.
* pango/pango-font.h pango/pango-fontmap.[ch] pango/fonts.c
pango/pangoxft-fontmap.c pango/pangoft-fontmap.c pango/pango-context.[ch]
pango/pangox-fontmap.c: Add new PangoFontFace and PangoFontFamily
object types, and change the font listing API to list faces and
families, instead of face names and font descriptions.
* pango/pango-font.h pango/fonts.c: Make PangoFontDescription
an opaque heap-allocated structure, add accessors and
convenience functions.
* pango/pango-font.h pango/pango-private.h: Make PangoFontMetrics
heap allocated, protect the structure definition with
#ifdef PANGO_ENABLE_BACKEND, and add getters for the fields.
* pango/pango-attributes.[ch] ( pango_attr_iterator_get_font):
instead of providing a base font description and one to fill
in, provide a single font description to modify based on
the attributes.
* pango/pango-attributes.[ch]: Fix PangoAttrFontDesc to have
a PangoFontDescription by reference, not by value.
* pango/pango-utils.[ch]: make pango_parse_style() and friends
take pointers to individual enumerations instead of to a
PangoFontDescription structure.
* pango/*.c: Fix for the PangoFontDescription and PangoFontMetrics
changes.
* pango/pango-{break,engine,indic,ot,xft}.h pango/Makefile.am
pango/opentype/Makefile.am: Protect portions with
PANGO_ENABLE_ENGINE to shrink the public API.
* modules/*/Makefile.am: -DPANGO_ENABLE_ENGINE.
* pango/{pangox.h,pangox-private.h} modules/basic/basic-x.c: Move
pango_x_font_get_unknown_glyph() into public header since it is
used from modules.
* pango/pango-{context,font,fontmap,modules.utils}.h pango/Makefile.am:
Protect portions with PANGO_ENABLE_BACKEND to shrink the public API.
* pango/*.h: Use G_BEGIN/END_DECLS
* examples/viewer-qt.[cc,h]: Fix for changes to font listing API,
PangoFontDescription.
* pango/pango-indic.h modules/indic/*: Since we install this
header fix it up to Pango conventions, namespece
ZERO_WIDTH_JOINER, ZERO_WIDTH_NON_JOINER.
* docs/pango-sections.txt: Updated.
Diffstat (limited to 'pango/pango-attributes.c')
-rw-r--r-- | pango/pango-attributes.c | 122 |
1 files changed, 42 insertions, 80 deletions
diff --git a/pango/pango-attributes.c b/pango/pango-attributes.c index 9519c01a..6d6fbf1c 100644 --- a/pango/pango-attributes.c +++ b/pango/pango-attributes.c @@ -505,7 +505,7 @@ pango_attr_font_desc_copy (const PangoAttribute *attr) { const PangoAttrFontDesc *desc_attr = (const PangoAttrFontDesc *)attr; - return pango_attr_font_desc_new (&desc_attr->desc); + return pango_attr_font_desc_new (desc_attr->desc); } static void @@ -513,7 +513,7 @@ pango_attr_font_desc_destroy (PangoAttribute *attr) { PangoAttrFontDesc *desc_attr = (PangoAttrFontDesc *)attr; - g_free (desc_attr->desc.family_name); + pango_font_description_free (desc_attr->desc); g_free (attr); } @@ -524,7 +524,7 @@ pango_attr_font_desc_equal (const PangoAttribute *attr1, const PangoAttrFontDesc *desc_attr1 = (const PangoAttrFontDesc *)attr1; const PangoAttrFontDesc *desc_attr2 = (const PangoAttrFontDesc *)attr2; - return pango_font_description_equal (&desc_attr1->desc, &desc_attr2->desc); + return pango_font_description_equal (desc_attr1->desc, desc_attr2->desc); } /** @@ -549,8 +549,7 @@ pango_attr_font_desc_new (const PangoFontDescription *desc) PangoAttrFontDesc *result = g_new (PangoAttrFontDesc, 1); result->attr.klass = &klass; - result->desc = *desc; - result->desc.family_name = g_strdup (desc->family_name); + result->desc = pango_font_description_copy (desc); return (PangoAttribute *)result; } @@ -1363,15 +1362,13 @@ pango_attr_iterator_get (PangoAttrIterator *iterator, /** * pango_attr_iterator_get_font: * @iterator: a #PangoAttrIterator - * @base: the default values to use for fields not currently overridden. - * @current: a #PangoFontDescription to fill in with the current values. This - * #PangoFontDescription structure cannot be freed with - * pango_font_description_free. The @family member of this structure - * will be filled in with a string that is either shared with - * an attribute in the #PangoAttrList associated with the structure, - * or with @base. If you want to save this value, you should - * allocate it on the stack and then use pango_font_description_copy(). - * @language: if non-%NULl, location to store language tag for item, or %NULL + * @desc: a #PangoFontDescription to fill in with the current values. + * The family name in this structure will be set using + * pango_font_description_set_family_static using values from + * an attribute in the #PangoAttrList associated with the iterator, + * so if you plan to keep it around, you must call: + * pango_font_description_set_family (desc, pango_font_description_get_family (desc)). + * @language: if non-%NULL, location to store language tag for item, or %NULL * if non is found. * @extra_attrs: if non-%NULL, location in which to store a list of non-font * attributes at the the current position; only the highest priority @@ -1383,28 +1380,19 @@ pango_attr_iterator_get (PangoAttrIterator *iterator, **/ void pango_attr_iterator_get_font (PangoAttrIterator *iterator, - PangoFontDescription *base, - PangoFontDescription *current, + PangoFontDescription *desc, PangoLanguage **language, GSList **extra_attrs) { GList *tmp_list1; GSList *tmp_list2; - gboolean have_family = FALSE; - gboolean have_style = FALSE; - gboolean have_variant = FALSE; - gboolean have_weight = FALSE; - gboolean have_stretch = FALSE; - gboolean have_size = FALSE; + PangoFontMask mask = 0; gboolean have_language = FALSE; g_return_if_fail (iterator != NULL); - g_return_if_fail (base != NULL); - g_return_if_fail (current != NULL); + g_return_if_fail (desc != NULL); - *current = *base; - if (language) *language = NULL; @@ -1421,88 +1409,62 @@ pango_attr_iterator_get_font (PangoAttrIterator *iterator, { case PANGO_ATTR_FONT_DESC: { - if (!have_family) - { - have_family = TRUE; - current->family_name = ((PangoAttrFontDesc *)attr)->desc.family_name; - } - if (!have_style) - { - have_style = TRUE; - current->style = ((PangoAttrFontDesc *)attr)->desc.style; - } - if (!have_variant) - { - have_variant = TRUE; - current->variant = ((PangoAttrFontDesc *)attr)->desc.variant; - } - if (!have_weight) - { - have_weight = TRUE; - current->weight = ((PangoAttrFontDesc *)attr)->desc.weight; - } - if (!have_stretch) - { - have_stretch = TRUE; - current->stretch = ((PangoAttrFontDesc *)attr)->desc.stretch; - } - if (!have_size) - { - have_size = TRUE; - current->size = ((PangoAttrFontDesc *)attr)->desc.size; - } + PangoFontMask new_mask = pango_font_description_get_set_fields (((PangoAttrFontDesc *)attr)->desc) & ~mask; + pango_font_description_unset_fields (desc, new_mask); + pango_font_description_merge_static (desc, ((PangoAttrFontDesc *)attr)->desc, FALSE); + + break; } - break; - case PANGO_ATTR_FAMILY: - if (!have_family) + if (!(mask & PANGO_ATTR_FAMILY)) { - have_family = TRUE; - current->family_name = ((PangoAttrString *)attr)->value; + mask |= PANGO_ATTR_FAMILY; + pango_font_description_set_family (desc, ((PangoAttrString *)attr)->value); } break; case PANGO_ATTR_STYLE: - if (!have_style) + if (!(mask & PANGO_ATTR_STYLE)) { - have_style = TRUE; - current->style = ((PangoAttrInt *)attr)->value; + mask |= PANGO_ATTR_STYLE; + pango_font_description_set_style (desc, ((PangoAttrInt *)attr)->value); } break; case PANGO_ATTR_VARIANT: - if (!have_variant) + if (!(mask & PANGO_ATTR_VARIANT)) { - have_variant = TRUE; - current->variant = ((PangoAttrInt *)attr)->value; + mask |= PANGO_ATTR_VARIANT; + pango_font_description_set_variant (desc, ((PangoAttrInt *)attr)->value); } break; case PANGO_ATTR_WEIGHT: - if (!have_weight) + if (!(mask & PANGO_ATTR_WEIGHT)) { - have_weight = TRUE; - current->weight = ((PangoAttrInt *)attr)->value; + mask |= PANGO_ATTR_WEIGHT; + pango_font_description_set_weight (desc, ((PangoAttrInt *)attr)->value); } break; case PANGO_ATTR_STRETCH: - if (!have_stretch) + if (!(mask & PANGO_ATTR_STRETCH)) { - have_stretch = TRUE; - current->stretch = ((PangoAttrInt *)attr)->value; + mask |= PANGO_ATTR_STRETCH; + pango_font_description_set_stretch (desc, ((PangoAttrInt *)attr)->value); } break; case PANGO_ATTR_SIZE: - if (!have_size) + if (!(mask & PANGO_ATTR_SIZE)) { - have_size = TRUE; - current->size = ((PangoAttrInt *)attr)->value; + mask |= PANGO_ATTR_SIZE; + pango_font_description_set_size (desc, ((PangoAttrInt *)attr)->value); } break; case PANGO_ATTR_SCALE: - if (!have_size) + if (!(mask & PANGO_ATTR_SIZE)) { - have_size = TRUE; - current->size = ((PangoAttrFloat *)attr)->value * base->size; + mask |= PANGO_ATTR_SIZE; + pango_font_description_set_size (desc, + ((PangoAttrFloat *)attr)->value * pango_font_description_get_size (desc)); } - break; + break; case PANGO_ATTR_LANGUAGE: if (language) { |