summaryrefslogtreecommitdiff
path: root/pango/pangoxft-font.c
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@daimi.au.dk>2003-08-02 14:30:42 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2003-08-02 14:30:42 +0000
commitbcf10a1085bdf9344e513785c1082f9b82278619 (patch)
tree8060bace8d1366f4fa92a9bae98f84d6893156d3 /pango/pangoxft-font.c
parent537660728317118a8c2bd1940b2607ccf0f036ba (diff)
downloadpango-bcf10a1085bdf9344e513785c1082f9b82278619.tar.gz
Add API to kern a complete glyph string. Remove API to kern individual
Sat Aug 2 16:40:19 2003 Soeren Sandmann <sandmann@daimi.au.dk> Add API to kern a complete glyph string. Remove API to kern individual glyph pairs. * modules/basic/basic-fc.c (basic_engine_shape): use pango_fc_font_kern_glyphs() instead of pango_fc_font_get_kerning(). * pango/pangoft2.c (pango_ft2_font_real_kern_glyphs): add this function, remove pango_ft2_font_real_get_kerning(). * pango/pangoxft-font.c (pango_xft_font_real_kern_glyphs): add this function, remove pango_xft_font_real_get_kerning(). * pango/pangofc-font.c (pango_fc_font_kern_glyphs): new function. Remove pango_fc_font_get_kerning(). * pango/pangofc-font.h: remove pango_fc_font_get_kerning(), add pango_fc_font_kern_glyphs().
Diffstat (limited to 'pango/pangoxft-font.c')
-rw-r--r--pango/pangoxft-font.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
index d3340e8b..1c11fb0b 100644
--- a/pango/pangoxft-font.c
+++ b/pango/pangoxft-font.c
@@ -75,17 +75,16 @@ static void pango_xft_font_get_glyph_extents (PangoFont
static PangoFontMetrics * pango_xft_font_get_metrics (PangoFont *font,
PangoLanguage *language);
-static FT_Face pango_xft_font_real_lock_face (PangoFcFont *font);
-static void pango_xft_font_real_unlock_face (PangoFcFont *font);
-static gboolean pango_xft_font_real_has_char (PangoFcFont *font,
- gunichar wc);
-static guint pango_xft_font_real_get_glyph (PangoFcFont *font,
- gunichar wc);
-static PangoGlyph pango_xft_font_real_get_unknown_glyph (PangoFcFont *font,
- gunichar wc);
-static int pango_xft_font_real_get_kerning (PangoFcFont *font,
- PangoGlyph left,
- PangoGlyph right);
+static FT_Face pango_xft_font_real_lock_face (PangoFcFont *font);
+static void pango_xft_font_real_unlock_face (PangoFcFont *font);
+static gboolean pango_xft_font_real_has_char (PangoFcFont *font,
+ gunichar wc);
+static guint pango_xft_font_real_get_glyph (PangoFcFont *font,
+ gunichar wc);
+static PangoGlyph pango_xft_font_real_get_unknown_glyph (PangoFcFont *font,
+ gunichar wc);
+static void pango_xft_font_real_kern_glyphs (PangoFcFont *font,
+ PangoGlyphString *glyphs);
static XftFont *xft_font_get_font (PangoFont *font);
@@ -145,7 +144,7 @@ pango_xft_font_class_init (PangoXftFontClass *class)
fc_font_class->has_char = pango_xft_font_real_has_char;
fc_font_class->get_glyph = pango_xft_font_real_get_glyph;
fc_font_class->get_unknown_glyph = pango_xft_font_real_get_unknown_glyph;
- fc_font_class->get_kerning = pango_xft_font_real_get_kerning;
+ fc_font_class->kern_glyphs = pango_xft_font_real_kern_glyphs;
}
PangoXftFont *
@@ -785,39 +784,38 @@ pango_xft_font_real_get_unknown_glyph (PangoFcFont *font,
return wc | PANGO_XFT_UNKNOWN_FLAG;
}
-static int
-pango_xft_font_real_get_kerning (PangoFcFont *font,
- PangoGlyph left,
- PangoGlyph right)
+static void
+pango_xft_font_real_kern_glyphs (PangoFcFont *font,
+ PangoGlyphString *glyphs)
{
FT_Face face;
FT_Error error;
FT_Vector kerning;
+ int i;
face = pango_fc_font_lock_face (font);
if (!face)
- return 0;
+ return;
if (!FT_HAS_KERNING (face))
{
pango_fc_font_unlock_face (font);
- return 0;
+ return;
}
-
- if (!left || !right)
+
+ for (i = 1; i < glyphs->num_glyphs; ++i)
{
- pango_fc_font_unlock_face (font);
- return 0;
+ error = FT_Get_Kerning (face,
+ glyphs->glyphs[i-1].glyph,
+ glyphs->glyphs[i].glyph,
+ ft_kerning_default,
+ &kerning);
+
+ if (error == FT_Err_Ok)
+ glyphs->glyphs[i-1].geometry.width += PANGO_UNITS_26_6 (kerning.x);
}
-
- error = FT_Get_Kerning (face, left, right,
- ft_kerning_default, &kerning);
- if (error != FT_Err_Ok)
- kerning.x = 0;
-
+
pango_fc_font_unlock_face (font);
-
- return PANGO_UNITS_26_6 (kerning.x);
}
/**