diff options
Diffstat (limited to 'pango/pangocairo-coretextfontmap.c')
-rw-r--r-- | pango/pangocairo-coretextfontmap.c | 72 |
1 files changed, 66 insertions, 6 deletions
diff --git a/pango/pangocairo-coretextfontmap.c b/pango/pangocairo-coretextfontmap.c index e05a1d40..107c8289 100644 --- a/pango/pangocairo-coretextfontmap.c +++ b/pango/pangocairo-coretextfontmap.c @@ -44,7 +44,7 @@ pango_cairo_core_text_font_map_set_resolution (PangoCairoFontMap *cfontmap, } static double -pango_cairo_core_text_font_map_get_resolution (PangoCairoFontMap *cfontmap) +pango_cairo_core_text_font_map_get_resolution_cairo (PangoCairoFontMap *cfontmap) { PangoCairoCoreTextFontMap *cafontmap = PANGO_CAIRO_CORE_TEXT_FONT_MAP (cfontmap); @@ -64,7 +64,7 @@ static void cairo_font_map_iface_init (PangoCairoFontMapIface *iface) { iface->set_resolution = pango_cairo_core_text_font_map_set_resolution; - iface->get_resolution = pango_cairo_core_text_font_map_get_resolution; + iface->get_resolution = pango_cairo_core_text_font_map_get_resolution_cairo; iface->get_font_type = pango_cairo_core_text_font_map_get_font_type; } @@ -74,13 +74,11 @@ G_DEFINE_TYPE_WITH_CODE (PangoCairoCoreTextFontMap, pango_cairo_core_text_font_m static PangoCoreTextFont * pango_cairo_core_text_font_map_create_font (PangoCoreTextFontMap *fontmap, - PangoContext *context, - PangoCoreTextFace *face, - const PangoFontDescription *desc) + PangoCoreTextFontKey *key) { return _pango_cairo_core_text_font_new (PANGO_CAIRO_CORE_TEXT_FONT_MAP (fontmap), - context, face, desc); + key); } static void @@ -89,6 +87,62 @@ pango_cairo_core_text_font_map_finalize (GObject *object) G_OBJECT_CLASS (pango_cairo_core_text_font_map_parent_class)->finalize (object); } +static double +pango_cairo_core_text_font_map_get_resolution_core_text (PangoCoreTextFontMap *ctfontmap, + PangoContext *context) +{ + PangoCairoCoreTextFontMap *cafontmap = PANGO_CAIRO_CORE_TEXT_FONT_MAP (ctfontmap); + double dpi; + + if (context) + { + dpi = pango_cairo_context_get_resolution (context); + + if (dpi <= 0) + dpi = cafontmap->dpi; + } + else + dpi = cafontmap->dpi; + + return dpi; +} + +static gconstpointer +pango_cairo_core_text_font_map_context_key_get (PangoCoreTextFontMap *fontmap G_GNUC_UNUSED, + PangoContext *context) +{ + return _pango_cairo_context_get_merged_font_options (context); +} + +static gpointer +pango_cairo_core_text_font_map_context_key_copy (PangoCoreTextFontMap *fontmap G_GNUC_UNUSED, + gconstpointer key) +{ + return cairo_font_options_copy (key); +} + +static void +pango_cairo_core_text_font_map_context_key_free (PangoCoreTextFontMap *fontmap G_GNUC_UNUSED, + gpointer key) +{ + cairo_font_options_destroy (key); +} + +static guint32 +pango_cairo_core_text_font_map_context_key_hash (PangoCoreTextFontMap *fontmap G_GNUC_UNUSED, + gconstpointer key) +{ + return (guint32)cairo_font_options_hash (key); +} + +static gboolean +pango_cairo_core_text_font_map_context_key_equal (PangoCoreTextFontMap *fontmap G_GNUC_UNUSED, + gconstpointer key_a, + gconstpointer key_b) +{ + return cairo_font_options_equal (key_a, key_b); +} + static void pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class) { @@ -97,7 +151,13 @@ pango_cairo_core_text_font_map_class_init (PangoCairoCoreTextFontMapClass *class object_class->finalize = pango_cairo_core_text_font_map_finalize; + ctfontmapclass->get_resolution = pango_cairo_core_text_font_map_get_resolution_core_text; ctfontmapclass->create_font = pango_cairo_core_text_font_map_create_font; + ctfontmapclass->context_key_get = pango_cairo_core_text_font_map_context_key_get; + ctfontmapclass->context_key_copy = pango_cairo_core_text_font_map_context_key_copy; + ctfontmapclass->context_key_free = pango_cairo_core_text_font_map_context_key_free; + ctfontmapclass->context_key_hash = pango_cairo_core_text_font_map_context_key_hash; + ctfontmapclass->context_key_equal = pango_cairo_core_text_font_map_context_key_equal; } static void |