diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-06-24 23:00:58 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-07-04 11:17:21 -0400 |
commit | 778df432eb9bba4441d4c47cdbfbcd385b1e9d42 (patch) | |
tree | 39b66234cc325aafdddcebd76ec888d0cc099aaa /pango/pango-fontmap.c | |
parent | 249ce63ebb3d5666d5559184dd7c2c65e32695c2 (diff) | |
download | pango-778df432eb9bba4441d4c47cdbfbcd385b1e9d42.tar.gz |
Convert to the pango2 prefix
This makes pango 2 not just parallel-installable
with pango 1.x, but parallel-usable in the same
process.
Diffstat (limited to 'pango/pango-fontmap.c')
-rw-r--r-- | pango/pango-fontmap.c | 734 |
1 files changed, 367 insertions, 367 deletions
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c index b76a0ded..bca8fcff 100644 --- a/pango/pango-fontmap.c +++ b/pango/pango-fontmap.c @@ -1,4 +1,4 @@ -/* Pango +/* Pango2 * * Copyright (C) 2021 Matthias Clasen * @@ -57,43 +57,43 @@ /** - * PangoFontMap: + * Pango2FontMap: * - * `PangoFontMap` is the base class for font enumeration. + * `Pango2FontMap` is the base class for font enumeration. * It also handles caching and lookup of faces and fonts. - * To obtain fonts from a `PangoFontMap`, use [method@Pango.FontMap.load_font] - * or [method@Pango.FontMap.load_fontset]. + * To obtain fonts from a `Pango2FontMap`, use [method@Pango2.FontMap.load_font] + * or [method@Pango2.FontMap.load_fontset]. * * Subclasses populate the fontmap using backend-specific APIs * to enumerate the available fonts on the sytem, but it is - * also possible to create an instance of `PangoFontMap` and - * populate it manually using [method@Pango.FontMap.add_file] - * and [method@Pango.FontMap.add_face]. + * also possible to create an instance of `Pango2FontMap` and + * populate it manually using [method@Pango2.FontMap.add_file] + * and [method@Pango2.FontMap.add_face]. * - * Fontmaps can be combined using [method@Pango.FontMap.set_fallback]. + * Fontmaps can be combined using [method@Pango2.FontMap.set_fallback]. * This can be useful to add custom fonts to the default fonts * without making them available to every user of the default * fontmap. * * Note that to be fully functional, a fontmap needs to provide * generic families for monospace and sans-serif. These can - * be added using [method@Pango.FontMap.add_family] and - * [ctor@Pango.GenericFamily.new]. + * be added using [method@Pango2.FontMap.add_family] and + * [ctor@Pango2.GenericFamily.new]. * - * `PangoFontMap` implements the [iface@Gio.ListModel] interface, + * `Pango2FontMap` implements the [iface@Gio.ListModel] interface, * to provide a list of font families. */ /* The central api is load_fontset, which takes a font description - * and language, finds the matching faces, and creates a PangoFontset + * and language, finds the matching faces, and creates a Pango2Fontset * for them. To speed this operation up, the font map maintains a * cache of fontsets (in the form of a GQueue) and has a hash table * for looking up existing fontsets. * - * The PangoFontsetCached object is the fontset subclass that is used + * The Pango2FontsetCached object is the fontset subclass that is used * here, and it contains the necessary data for the cashing and hashing. - * PangoFontsetCached also caches the character-to-font mapping that is + * Pango2FontsetCached also caches the character-to-font mapping that is * used when itemizing text. */ @@ -101,15 +101,15 @@ /* {{{ GListModel implementation */ static GType -pango_font_map_get_item_type (GListModel *list) +pango2_font_map_get_item_type (GListModel *list) { - return PANGO_TYPE_FONT_FAMILY; + return PANGO2_TYPE_FONT_FAMILY; } static guint -pango_font_map_get_n_items (GListModel *list) +pango2_font_map_get_n_items (GListModel *list) { - PangoFontMap *self = PANGO_FONT_MAP (list); + Pango2FontMap *self = PANGO2_FONT_MAP (list); if (self->fallback) return self->families->len + g_list_model_get_n_items (G_LIST_MODEL (self->fallback)); @@ -118,10 +118,10 @@ pango_font_map_get_n_items (GListModel *list) } static gpointer -pango_font_map_get_item (GListModel *list, - guint position) +pango2_font_map_get_item (GListModel *list, + guint position) { - PangoFontMap *self = PANGO_FONT_MAP (list); + Pango2FontMap *self = PANGO2_FONT_MAP (list); if (position < self->families->len) return g_object_ref (g_ptr_array_index (self->families, position)); @@ -132,11 +132,11 @@ pango_font_map_get_item (GListModel *list, } static void -pango_font_map_list_model_init (GListModelInterface *iface) +pango2_font_map_list_model_init (GListModelInterface *iface) { - iface->get_item_type = pango_font_map_get_item_type; - iface->get_n_items = pango_font_map_get_n_items; - iface->get_item = pango_font_map_get_item; + iface->get_item_type = pango2_font_map_get_item_type; + iface->get_n_items = pango2_font_map_get_n_items; + iface->get_item = pango2_font_map_get_item; } /* }}} */ @@ -163,7 +163,7 @@ hash_bytes_fnv (unsigned char *buffer, } static guint -pango_fontset_cached_hash (const PangoFontsetCached *fontset) +pango2_fontset_cached_hash (const Pango2FontsetCached *fontset) { guint32 hash = FNV1_32_INIT; @@ -175,12 +175,12 @@ pango_fontset_cached_hash (const PangoFontsetCached *fontset) #ifdef HAVE_CAIRO cairo_font_options_hash (fontset->font_options) ^ #endif - pango_font_description_hash (fontset->description)); + pango2_font_description_hash (fontset->description)); } static gboolean -pango_fontset_cached_equal (const PangoFontsetCached *a, - const PangoFontsetCached *b) +pango2_fontset_cached_equal (const Pango2FontsetCached *a, + const Pango2FontsetCached *b) { return a->language == b->language && #ifdef HAVE_CAIRO @@ -188,12 +188,12 @@ pango_fontset_cached_equal (const PangoFontsetCached *a, #endif (a->ctm == b->ctm || (a->ctm && b->ctm && memcmp (a->ctm, b->ctm, 4 * sizeof (double)) == 0)) && - pango_font_description_equal (a->description, b->description); + pango2_font_description_equal (a->description, b->description); } static void -pango_fontset_cache (PangoFontsetCached *fontset, - PangoFontMap *self) +pango2_fontset_cache (Pango2FontsetCached *fontset, + Pango2FontMap *self) { GQueue *cache = &self->fontset_cache; GList *link = &fontset->cache_link; @@ -227,7 +227,7 @@ pango_fontset_cache (PangoFontsetCached *fontset, /* {{{ Utilities */ static guint -pango_family_hash (const PangoFontFamily *key) +pango2_family_hash (const Pango2FontFamily *key) { const char *p; guint32 h = 5381; @@ -239,90 +239,90 @@ pango_family_hash (const PangoFontFamily *key) } static gboolean -pango_family_equal (const PangoFontFamily *a, - const PangoFontFamily *b) +pango2_family_equal (const Pango2FontFamily *a, + const Pango2FontFamily *b) { return g_ascii_strcasecmp (a->name, b->name) == 0; } -static PangoFontFamily * -find_family (PangoFontMap *self, - const char *family_name) +static Pango2FontFamily * +find_family (Pango2FontMap *self, + const char *family_name) { - PangoFontFamily lookup; - PangoFontFamily *family; + Pango2FontFamily lookup; + Pango2FontFamily *family; lookup.name = (char *)family_name; - family = PANGO_FONT_FAMILY (g_hash_table_lookup (self->families_hash, &lookup)); + family = PANGO2_FONT_FAMILY (g_hash_table_lookup (self->families_hash, &lookup)); return family; } static void -clear_caches (PangoFontMap *self) +clear_caches (Pango2FontMap *self) { g_hash_table_remove_all (self->fontsets); g_queue_init (&self->fontset_cache); } static void -add_style_variation (PangoHbFamily *family, - PangoHbFace *face, - PangoStyle style, - PangoWeight weight) +add_style_variation (Pango2HbFamily *family, + Pango2HbFace *face, + Pango2Style style, + Pango2Weight weight) { - PangoMatrix italic_matrix = { 1, 0.2, 0, 1, 0, 0 }; - PangoFontDescription *desc; - PangoHbFace *variation; - - desc = pango_font_description_new (); - pango_font_description_set_family (desc, pango_font_family_get_name (PANGO_FONT_FAMILY (family))); - pango_font_description_set_style (desc, style); - pango_font_description_set_weight (desc, weight); - - variation = pango_hb_face_new_synthetic (face, - style == PANGO_STYLE_ITALIC ? &italic_matrix : NULL, - weight == PANGO_WEIGHT_BOLD, - NULL, - desc); - pango_hb_family_add_face (family, PANGO_FONT_FACE (variation)); - - pango_font_description_free (desc); + Pango2Matrix italic_matrix = { 1, 0.2, 0, 1, 0, 0 }; + Pango2FontDescription *desc; + Pango2HbFace *variation; + + desc = pango2_font_description_new (); + pango2_font_description_set_family (desc, pango2_font_family_get_name (PANGO2_FONT_FAMILY (family))); + pango2_font_description_set_style (desc, style); + pango2_font_description_set_weight (desc, weight); + + variation = pango2_hb_face_new_synthetic (face, + style == PANGO2_STYLE_ITALIC ? &italic_matrix : NULL, + weight == PANGO2_WEIGHT_BOLD, + NULL, + desc); + pango2_hb_family_add_face (family, PANGO2_FONT_FACE (variation)); + + pango2_font_description_free (desc); } static void -synthesize_bold_and_italic_faces (PangoFontMap *map) +synthesize_bold_and_italic_faces (Pango2FontMap *map) { for (int i = 0; i < map->families->len; i++) { - PangoFontFamily *family = g_ptr_array_index (map->families, i); - PangoFontFace *regular_face = NULL; + Pango2FontFamily *family = g_ptr_array_index (map->families, i); + Pango2FontFace *regular_face = NULL; int regular_dist = G_MAXINT; int bold_dist = G_MAXINT; gboolean has_italic = FALSE; gboolean has_bold = FALSE; gboolean has_bold_italic = FALSE; - if (PANGO_IS_GENERIC_FAMILY (family)) + if (PANGO2_IS_GENERIC_FAMILY (family)) continue; for (int j = 0; j < g_list_model_get_n_items (G_LIST_MODEL (family)); j++) { - PangoFontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j); + Pango2FontFace *face = g_list_model_get_item (G_LIST_MODEL (family), j); int weight; - PangoStyle style; + Pango2Style style; int dist; - if (!PANGO_IS_HB_FACE (face)) + if (!PANGO2_IS_HB_FACE (face)) continue; - weight = pango_font_description_get_weight (face->description); - style = pango_font_description_get_style (face->description); + weight = pango2_font_description_get_weight (face->description); + style = pango2_font_description_get_style (face->description); - if (style == PANGO_STYLE_NORMAL) + if (style == PANGO2_STYLE_NORMAL) { - dist = abs (weight - (int)PANGO_WEIGHT_NORMAL); + dist = abs (weight - (int)PANGO2_WEIGHT_NORMAL); if (dist < regular_dist) { @@ -331,7 +331,7 @@ synthesize_bold_and_italic_faces (PangoFontMap *map) regular_face = face; } - dist = abs (weight - (int)PANGO_WEIGHT_BOLD); + dist = abs (weight - (int)PANGO2_WEIGHT_BOLD); if (dist < bold_dist) { @@ -341,7 +341,7 @@ synthesize_bold_and_italic_faces (PangoFontMap *map) } else { - if (weight < PANGO_WEIGHT_SEMIBOLD) + if (weight < PANGO2_WEIGHT_SEMIBOLD) has_italic = TRUE; else has_bold_italic = TRUE; @@ -353,28 +353,28 @@ synthesize_bold_and_italic_faces (PangoFontMap *map) if (regular_face) { if (!has_italic) - add_style_variation (PANGO_HB_FAMILY (family), - PANGO_HB_FACE (regular_face), - PANGO_STYLE_ITALIC, - PANGO_WEIGHT_NORMAL); + add_style_variation (PANGO2_HB_FAMILY (family), + PANGO2_HB_FACE (regular_face), + PANGO2_STYLE_ITALIC, + PANGO2_WEIGHT_NORMAL); if (!has_bold) - add_style_variation (PANGO_HB_FAMILY (family), - PANGO_HB_FACE (regular_face), - PANGO_STYLE_NORMAL, - PANGO_WEIGHT_BOLD); + add_style_variation (PANGO2_HB_FAMILY (family), + PANGO2_HB_FACE (regular_face), + PANGO2_STYLE_NORMAL, + PANGO2_WEIGHT_BOLD); if (!has_bold_italic) - add_style_variation (PANGO_HB_FAMILY (family), - PANGO_HB_FACE (regular_face), - PANGO_STYLE_ITALIC, - PANGO_WEIGHT_BOLD); + add_style_variation (PANGO2_HB_FAMILY (family), + PANGO2_HB_FACE (regular_face), + PANGO2_STYLE_ITALIC, + PANGO2_WEIGHT_BOLD); } } } /* }}} */ -/* {{{ PangoFontMap implementation */ +/* {{{ Pango2FontMap implementation */ enum { PROP_RESOLUTION = 1, @@ -386,22 +386,22 @@ enum { static GParamSpec *properties[N_PROPERTIES] = { NULL }; -G_DEFINE_TYPE_WITH_CODE (PangoFontMap, pango_font_map, G_TYPE_OBJECT, - G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango_font_map_list_model_init)) +G_DEFINE_TYPE_WITH_CODE (Pango2FontMap, pango2_font_map, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_LIST_MODEL, pango2_font_map_list_model_init)) static void -pango_font_map_init (PangoFontMap *self) +pango2_font_map_init (Pango2FontMap *self) { self->added_faces = g_ptr_array_new_with_free_func (g_object_unref); self->added_families = g_ptr_array_new_with_free_func (g_object_unref); self->families = g_ptr_array_new_with_free_func (g_object_unref); - self->families_hash = g_hash_table_new_full ((GHashFunc) pango_family_hash, - (GEqualFunc) pango_family_equal, + self->families_hash = g_hash_table_new_full ((GHashFunc) pango2_family_hash, + (GEqualFunc) pango2_family_equal, NULL, NULL); - self->fontsets = g_hash_table_new_full ((GHashFunc) pango_fontset_cached_hash, - (GEqualFunc) pango_fontset_cached_equal, + self->fontsets = g_hash_table_new_full ((GHashFunc) pango2_fontset_cached_hash, + (GEqualFunc) pango2_fontset_cached_equal, NULL, (GDestroyNotify) g_object_unref); g_queue_init (&self->fontset_cache); @@ -409,9 +409,9 @@ pango_font_map_init (PangoFontMap *self) } static void -pango_font_map_finalize (GObject *object) +pango2_font_map_finalize (GObject *object) { - PangoFontMap *self = PANGO_FONT_MAP (object); + Pango2FontMap *self = PANGO2_FONT_MAP (object); g_clear_object (&self->fallback); g_ptr_array_unref (self->added_faces); @@ -420,25 +420,25 @@ pango_font_map_finalize (GObject *object) g_ptr_array_unref (self->families); g_hash_table_unref (self->fontsets); - G_OBJECT_CLASS (pango_font_map_parent_class)->finalize (object); + G_OBJECT_CLASS (pango2_font_map_parent_class)->finalize (object); } static void -pango_font_map_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) +pango2_font_map_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) { - PangoFontMap *map = PANGO_FONT_MAP (object); + Pango2FontMap *map = PANGO2_FONT_MAP (object); switch (property_id) { case PROP_RESOLUTION: - pango_font_map_set_resolution (map, g_value_get_float (value)); + pango2_font_map_set_resolution (map, g_value_get_float (value)); break; case PROP_FALLBACK: - pango_font_map_set_fallback (map, g_value_get_object (value)); + pango2_font_map_set_fallback (map, g_value_get_object (value)); break; default: @@ -447,12 +447,12 @@ pango_font_map_set_property (GObject *object, } static void -pango_font_map_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) +pango2_font_map_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) { - PangoFontMap *map = PANGO_FONT_MAP (object); + Pango2FontMap *map = PANGO2_FONT_MAP (object); switch (property_id) { @@ -465,11 +465,11 @@ pango_font_map_get_property (GObject *object, break; case PROP_ITEM_TYPE: - g_value_set_gtype (value, PANGO_TYPE_FONT_FAMILY); + g_value_set_gtype (value, PANGO2_TYPE_FONT_FAMILY); break; case PROP_N_ITEMS: - g_value_set_uint (value, pango_font_map_get_n_items (G_LIST_MODEL (object))); + g_value_set_uint (value, pango2_font_map_get_n_items (G_LIST_MODEL (object))); break; default: @@ -478,72 +478,72 @@ pango_font_map_get_property (GObject *object, } /* Load a font from the first matching family */ -static PangoFont * -pango_font_map_default_load_font (PangoFontMap *self, - PangoContext *context, - const PangoFontDescription *description) +static Pango2Font * +pango2_font_map_default_load_font (Pango2FontMap *self, + Pango2Context *context, + const Pango2FontDescription *description) { - PangoFontsetCached *fontset; - PangoLanguage *language; - PangoFont *font = NULL; + Pango2FontsetCached *fontset; + Pango2Language *language; + Pango2Font *font = NULL; if (self->families->len == 0) return NULL; if (context) - language = pango_context_get_language (context); + language = pango2_context_get_language (context); else language = NULL; - fontset = (PangoFontsetCached *)pango_font_map_load_fontset (self, context, description, language); - if (pango_fontset_cached_size (fontset) > 0) - font = pango_fontset_cached_get_first_font (fontset); + fontset = (Pango2FontsetCached *)pango2_font_map_load_fontset (self, context, description, language); + if (pango2_fontset_cached_size (fontset) > 0) + font = pango2_fontset_cached_get_first_font (fontset); g_object_unref (fontset); return font; } /* Add one font for each family we find */ -static PangoFontset * -pango_font_map_default_load_fontset (PangoFontMap *self, - PangoContext *context, - const PangoFontDescription *description, - PangoLanguage *language) +static Pango2Fontset * +pango2_font_map_default_load_fontset (Pango2FontMap *self, + Pango2Context *context, + const Pango2FontDescription *description, + Pango2Language *language) { - PangoFontsetCached lookup; - PangoFontsetCached *fontset; - const PangoMatrix *ctm; + Pango2FontsetCached lookup; + Pango2FontsetCached *fontset; + const Pango2Matrix *ctm; const char *family_name; char **families; - PangoFontDescription *copy; - PangoFontFamily *family; - PangoFontFace *face; + Pango2FontDescription *copy; + Pango2FontFamily *family; + Pango2FontFace *face; gboolean has_generic = FALSE; - PangoFontset *fallback; + Pango2Fontset *fallback; gint64 before G_GNUC_UNUSED; - before = PANGO_TRACE_CURRENT_TIME; + before = PANGO2_TRACE_CURRENT_TIME; if (!language) - language = pango_context_get_language (context); + language = pango2_context_get_language (context); - family_name = pango_font_description_get_family (description); - ctm = pango_context_get_matrix (context); + family_name = pango2_font_description_get_family (description); + ctm = pango2_context_get_matrix (context); lookup.language = language; - lookup.description = (PangoFontDescription *)description; + lookup.description = (Pango2FontDescription *)description; lookup.ctm = ctm; #ifdef HAVE_CAIRO - lookup.font_options = (cairo_font_options_t *)pango_cairo_context_get_merged_font_options (context); + lookup.font_options = (cairo_font_options_t *)pango2_cairo_context_get_merged_font_options (context); #endif fontset = g_hash_table_lookup (self->fontsets, &lookup); if (fontset) goto done; - fontset = pango_fontset_cached_new (description, language, self->dpi, ctm); + fontset = pango2_fontset_cached_new (description, language, self->dpi, ctm); #ifdef HAVE_CAIRO - fontset->font_options = cairo_font_options_copy (pango_cairo_context_get_merged_font_options (context)); + fontset->font_options = cairo_font_options_copy (pango2_cairo_context_get_merged_font_options (context)); #endif if (self->families->len == 0) @@ -559,11 +559,11 @@ pango_font_map_default_load_fontset (PangoFontMap *self, families = g_strsplit (family_name ? family_name : "", ",", -1); - /* Unset gravity and variant since PangoHbFace does not have these fields */ - copy = pango_font_description_copy_static (description); - pango_font_description_unset_fields (copy, PANGO_FONT_MASK_VARIATIONS | - PANGO_FONT_MASK_GRAVITY | - PANGO_FONT_MASK_VARIANT); + /* Unset gravity and variant since Pango2HbFace does not have these fields */ + copy = pango2_font_description_copy_static (description); + pango2_font_description_unset_fields (copy, PANGO2_FONT_MASK_VARIATIONS | + PANGO2_FONT_MASK_GRAVITY | + PANGO2_FONT_MASK_VARIANT); for (int i = 0; families[i]; i++) { @@ -571,22 +571,22 @@ pango_font_map_default_load_fontset (PangoFontMap *self, if (!family) continue; - if (PANGO_IS_GENERIC_FAMILY (family)) + if (PANGO2_IS_GENERIC_FAMILY (family)) { - pango_fontset_cached_add_family (fontset, PANGO_GENERIC_FAMILY (family)); + pango2_fontset_cached_add_family (fontset, PANGO2_GENERIC_FAMILY (family)); has_generic = TRUE; } else { - face = pango_hb_family_find_face (PANGO_HB_FAMILY (family), copy, language, 0); + face = pango2_hb_family_find_face (PANGO2_HB_FAMILY (family), copy, language, 0); if (face) - pango_fontset_cached_add_face (fontset, face); + pango2_fontset_cached_add_face (fontset, face); } } g_strfreev (families); - pango_font_description_free (copy); + pango2_font_description_free (copy); /* Returning an empty fontset leads to bad outcomes. * @@ -599,13 +599,13 @@ pango_font_map_default_load_fontset (PangoFontMap *self, if (!has_generic) { family = find_family (self, "sans-serif"); - if (PANGO_IS_GENERIC_FAMILY (family)) - pango_fontset_cached_add_family (fontset, PANGO_GENERIC_FAMILY (family)); + if (PANGO2_IS_GENERIC_FAMILY (family)) + pango2_fontset_cached_add_family (fontset, PANGO2_GENERIC_FAMILY (family)); else if (self->fallback) { add_fallback: - fallback = pango_font_map_load_fontset (self->fallback, context, description, language); - pango_fontset_cached_append (fontset, PANGO_FONTSET_CACHED (fallback)); + fallback = pango2_font_map_load_fontset (self->fallback, context, description, language); + pango2_fontset_cached_append (fontset, PANGO2_FONTSET_CACHED (fallback)); g_object_unref (fallback); } } @@ -613,41 +613,41 @@ add_fallback: g_hash_table_add (self->fontsets, fontset); done: - pango_fontset_cache (fontset, self); + pango2_fontset_cache (fontset, self); - if (pango_fontset_cached_size (fontset) == 0) + if (pango2_fontset_cached_size (fontset) == 0) { - char *s = pango_font_description_to_string (description); - g_warning ("All font fallbacks failed for \"%s\", in %s !!!!", s, pango_language_to_string (language)); + char *s = pango2_font_description_to_string (description); + g_warning ("All font fallbacks failed for \"%s\", in %s !!!!", s, pango2_language_to_string (language)); g_free (s); } done_no_cache: - pango_trace_mark (before, "pango_fontmap_load_fontset", "%s", family_name); + pango2_trace_mark (before, "pango2_fontmap_load_fontset", "%s", family_name); - return g_object_ref (PANGO_FONTSET (fontset)); + return g_object_ref (PANGO2_FONTSET (fontset)); } -static PangoFontFamily * -pango_font_map_default_get_family (PangoFontMap *self, - const char *name) +static Pango2FontFamily * +pango2_font_map_default_get_family (Pango2FontMap *self, + const char *name) { - return PANGO_FONT_FAMILY (find_family (self, name)); + return PANGO2_FONT_FAMILY (find_family (self, name)); } static void -pango_font_map_default_populate (PangoFontMap *self) +pango2_font_map_default_populate (Pango2FontMap *self) { } static guint -pango_font_map_default_get_serial (PangoFontMap *self) +pango2_font_map_default_get_serial (Pango2FontMap *self) { return self->serial; } static void -pango_font_map_default_changed (PangoFontMap *self) +pango2_font_map_default_changed (Pango2FontMap *self) { self->serial++; if (self->serial == 0) @@ -655,28 +655,28 @@ pango_font_map_default_changed (PangoFontMap *self) } static void -pango_font_map_class_init (PangoFontMapClass *class) +pango2_font_map_class_init (Pango2FontMapClass *class) { GObjectClass *object_class = G_OBJECT_CLASS (class); - object_class->finalize = pango_font_map_finalize; - object_class->set_property = pango_font_map_set_property; - object_class->get_property = pango_font_map_get_property; + object_class->finalize = pango2_font_map_finalize; + object_class->set_property = pango2_font_map_set_property; + object_class->get_property = pango2_font_map_get_property; - class->load_font = pango_font_map_default_load_font; - class->load_fontset = pango_font_map_default_load_fontset; - class->get_serial = pango_font_map_default_get_serial; - class->changed = pango_font_map_default_changed; - class->get_family = pango_font_map_default_get_family; - class->populate = pango_font_map_default_populate; + class->load_font = pango2_font_map_default_load_font; + class->load_fontset = pango2_font_map_default_load_fontset; + class->get_serial = pango2_font_map_default_get_serial; + class->changed = pango2_font_map_default_changed; + class->get_family = pango2_font_map_default_get_family; + class->populate = pango2_font_map_default_populate; /** - * PangoFontMap:resolution: (attributes org.gtk.Property.get=pango_font_map_get_resolution org.gtk.Property.set=pango_font_map_set_resolution) + * Pango2FontMap:resolution: (attributes org.gtk.Property.get=pango2_font_map_get_resolution org.gtk.Property.set=pango2_font_map_set_resolution) * * The resolution for the fontmap. * * This is a scale factor between points specified in a - * `PangoFontDescription` and Cairo units. The default value + * `Pango2FontDescription` and Cairo units. The default value * is 96, meaning that a 10 point font will be 13 units high. * (10 * 96. / 72. = 13.3). */ @@ -685,17 +685,17 @@ pango_font_map_class_init (PangoFontMapClass *class) G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** - * PangoFontMap:fallback: (attributes org.gtk.Property.get=pango_font_map_get_fallback org.gtk.Property.set=pango_font_map_set_fallback) + * Pango2FontMap:fallback: (attributes org.gtk.Property.get=pango2_font_map_get_fallback org.gtk.Property.set=pango2_font_map_set_fallback) * * The fallback fontmap is used to look up fonts that * this map does not have itself. */ properties[PROP_FALLBACK] = - g_param_spec_object ("fallback", NULL, NULL, PANGO_TYPE_FONT_MAP, + g_param_spec_object ("fallback", NULL, NULL, PANGO2_TYPE_FONT_MAP, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); /** - * PangoFontMap:item-type: + * Pango2FontMap:item-type: * * The type of items contained in this list. */ @@ -704,7 +704,7 @@ pango_font_map_class_init (PangoFontMapClass *class) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); /** - * PangoFontMap:n-items: + * Pango2FontMap:n-items: * * The number of items contained in this list. */ @@ -719,8 +719,8 @@ pango_font_map_class_init (PangoFontMapClass *class) /* {{{ Private API */ /*< private > - * pango_font_map_repopulate: - * @self: a `PangoFontMap` + * pango2_font_map_repopulate: + * @self: a `Pango2FontMap` * @add_synthetic: if `TRUE`, missing bold and italic faces will be synthesized * * Clear all cached information and repopulate the fontmap with @@ -730,8 +730,8 @@ pango_font_map_class_init (PangoFontMapClass *class) * in a way that requires recreating families and faces. */ void -pango_font_map_repopulate (PangoFontMap *self, - gboolean add_synthetic) +pango2_font_map_repopulate (Pango2FontMap *self, + gboolean add_synthetic) { int removed, added; @@ -744,21 +744,21 @@ pango_font_map_repopulate (PangoFontMap *self, self->in_populate = TRUE; - PANGO_FONT_MAP_GET_CLASS (self)->populate (self); + PANGO2_FONT_MAP_GET_CLASS (self)->populate (self); if (add_synthetic) synthesize_bold_and_italic_faces (self); for (int i = 0; i < self->added_faces->len; i++) { - PangoFontFace *face = g_ptr_array_index (self->added_faces, i); - pango_font_map_add_face (self, face); + Pango2FontFace *face = g_ptr_array_index (self->added_faces, i); + pango2_font_map_add_face (self, face); } for (int i = 0; i < self->added_families->len; i++) { - PangoFontFamily *family = PANGO_FONT_FAMILY (g_ptr_array_index (self->added_families, i)); - pango_font_map_add_family (self, family); + Pango2FontFamily *family = PANGO2_FONT_FAMILY (g_ptr_array_index (self->added_families, i)); + pango2_font_map_add_family (self, family); } self->in_populate = FALSE; @@ -767,86 +767,86 @@ pango_font_map_repopulate (PangoFontMap *self, g_list_model_items_changed (G_LIST_MODEL (self), 0, removed, added); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]); - pango_font_map_changed (self); + pango2_font_map_changed (self); } /*< private > - * pango_font_map_changed: - * @self: a `PangoFontMap` + * pango2_font_map_changed: + * @self: a `Pango2FontMap` * - * Forces a change in the context, which will cause any `PangoContext` + * Forces a change in the context, which will cause any `Pango2Context` * using this fontmap to change. * * This function is only useful when implementing a new backend - * for Pango, something applications won't do. Backends should + * for Pango2, something applications won't do. Backends should * call this function if they have attached extra data to the * context and such data is changed. */ void -pango_font_map_changed (PangoFontMap *self) +pango2_font_map_changed (Pango2FontMap *self) { - g_return_if_fail (PANGO_IS_FONT_MAP (self)); + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); - PANGO_FONT_MAP_GET_CLASS (self)->changed (self); + PANGO2_FONT_MAP_GET_CLASS (self)->changed (self); } /* }}} */ /* {{{ Public API */ /** - * pango_font_map_load_font: - * @self: a `PangoFontMap` - * @context: the `PangoContext` the font will be used with - * @desc: a `PangoFontDescription` describing the font to load + * pango2_font_map_load_font: + * @self: a `Pango2FontMap` + * @context: the `Pango2Context` the font will be used with + * @desc: a `Pango2FontDescription` describing the font to load * * Load the font in the fontmap that is the closest match for * a font description. * - * Returns: (transfer full) (nullable): the `PangoFont` that + * Returns: (transfer full) (nullable): the `Pango2Font` that * was found */ -PangoFont * -pango_font_map_load_font (PangoFontMap *self, - PangoContext *context, - const PangoFontDescription *desc) +Pango2Font * +pango2_font_map_load_font (Pango2FontMap *self, + Pango2Context *context, + const Pango2FontDescription *desc) { - g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL); - g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL); + g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL); + g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL); g_return_val_if_fail (desc != NULL, NULL); - return PANGO_FONT_MAP_GET_CLASS (self)->load_font (self, context, desc); + return PANGO2_FONT_MAP_GET_CLASS (self)->load_font (self, context, desc); } /** - * pango_font_map_load_fontset: - * @self: a `PangoFontMap` - * @context: the `PangoContext` the font will be used with - * @desc: a `PangoFontDescription` describing the font to load - * @language: (nullable): a `PangoLanguage` the fonts will be used for, + * pango2_font_map_load_fontset: + * @self: a `Pango2FontMap` + * @context: the `Pango2Context` the font will be used with + * @desc: a `Pango2FontDescription` describing the font to load + * @language: (nullable): a `Pango2Language` the fonts will be used for, * or `NULL` to use the language of @context * * Load a set of fonts in the fontmap that can be used to render * a font matching a font description. * - * Returns: (transfer full) (nullable): the `PangoFontset` containing + * Returns: (transfer full) (nullable): the `Pango2Fontset` containing * the fonts that were found */ -PangoFontset * -pango_font_map_load_fontset (PangoFontMap *self, - PangoContext *context, - const PangoFontDescription *desc, - PangoLanguage *language) +Pango2Fontset * +pango2_font_map_load_fontset (Pango2FontMap *self, + Pango2Context *context, + const Pango2FontDescription *desc, + Pango2Language *language) { - g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL); - g_return_val_if_fail (PANGO_IS_CONTEXT (context), NULL); + g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL); + g_return_val_if_fail (PANGO2_IS_CONTEXT (context), NULL); g_return_val_if_fail (desc != NULL, NULL); - return PANGO_FONT_MAP_GET_CLASS (self)->load_fontset (self, context, desc, language); + return PANGO2_FONT_MAP_GET_CLASS (self)->load_fontset (self, context, desc, language); } /** - * pango_font_map_get_serial: - * @self: a `PangoFontMap` + * pango2_font_map_get_serial: + * @self: a `Pango2FontMap` * * Returns the current serial number of the fontmap. * @@ -858,127 +858,127 @@ pango_font_map_load_fontset (PangoFontMap *self, * The fontmap can only be changed using backend-specific API, like changing * fontmap resolution. * - * This can be used to automatically detect changes to a `PangoFontMap`, - * like in `PangoContext`. + * This can be used to automatically detect changes to a `Pango2FontMap`, + * like in `Pango2Context`. * * Return value: The current serial number of @fontmap. */ guint -pango_font_map_get_serial (PangoFontMap *self) +pango2_font_map_get_serial (Pango2FontMap *self) { - g_return_val_if_fail (PANGO_IS_FONT_MAP (self), 0); + g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), 0); - return PANGO_FONT_MAP_GET_CLASS (self)->get_serial (self); + return PANGO2_FONT_MAP_GET_CLASS (self)->get_serial (self); } /** - * pango_font_map_get_family: - * @self: a `PangoFontMap` + * pango2_font_map_get_family: + * @self: a `Pango2FontMap` * @name: a family name * * Gets a font family by name. * - * Returns: (transfer none): the `PangoFontFamily` + * Returns: (transfer none): the `Pango2FontFamily` */ -PangoFontFamily * -pango_font_map_get_family (PangoFontMap *self, - const char *name) +Pango2FontFamily * +pango2_font_map_get_family (Pango2FontMap *self, + const char *name) { - g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL); + g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL); - return PANGO_FONT_MAP_GET_CLASS (self)->get_family (self, name); + return PANGO2_FONT_MAP_GET_CLASS (self)->get_family (self, name); } /** - * pango_font_map_new: + * pango2_font_map_new: * - * Creates a new `PangoFontMap`. + * Creates a new `Pango2FontMap`. * * A fontmap is used to cache information about available fonts, * and holds certain global parameters such as the resolution. * - * Returns: A newly created `PangoFontMap + * Returns: A newly created `Pango2FontMap */ -PangoFontMap * -pango_font_map_new (void) +Pango2FontMap * +pango2_font_map_new (void) { - return g_object_new (PANGO_TYPE_FONT_MAP, NULL); + return g_object_new (PANGO2_TYPE_FONT_MAP, NULL); } /** - * pango_font_map_add_face: - * @self: a `PangoFontMap` - * @face: (transfer full): a `PangoFontFace` + * pango2_font_map_add_face: + * @self: a `Pango2FontMap` + * @face: (transfer full): a `Pango2FontFace` * * Adds a face to the fontmap. * * This is most useful for creating transformed faces or aliases. - * See [method@Pango.HbFace.new_synthetic] and [method@Pango.HbFace.new_instance]. + * See [method@Pango2.HbFace.new_synthetic] and [method@Pango2.HbFace.new_instance]. */ void -pango_font_map_add_face (PangoFontMap *self, - PangoFontFace *face) +pango2_font_map_add_face (Pango2FontMap *self, + Pango2FontFace *face) { const char *family_name; - PangoHbFamily *family; - const PangoFontDescription *description; + Pango2HbFamily *family; + const Pango2FontDescription *description; - g_return_if_fail (PANGO_IS_FONT_MAP (self)); - g_return_if_fail (PANGO_IS_HB_FACE (face) || PANGO_IS_USER_FACE (face)); + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); + g_return_if_fail (PANGO2_IS_HB_FACE (face) || PANGO2_IS_USER_FACE (face)); description = face->description; - if (pango_font_description_get_set_fields (description) & PANGO_FONT_MASK_GRAVITY) - g_warning ("Font description for PangoFontFace includes things that it shouldn't"); + if (pango2_font_description_get_set_fields (description) & PANGO2_FONT_MASK_GRAVITY) + g_warning ("Font description for Pango2FontFace includes things that it shouldn't"); if (!self->in_populate) g_ptr_array_add (self->added_faces, g_object_ref (face)); - family_name = pango_font_description_get_family (description); - family = PANGO_HB_FAMILY (pango_font_map_get_family (self, family_name)); + family_name = pango2_font_description_get_family (description); + family = PANGO2_HB_FAMILY (pango2_font_map_get_family (self, family_name)); if (!family) { - family = pango_hb_family_new (family_name); - pango_font_map_add_family (self, PANGO_FONT_FAMILY (family)); + family = pango2_hb_family_new (family_name); + pango2_font_map_add_family (self, PANGO2_FONT_FAMILY (family)); } - pango_hb_family_add_face (family, face); + pango2_hb_family_add_face (family, face); - pango_font_map_changed (self); + pango2_font_map_changed (self); clear_caches (self); } /** - * pango_font_map_remove_face: - * @self: a `PangoFontMap` - * @face: a `PangoFontFace` that belongs to @map + * pango2_font_map_remove_face: + * @self: a `Pango2FontMap` + * @face: a `Pango2FontFace` that belongs to @map * * Removes @face from the fontmap. * - * @face must have been added with [method@Pango.FontMap.add_face]. + * @face must have been added with [method@Pango2.FontMap.add_face]. */ void -pango_font_map_remove_face (PangoFontMap *self, - PangoFontFace *face) +pango2_font_map_remove_face (Pango2FontMap *self, + Pango2FontFace *face) { - PangoHbFamily *family; + Pango2HbFamily *family; unsigned int position; - g_return_if_fail (PANGO_IS_FONT_MAP (self)); - g_return_if_fail (PANGO_IS_HB_FACE (face) || PANGO_IS_USER_FACE (face)); + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); + g_return_if_fail (PANGO2_IS_HB_FACE (face) || PANGO2_IS_USER_FACE (face)); if (!g_ptr_array_find (self->added_faces, face, &position)) return; - family = PANGO_HB_FAMILY (pango_font_face_get_family (face)); + family = PANGO2_HB_FAMILY (pango2_font_face_get_family (face)); - pango_hb_family_remove_face (family, face); + pango2_hb_family_remove_face (family, face); if (family->faces->len == 0) - pango_font_map_remove_family (self, PANGO_FONT_FAMILY (family)); + pango2_font_map_remove_family (self, PANGO2_FONT_FAMILY (family)); - pango_font_map_changed (self); + pango2_font_map_changed (self); clear_caches (self); @@ -986,47 +986,47 @@ pango_font_map_remove_face (PangoFontMap *self, } /** - * pango_font_map_add_file: - * @self: a `PangoFontMap` + * pango2_font_map_add_file: + * @self: a `Pango2FontMap` * @file: font filename * - * Creates a new `PangoHbFace` and adds it. + * Creates a new `Pango2HbFace` and adds it. * * If you need to specify an instance id or other - * parameters, use [ctor@Pango.HbFace.new_from_file]. + * parameters, use [ctor@Pango2.HbFace.new_from_file]. */ void -pango_font_map_add_file (PangoFontMap *self, - const char *file) +pango2_font_map_add_file (Pango2FontMap *self, + const char *file) { - PangoHbFace *face; + Pango2HbFace *face; - face = pango_hb_face_new_from_file (file, 0, -1, NULL, NULL); - pango_font_map_add_face (self, PANGO_FONT_FACE (face)); + face = pango2_hb_face_new_from_file (file, 0, -1, NULL, NULL); + pango2_font_map_add_face (self, PANGO2_FONT_FACE (face)); } /** - * pango_font_map_add_family: - * @self: a `PangoFontMap` - * @family: (transfer full): a `PangoFontFamily` + * pango2_font_map_add_family: + * @self: a `Pango2FontMap` + * @family: (transfer full): a `Pango2FontFamily` * - * Adds a family to the `PangoFontMap`. + * Adds a family to the `Pango2FontMap`. * * The fontmap must not contain a family with the * same name as @family yet. * * This is mostly useful for adding generic families - * using [ctor@Pango.GenericFamily.new]. + * using [ctor@Pango2.GenericFamily.new]. */ void -pango_font_map_add_family (PangoFontMap *self, - PangoFontFamily *family) +pango2_font_map_add_family (Pango2FontMap *self, + Pango2FontFamily *family) { const char *name; int position; - g_return_if_fail (PANGO_IS_FONT_MAP (self)); - g_return_if_fail (PANGO_IS_HB_FAMILY (family) || PANGO_IS_GENERIC_FAMILY (family)); + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); + g_return_if_fail (PANGO2_IS_HB_FAMILY (family) || PANGO2_IS_GENERIC_FAMILY (family)); g_return_if_fail (family->map == NULL); if (!self->in_populate) @@ -1037,13 +1037,13 @@ pango_font_map_add_family (PangoFontMap *self, position = 0; while (position < self->families->len) { - PangoFontFamily *f = g_ptr_array_index (self->families, position); + Pango2FontFamily *f = g_ptr_array_index (self->families, position); if (g_ascii_strcasecmp (name, f->name) < 0) break; position++; } - pango_font_family_set_font_map (family, self); + pango2_font_family_set_font_map (family, self); g_ptr_array_insert (self->families, position, family); g_hash_table_add (self->families_hash, family); @@ -1054,24 +1054,24 @@ pango_font_map_add_family (PangoFontMap *self, g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]); } - pango_font_map_changed (self); + pango2_font_map_changed (self); } /** - * pango_font_map_remove_family: - * @self: a `PangoFontMap` - * @family: a `PangoFontFamily` that belongs to @self + * pango2_font_map_remove_family: + * @self: a `Pango2FontMap` + * @family: a `Pango2FontFamily` that belongs to @self * * Removes a family from the fontmap. */ void -pango_font_map_remove_family (PangoFontMap *self, - PangoFontFamily *family) +pango2_font_map_remove_family (Pango2FontMap *self, + Pango2FontFamily *family) { unsigned int position; - g_return_if_fail (PANGO_IS_FONT_MAP (self)); - g_return_if_fail (PANGO_IS_HB_FAMILY (family) || PANGO_IS_GENERIC_FAMILY (family)); + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); + g_return_if_fail (PANGO2_IS_HB_FAMILY (family) || PANGO2_IS_GENERIC_FAMILY (family)); g_return_if_fail (family->map == self); if (!g_ptr_array_find (self->added_families, family, &position)) @@ -1080,7 +1080,7 @@ pango_font_map_remove_family (PangoFontMap *self, g_hash_table_remove (self->families_hash, family); g_ptr_array_remove_index (self->families, position); - pango_font_family_set_font_map (family, NULL); + pango2_font_family_set_font_map (family, NULL); if (!self->in_populate) { @@ -1088,15 +1088,15 @@ pango_font_map_remove_family (PangoFontMap *self, g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_ITEMS]); } - pango_font_map_changed (self); + pango2_font_map_changed (self); g_ptr_array_remove_index (self->added_families, position); } /** - * pango_font_map_set_fallback: - * @self: a `PangoFontMap` - * @fallback: (nullable): the `PangoFontMap` to use as fallback + * pango2_font_map_set_fallback: + * @self: a `Pango2FontMap` + * @fallback: (nullable): the `Pango2FontMap` to use as fallback * * Sets the fontmap to use as fallback when a font isn't found. * @@ -1105,11 +1105,11 @@ pango_font_map_remove_family (PangoFontMap *self, * from the fallback fontmap. */ void -pango_font_map_set_fallback (PangoFontMap *self, - PangoFontMap *fallback) +pango2_font_map_set_fallback (Pango2FontMap *self, + Pango2FontMap *fallback) { - g_return_if_fail (PANGO_IS_FONT_MAP (self)); - g_return_if_fail (fallback == NULL || PANGO_IS_FONT_MAP (fallback)); + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); + g_return_if_fail (fallback == NULL || PANGO2_IS_FONT_MAP (fallback)); if (!g_set_object (&self->fallback, fallback)) return; @@ -1119,40 +1119,40 @@ pango_font_map_set_fallback (PangoFontMap *self, } /** - * pango_font_map_get_fallback: - * @self: a `PangoFontMap` + * pango2_font_map_get_fallback: + * @self: a `Pango2FontMap` * * Returns the fallback fontmap of the fontmap. * - * See [method@Pango.FontMap.set_fallback]. + * See [method@Pango2.FontMap.set_fallback]. * * Returns: (nullable) (transfer none): the fallback fontmap */ -PangoFontMap * -pango_font_map_get_fallback (PangoFontMap *self) +Pango2FontMap * +pango2_font_map_get_fallback (Pango2FontMap *self) { - g_return_val_if_fail (PANGO_IS_FONT_MAP (self), NULL); + g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), NULL); return self->fallback; } /** - * pango_font_map_set_resolution: - * @self: a `PangoFontMap` + * pango2_font_map_set_resolution: + * @self: a `Pango2FontMap` * @dpi: the new resolution, in "dots per inch" * * Sets the resolution for the fontmap. * * This is a scale factor between points specified in a - * `PangoFontDescription` and Cairo units. The default value + * `Pango2FontDescription` and Cairo units. The default value * is 96, meaning that a 10 point font will be 13 units high. * (10 * 96. / 72. = 13.3). */ void -pango_font_map_set_resolution (PangoFontMap *self, - float dpi) +pango2_font_map_set_resolution (Pango2FontMap *self, + float dpi) { - g_return_if_fail (PANGO_IS_FONT_MAP (self)); + g_return_if_fail (PANGO2_IS_FONT_MAP (self)); g_return_if_fail (dpi > 0); if (self->dpi == dpi) @@ -1161,25 +1161,25 @@ pango_font_map_set_resolution (PangoFontMap *self, self->dpi = dpi; clear_caches (self); - pango_font_map_changed (self); + pango2_font_map_changed (self); g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_RESOLUTION]); } /** - * pango_font_map_get_resolution: - * @self: a `PangoFontMap` + * pango2_font_map_get_resolution: + * @self: a `Pango2FontMap` * * Returns the resolution for the fontmap. * - * See [method@Pango.FontMap.set_resolution]. + * See [method@Pango2.FontMap.set_resolution]. * * Return value: the resolution for the fontmap */ float -pango_font_map_get_resolution (PangoFontMap *self) +pango2_font_map_get_resolution (Pango2FontMap *self) { - g_return_val_if_fail (PANGO_IS_FONT_MAP (self), 0); + g_return_val_if_fail (PANGO2_IS_FONT_MAP (self), 0); return self->dpi; } @@ -1190,66 +1190,66 @@ pango_font_map_get_resolution (PangoFontMap *self) static GPrivate default_font_map = G_PRIVATE_INIT (g_object_unref); /* MT-safe */ /** - * pango_font_map_new_default: + * pango2_font_map_new_default: * - * Creates a new `PangoFontMap` object. + * Creates a new `Pango2FontMap` object. * * Note that the type of the returned object will depend - * on the platform that Pango is used on. If you want to - * explicitly create an instance of `PangoFontMap` itself - * (and not a platform-specific subclass), see [ctor@Pango.FontMap.new]. + * on the platform that Pango2 is used on. If you want to + * explicitly create an instance of `Pango2FontMap` itself + * (and not a platform-specific subclass), see [ctor@Pango2.FontMap.new]. * - * In most cases, you should use [func@Pango.FontMap.get_default], + * In most cases, you should use [func@Pango2.FontMap.get_default], * which will automatically create a new default fontmap, * if one has not been created for the current thread yet. * - * Return value: (transfer full): the newly allocated `PangoFontMap` + * Return value: (transfer full): the newly allocated `Pango2FontMap` */ -PangoFontMap * -pango_font_map_new_default (void) +Pango2FontMap * +pango2_font_map_new_default (void) { /* If we ever go back to having multiple backends built - * at the same time, bring back a PANGO_BACKEND env var + * at the same time, bring back a PANGO2_BACKEND env var * here. */ #if defined (HAVE_CORE_TEXT) - return PANGO_FONT_MAP (pango_core_text_font_map_new ()); + return PANGO2_FONT_MAP (pango2_core_text_font_map_new ()); #elif defined (HAVE_DIRECT_WRITE) - return PANGO_FONT_MAP (pango_direct_write_font_map_new ()); + return PANGO2_FONT_MAP (pango2_direct_write_font_map_new ()); #elif defined (HAVE_FONTCONFIG) - return PANGO_FONT_MAP (pango_fc_font_map_new ()); + return PANGO2_FONT_MAP (pango2_fc_font_map_new ()); #else return NULL; #endif } /** - * pango_font_map_get_default: + * pango2_font_map_get_default: * - * Gets the default `PangoFontMap`. + * Gets the default `Pango2FontMap`. * * The type of the returned object will depend on the - * platform that Pango is used on. + * platform that Pango2 is used on. * * Note that the default fontmap is per-thread. Each thread gets - * its own default fontmap. In this way, Pango can be used safely + * its own default fontmap. In this way, Pango2 can be used safely * from multiple threads. * * The default fontmap can be changed by using - * [method@Pango.FontMap.set_default]. + * [method@Pango2.FontMap.set_default]. * * Return value: (transfer none): the default fontmap - * for the current thread. This object is owned by Pango and must + * for the current thread. This object is owned by Pango2 and must * not be freed. */ -PangoFontMap * -pango_font_map_get_default (void) +Pango2FontMap * +pango2_font_map_get_default (void) { - PangoFontMap *fontmap = g_private_get (&default_font_map); + Pango2FontMap *fontmap = g_private_get (&default_font_map); if (G_UNLIKELY (!fontmap)) { - fontmap = pango_font_map_new_default (); + fontmap = pango2_font_map_new_default (); g_private_replace (&default_font_map, fontmap); } @@ -1257,10 +1257,10 @@ pango_font_map_get_default (void) } /** - * pango_font_map_set_default: + * pango2_font_map_set_default: * @fontmap: (nullable): The new default font map * - * Sets a default `PangoFontMap`. + * Sets a default `Pango2FontMap`. * * The old default font map is unreffed and the new font map referenced. * @@ -1268,16 +1268,16 @@ pango_font_map_get_default (void) * This function only changes the default fontmap for * the current thread. Default fontmaps of existing threads * are not changed. Default fontmaps of any new threads will - * still be created using [ctor@Pango.FontMap.new_default]. + * still be created using [ctor@Pango2.FontMap.new_default]. * * A value of %NULL for @fontmap will cause the current default * font map to be released and a new default font map to be created - * on demand, using [ctor@Pango.FontMap.new_default]. + * on demand, using [ctor@Pango2.FontMap.new_default]. */ void -pango_font_map_set_default (PangoFontMap *fontmap) +pango2_font_map_set_default (Pango2FontMap *fontmap) { - g_return_if_fail (fontmap == NULL || PANGO_IS_FONT_MAP (fontmap)); + g_return_if_fail (fontmap == NULL || PANGO2_IS_FONT_MAP (fontmap)); if (fontmap) g_object_ref (fontmap); |