diff options
author | Matthias Clasen <mclasen@redhat.com> | 2019-07-12 04:13:25 +0000 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2019-07-12 04:13:25 +0000 |
commit | ff02c888d75199ce84de5bc7eeedf897da98a548 (patch) | |
tree | c6063a8f123e4c659e3afc144ac07db9df8be193 | |
parent | 00233bd8b863a87cbf59344b1aed1feba04c66ca (diff) | |
parent | 721381a81cba3c609c30d5801bb410c9138cba1f (diff) | |
download | pango-ff02c888d75199ce84de5bc7eeedf897da98a548.tar.gz |
Merge branch 'no-kerning' into 'master'
Drop kerning function
See merge request GNOME/pango!83
-rw-r--r-- | pango/pango-ot.h | 3 | ||||
-rw-r--r-- | pango/pangocairo-fc-private.h | 3 | ||||
-rw-r--r-- | pango/pangocairo-fcfontmap.c | 29 | ||||
-rw-r--r-- | pango/pangofc-font.c | 62 | ||||
-rw-r--r-- | pango/pangoft2.h | 3 |
5 files changed, 11 insertions, 89 deletions
diff --git a/pango/pango-ot.h b/pango/pango-ot.h index 6d6a9f5c..501ca8b6 100644 --- a/pango/pango-ot.h +++ b/pango/pango-ot.h @@ -30,6 +30,9 @@ #include <pango/pango-script.h> #include <pango/pango-language.h> +#include <ft2build.h> +#include FT_FREETYPE_H + G_BEGIN_DECLS #ifndef PANGO_DISABLE_DEPRECATED diff --git a/pango/pangocairo-fc-private.h b/pango/pangocairo-fc-private.h index fc0193e4..370ecbea 100644 --- a/pango/pangocairo-fc-private.h +++ b/pango/pangocairo-fc-private.h @@ -33,14 +33,11 @@ struct _PangoCairoFcFontMap guint serial; double dpi; - - FT_Library library; }; PangoFcFont *_pango_cairo_fc_font_new (PangoCairoFcFontMap *cffontmap, PangoFcFontKey *key); -FT_Library _pango_cairo_fc_font_map_get_library (PangoCairoFcFontMap *fontmap); G_END_DECLS diff --git a/pango/pangocairo-fcfontmap.c b/pango/pangocairo-fcfontmap.c index 957cfdb3..bd3a8583 100644 --- a/pango/pangocairo-fcfontmap.c +++ b/pango/pangocairo-fcfontmap.c @@ -99,16 +99,6 @@ G_DEFINE_TYPE_WITH_CODE (PangoCairoFcFontMap, pango_cairo_fc_font_map, PANGO_TYP { G_IMPLEMENT_INTERFACE (PANGO_TYPE_CAIRO_FONT_MAP, cairo_font_map_iface_init) }) static void -pango_cairo_fc_font_map_finalize (GObject *object) -{ - PangoCairoFcFontMap *cffontmap = (PangoCairoFcFontMap *) (object); - - G_OBJECT_CLASS (pango_cairo_fc_font_map_parent_class)->finalize (object); - - FT_Done_FreeType (cffontmap->library); -} - -static void pango_cairo_fc_font_map_fontset_key_substitute (PangoFcFontMap *fcfontmap G_GNUC_UNUSED, PangoFcFontsetKey *fontkey, FcPattern *pattern) @@ -190,12 +180,9 @@ pango_cairo_fc_font_map_create_font (PangoFcFontMap *fcfontmap, static void pango_cairo_fc_font_map_class_init (PangoCairoFcFontMapClass *class) { - GObjectClass *gobject_class = G_OBJECT_CLASS (class); PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class); PangoFcFontMapClass *fcfontmap_class = PANGO_FC_FONT_MAP_CLASS (class); - gobject_class->finalize = pango_cairo_fc_font_map_finalize; - fontmap_class->get_serial = pango_cairo_fc_font_map_get_serial; fontmap_class->changed = pango_cairo_fc_font_map_changed; @@ -214,22 +201,6 @@ pango_cairo_fc_font_map_class_init (PangoCairoFcFontMapClass *class) static void pango_cairo_fc_font_map_init (PangoCairoFcFontMap *cffontmap) { - FT_Error error; - - cffontmap->library = NULL; - error = FT_Init_FreeType (&cffontmap->library); - if (error != FT_Err_Ok) - g_critical ("pango_cairo_font_map_init: Could not initialize freetype"); - cffontmap->serial = 1; cffontmap->dpi = 96.0; } - -FT_Library -_pango_cairo_fc_font_map_get_library (PangoCairoFcFontMap *fontmap) -{ - g_return_val_if_fail (PANGO_IS_CAIRO_FC_FONT_MAP (fontmap), NULL); - - return fontmap->library; -} - diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c index fb51b3c6..335cde42 100644 --- a/pango/pangofc-font.c +++ b/pango/pangofc-font.c @@ -843,8 +843,11 @@ _pango_fc_font_shutdown (PangoFcFont *font) * @font: a #PangoFcFont * @glyphs: a #PangoGlyphString * - * Adjust each adjacent pair of glyphs in @glyphs according to - * kerning information in @font. + * This function used to adjust each adjacent pair of glyphs + * in @glyphs according to kerning information in @font. + * + * Since 1.44, it does nothing. + * * * Since: 1.4 * Deprecated: 1.32 @@ -853,61 +856,6 @@ void pango_fc_font_kern_glyphs (PangoFcFont *font, PangoGlyphString *glyphs) { - FT_Face face; - FT_Error error; - FT_Vector kerning; - int i; - gboolean hinting = font->is_hinted; - gboolean scale = FALSE; - double xscale = 1; - PangoFcFontKey *key; - - g_return_if_fail (PANGO_IS_FC_FONT (font)); - g_return_if_fail (glyphs != NULL); - - face = PANGO_FC_FONT_LOCK_FACE (font); - if (G_UNLIKELY (!face)) - return; - - if (!FT_HAS_KERNING (face)) - { - PANGO_FC_FONT_UNLOCK_FACE (font); - return; - } - - key = _pango_fc_font_get_font_key (font); - if (key) { - const PangoMatrix *matrix = pango_fc_font_key_get_matrix (key); - PangoMatrix identity = PANGO_MATRIX_INIT; - if (G_UNLIKELY (matrix && 0 != memcmp (&identity, matrix, 2 * sizeof (double)))) - { - scale = TRUE; - pango_matrix_get_font_scale_factors (matrix, &xscale, NULL); - if (xscale) xscale = 1 / xscale; - } - } - - for (i = 1; i < glyphs->num_glyphs; ++i) - { - error = FT_Get_Kerning (face, - glyphs->glyphs[i-1].glyph, - glyphs->glyphs[i].glyph, - ft_kerning_default, - &kerning); - - if (error == FT_Err_Ok) { - int adjustment = PANGO_UNITS_26_6 (kerning.x); - - if (hinting) - adjustment = PANGO_UNITS_ROUND (adjustment); - if (G_UNLIKELY (scale)) - adjustment *= xscale; - - glyphs->glyphs[i-1].geometry.width += adjustment; - } - } - - PANGO_FC_FONT_UNLOCK_FACE (font); } /** diff --git a/pango/pangoft2.h b/pango/pangoft2.h index c0830327..87d0ae2d 100644 --- a/pango/pangoft2.h +++ b/pango/pangoft2.h @@ -25,6 +25,9 @@ #include <fontconfig/fontconfig.h> +#include <ft2build.h> +#include FT_FREETYPE_H + #include <pango/pango-layout.h> #include <pango/pangofc-font.h> |