diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-01-10 12:58:04 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-02-17 14:01:09 -0600 |
commit | 536fbc944d0298ec447114db3ba701a3e9e82af3 (patch) | |
tree | 72414db409c269dd7b85be0aa21d2cfaa521d69a | |
parent | 65c541898e2191fcd046bb18bbfe1c6b4c979eb3 (diff) | |
download | pango-536fbc944d0298ec447114db3ba701a3e9e82af3.tar.gz |
Drop deprecated pangoft2 api
-rw-r--r-- | pango/pangoft2-fontmap.c | 144 | ||||
-rw-r--r-- | pango/pangoft2-render.c | 4 | ||||
-rw-r--r-- | pango/pangoft2.c | 107 | ||||
-rw-r--r-- | pango/pangoft2.h | 36 |
4 files changed, 5 insertions, 286 deletions
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c index ca09a2ad..94a69925 100644 --- a/pango/pangoft2-fontmap.c +++ b/pango/pangoft2-fontmap.c @@ -68,8 +68,6 @@ static double pango_ft2_font_map_get_resolution (PangoFcFontMap static guint pango_ft2_font_map_get_serial (PangoFontMap *fontmap); static void pango_ft2_font_map_changed (PangoFontMap *fontmap); -static PangoFT2FontMap *pango_ft2_global_fontmap = NULL; /* MT-safe */ - G_DEFINE_TYPE (PangoFT2FontMap, pango_ft2_font_map, PANGO_TYPE_FC_FONT_MAP) static void @@ -155,58 +153,6 @@ pango_ft2_font_map_changed (PangoFontMap *fontmap) } /** - * pango_ft2_font_map_set_default_substitute: - * @fontmap: a `PangoFT2FontMap` - * @func: function to call to to do final config tweaking - * on #FcPattern objects. - * @data: data to pass to @func - * @notify: function to call when @data is no longer used. - * - * Sets a function that will be called to do final configuration - * substitution on a `FcPattern` before it is used to load - * the font. - * - * This function can be used to do things like set - * hinting and antialiasing options. - * - * Deprecated: 1.46: Use [method@PangoFc.FontMap.set_default_substitute] - * instead. - * - * Since: 1.2 - **/ -void -pango_ft2_font_map_set_default_substitute (PangoFT2FontMap *fontmap, - PangoFT2SubstituteFunc func, - gpointer data, - GDestroyNotify notify) -{ - PangoFcFontMap *fcfontmap = PANGO_FC_FONT_MAP (fontmap); - pango_fc_font_map_set_default_substitute(fcfontmap, func, data, notify); -} - -/** - * pango_ft2_font_map_substitute_changed: - * @fontmap: a `PangoFT2FontMap` - * - * Call this function any time the results of the - * default substitution function set with - * pango_ft2_font_map_set_default_substitute() change. - * - * That is, if your substitution function will return different - * results for the same input pattern, you must call this function. - * - * Deprecated: 1.46: Use [method@PangoFc.FontMap.substitute_changed] - * instead. - * - * Since: 1.2 - **/ -void -pango_ft2_font_map_substitute_changed (PangoFT2FontMap *fontmap) -{ - pango_fc_font_map_substitute_changed(PANGO_FC_FONT_MAP (fontmap)); -} - -/** * pango_ft2_font_map_set_resolution: * @fontmap: a `PangoFT2FontMap` * @dpi_x: dots per inch in the X direction @@ -226,95 +172,7 @@ pango_ft2_font_map_set_resolution (PangoFT2FontMap *fontmap, fontmap->dpi_x = dpi_x; fontmap->dpi_y = dpi_y; - pango_ft2_font_map_substitute_changed (fontmap); -} - -/** - * pango_ft2_font_map_create_context: (skip) - * @fontmap: a `PangoFT2FontMap` - * - * Create a `PangoContext` for the given fontmap. - * - * Return value: (transfer full): the newly created context; free with - * g_object_unref(). - * - * Since: 1.2 - * - * Deprecated: 1.22: Use [method@Pango.FontMap.create_context] instead. - **/ -PangoContext * -pango_ft2_font_map_create_context (PangoFT2FontMap *fontmap) -{ - g_return_val_if_fail (PANGO_FT2_IS_FONT_MAP (fontmap), NULL); - - return pango_font_map_create_context (PANGO_FONT_MAP (fontmap)); -} - -/** - * pango_ft2_get_context: (skip) - * @dpi_x: the horizontal DPI of the target device - * @dpi_y: the vertical DPI of the target device - * - * Retrieves a `PangoContext` for the default PangoFT2 fontmap - * (see pango_ft2_font_map_for_display()) and sets the resolution - * for the default fontmap to @dpi_x by @dpi_y. - * - * Return value: (transfer full): the new `PangoContext` - * - * Deprecated: 1.22: Use [method@Pango.FontMap.create_context] instead. - **/ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS -PangoContext * -pango_ft2_get_context (double dpi_x, double dpi_y) -{ - PangoFontMap *fontmap; - - fontmap = pango_ft2_font_map_for_display (); - pango_ft2_font_map_set_resolution (PANGO_FT2_FONT_MAP (fontmap), dpi_x, dpi_y); - - return pango_font_map_create_context (fontmap); -} -G_GNUC_END_IGNORE_DEPRECATIONS - -/** - * pango_ft2_font_map_for_display: (skip) - * - * Returns a `PangoFT2FontMap`. - * - * This font map is cached and should - * not be freed. If the font map is no longer needed, it can - * be released with pango_ft2_shutdown_display(). Use of the - * global PangoFT2 fontmap is deprecated; use pango_ft2_font_map_new() - * instead. - * - * Return value: (transfer none): a `PangoFT2FontMap`. - **/ -PangoFontMap * -pango_ft2_font_map_for_display (void) -{ - if (g_once_init_enter (&pango_ft2_global_fontmap)) - g_once_init_leave (&pango_ft2_global_fontmap, PANGO_FT2_FONT_MAP (pango_ft2_font_map_new ())); - - return PANGO_FONT_MAP (pango_ft2_global_fontmap); -} - -/** - * pango_ft2_shutdown_display: - * - * Free the global fontmap. (See pango_ft2_font_map_for_display()) - * Use of the global PangoFT2 fontmap is deprecated. - **/ -void -pango_ft2_shutdown_display (void) -{ - if (pango_ft2_global_fontmap) - { - pango_fc_font_map_cache_clear (PANGO_FC_FONT_MAP (pango_ft2_global_fontmap)); - - g_object_unref (pango_ft2_global_fontmap); - - pango_ft2_global_fontmap = NULL; - } + pango_fc_font_map_substitute_changed (PANGO_FC_FONT_MAP (fontmap)); } FT_Library diff --git a/pango/pangoft2-render.c b/pango/pangoft2-render.c index f2da8e7f..ebe0e0e3 100644 --- a/pango/pangoft2-render.c +++ b/pango/pangoft2-render.c @@ -212,7 +212,7 @@ pango_ft2_font_render_glyph (PangoFont *font, return box; } - face = pango_ft2_font_get_face (font); + face = pango_fc_font_lock_face (PANGO_FC_FONT (font)); if (face) { @@ -233,6 +233,8 @@ pango_ft2_font_render_glyph (PangoFont *font, rendered->bitmap_left = face->glyph->bitmap_left; rendered->bitmap_top = face->glyph->bitmap_top; + pango_fc_font_unlock_face (PANGO_FC_FONT (font)); + if (G_UNLIKELY (!rendered->bitmap.buffer)) { g_slice_free (PangoFT2RenderedGlyph, rendered); return NULL; diff --git a/pango/pangoft2.c b/pango/pangoft2.c index f330ef7c..d768fcd8 100644 --- a/pango/pangoft2.c +++ b/pango/pangoft2.c @@ -150,24 +150,7 @@ set_transform (PangoFT2Font *ft2font) } } -/** - * pango_ft2_font_get_face: (skip) - * @font: a `PangoFont` - * - * Returns the native FreeType2 `FT_Face` structure - * used for this `PangoFont`. - * - * This may be useful if you want to use FreeType2 - * functions directly. - * - * Use [method@PangoFc.Font.lock_face] instead; when you are - * done with a face from [method@PangoFc.Font.lock_face], you - * must call [method@PangoFc.Font.unlock_face]. - * - * Return value: (nullable): a pointer to a `FT_Face` structure, - * with the size set correctly - */ -FT_Face +static FT_Face pango_ft2_font_get_face (PangoFont *font) { PangoFT2Font *ft2font = (PangoFT2Font *)font; @@ -379,51 +362,6 @@ pango_ft2_font_get_glyph_extents (PangoFont *font, } } -/** - * pango_ft2_font_get_kerning: - * @font: a `PangoFont` - * @left: the left `PangoGlyph` - * @right: the right `PangoGlyph` - * - * Retrieves kerning information for a combination of two glyphs. - * - * Use pango_fc_font_kern_glyphs() instead. - * - * Return value: The amount of kerning (in Pango units) to - * apply for the given combination of glyphs. - */ -int -pango_ft2_font_get_kerning (PangoFont *font, - PangoGlyph left, - PangoGlyph right) -{ - PangoFcFont *fc_font = PANGO_FC_FONT (font); - - FT_Face face; - FT_Error error; - FT_Vector kerning; - - face = pango_fc_font_lock_face (fc_font); - if (!face) - return 0; - - if (!FT_HAS_KERNING (face)) - { - pango_fc_font_unlock_face (fc_font); - return 0; - } - - error = FT_Get_Kerning (face, left, right, ft_kerning_default, &kerning); - if (error != FT_Err_Ok) - { - pango_fc_font_unlock_face (fc_font); - return 0; - } - - pango_fc_font_unlock_face (fc_font); - return PANGO_UNITS_26_6 (kerning.x); -} - static FT_Face pango_ft2_font_real_lock_face (PangoFcFont *font) { @@ -468,51 +406,8 @@ pango_ft2_font_finalize (GObject *object) G_OBJECT_CLASS (pango_ft2_font_parent_class)->finalize (object); } -/** - * pango_ft2_font_get_coverage: - * @font: a Pango FT2 font - * @language: a language tag. - * - * Gets the `PangoCoverage` for a `PangoFT2Font`. - * - * Use [method@Pango.Font.get_coverage] instead. - * - * Return value: (transfer full): a `PangoCoverage` - */ -PangoCoverage * -pango_ft2_font_get_coverage (PangoFont *font, - PangoLanguage *language) -{ - return pango_font_get_coverage (font, language); -} - /* Utility functions */ -/** - * pango_ft2_get_unknown_glyph: - * @font: a `PangoFont` - * - * Return the index of a glyph suitable for drawing unknown - * characters with @font, or %PANGO_GLYPH_EMPTY if no suitable - * glyph found. - * - * If you want to draw an unknown-box for a character that - * is not covered by the font, use PANGO_GET_UNKNOWN_GLYPH() - * instead. - * - * Return value: a glyph index into @font, or %PANGO_GLYPH_EMPTY - */ -PangoGlyph -pango_ft2_get_unknown_glyph (PangoFont *font) -{ - FT_Face face = pango_ft2_font_get_face (font); - if (face && FT_IS_SFNT (face)) - /* TrueType fonts have an 'unknown glyph' box on glyph index 0 */ - return 0; - else - return PANGO_GLYPH_EMPTY; -} - void * _pango_ft2_font_get_cache_glyph_data (PangoFont *font, int glyph_index) diff --git a/pango/pangoft2.h b/pango/pangoft2.h index 86cb84c9..b3367816 100644 --- a/pango/pangoft2.h +++ b/pango/pangoft2.h @@ -102,42 +102,6 @@ PANGO_AVAILABLE_IN_1_2 void pango_ft2_font_map_set_resolution (PangoFT2FontMap *fontmap, double dpi_x, double dpi_y); -#ifndef PANGO_DISABLE_DEPRECATED -PANGO_DEPRECATED_IN_1_48_FOR(pango_fc_font_map_set_default_substitute) -void pango_ft2_font_map_set_default_substitute (PangoFT2FontMap *fontmap, - PangoFT2SubstituteFunc func, - gpointer data, - GDestroyNotify notify); -PANGO_DEPRECATED_IN_1_48_FOR(pango_fc_font_map_substitute_changed) -void pango_ft2_font_map_substitute_changed (PangoFT2FontMap *fontmap); -PANGO_DEPRECATED_IN_1_22_FOR(pango_font_map_create_context) -PangoContext *pango_ft2_font_map_create_context (PangoFT2FontMap *fontmap); -#endif - - -/* API for rendering modules - */ -#ifndef PANGO_DISABLE_DEPRECATED -PANGO_DEPRECATED_FOR(pango_font_map_create_context) -PangoContext *pango_ft2_get_context (double dpi_x, - double dpi_y); -PANGO_DEPRECATED_FOR(pango_ft2_font_map_new) -PangoFontMap *pango_ft2_font_map_for_display (void); -PANGO_DEPRECATED -void pango_ft2_shutdown_display (void); - -PANGO_DEPRECATED_FOR(PANGO_GET_UNKNOWN_GLYPH) -PangoGlyph pango_ft2_get_unknown_glyph (PangoFont *font); -PANGO_DEPRECATED_FOR(pango_fc_font_kern_glyphs) -int pango_ft2_font_get_kerning (PangoFont *font, - PangoGlyph left, - PangoGlyph right); -PANGO_DEPRECATED_FOR(pango_fc_font_lock_face) -FT_Face pango_ft2_font_get_face (PangoFont *font); -PANGO_DEPRECATED_FOR(pango_font_get_coverage) -PangoCoverage *pango_ft2_font_get_coverage (PangoFont *font, - PangoLanguage *language); -#endif /* PANGO_DISABLE_DEPRECATED */ G_END_DECLS |