diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-03-10 08:08:19 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-03-13 18:03:42 -0400 |
commit | 9305b9a9995e84ace3818a90346820ef8c47a3ce (patch) | |
tree | 8713cdaf24e1eb5c7b380c005cce45a719a222e5 /pango/pangofc-font.c | |
parent | ed941ddf131cbdd8f5e1e1efabd6e92c37010735 (diff) | |
download | pango-9305b9a9995e84ace3818a90346820ef8c47a3ce.tar.gz |
[pangofc] Add a "fontmap" property to PangoFcFont
Gecko uses its own PangoFcFontMap subclass with its own PangoFontSet.
Previously we were setting font->fontmap in our own private
PangoFcFontSet. Now it's up to the PangoFcFont subclass to set it
when creating the new font object.
Also adds the following backend-public symbol:
pango_fc_font_map_find_decoder()
Diffstat (limited to 'pango/pangofc-font.c')
-rw-r--r-- | pango/pangofc-font.c | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index 133a4df4..9c5b9ed1 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -34,7 +34,8 @@ enum { PROP_0, - PROP_PATTERN + PROP_PATTERN, + PROP_FONTMAP }; typedef struct _GUnicharToGlyphCacheEntry GUnicharToGlyphCacheEntry; @@ -121,6 +122,13 @@ pango_fc_font_class_init (PangoFcFontClass *class) "The fontconfig pattern for this font", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, PROP_FONTMAP, + g_param_spec_object ("fontmap", + "Font Map", + "The PangoFc font map this font is associated with (Since: 1.26)", + PANGO_TYPE_FC_FONT_MAP, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); g_type_class_add_private (object_class, sizeof (PangoFcFontPrivate)); } @@ -203,11 +211,12 @@ pango_fc_font_set_property (GObject *object, const GValue *value, GParamSpec *pspec) { + PangoFcFont *fcfont = PANGO_FC_FONT (object); + switch (prop_id) { case PROP_PATTERN: { - PangoFcFont *fcfont = PANGO_FC_FONT (object); FcPattern *pattern = g_value_get_pointer (value); g_return_if_fail (pattern != NULL); @@ -219,11 +228,30 @@ pango_fc_font_set_property (GObject *object, fcfont->is_hinted = pattern_is_hinted (pattern); fcfont->is_transformed = pattern_is_transformed (pattern); } - break; + goto set_decoder; + + case PROP_FONTMAP: + { + PangoFcFontMap *fcfontmap = PANGO_FC_FONT_MAP (g_value_get_object (value)); + + g_return_if_fail (fcfont->fontmap == NULL); + fcfont->fontmap = (PangoFontMap *) fcfontmap; + if (fcfont->fontmap) + g_object_add_weak_pointer (G_OBJECT (fcfont->fontmap), (gpointer *) (gpointer) &fcfont->fontmap); + } + goto set_decoder; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; + return; } + +set_decoder: + /* set decoder if both pattern and fontmap are set now */ + if (fcfont->font_pattern && fcfont->fontmap) + _pango_fc_font_set_decoder (fcfont, + pango_fc_font_map_find_decoder ((PangoFcFontMap *) fcfont->fontmap, + fcfont->font_pattern)); } static void @@ -240,6 +268,12 @@ pango_fc_font_get_property (GObject *object, g_value_set_pointer (value, fcfont->font_pattern); } break; + case PROP_FONTMAP: + { + PangoFcFont *fcfont = PANGO_FC_FONT (object); + g_value_set_object (value, fcfont->fontmap); + } + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; |