From aeff06da193c423a9be2ecdaecd788910b669bf1 Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 30 Aug 2007 13:05:18 +0000 Subject: [PATCH] *** empty log message *** --- flt.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/flt.c b/flt.c index 100f1ac..963209b 100644 --- a/flt.c +++ b/flt.c @@ -17,12 +17,19 @@ #include #define PROGNAME "flt-otf" -#else /* defined (FLT_HB) */ +#elif defined (FLT_HB) #include #include #define PROGNAME "flt-hb" +#else (defined (FLT_PANGO)) + +#include +#include +#include +#include + #endif static FT_Library ft_library; @@ -142,7 +149,7 @@ flt (MText *mt, int from, int to, MFLTFont *font, char *flt_name) return 0; } -#else /* FLT_OTF or FLT_HB */ +#elif defined (FLT_OTF) || defined (FLT_HB) typedef struct { MFLTFont font; @@ -973,6 +980,45 @@ close_font (MFLTFont *font) } #endif + +#else /* (defined (FLT_PANGO) */ + +typedef struct { + MFLTFont font; + PangoFcFont pango_fc_font; +} FontInfoPango; + +int +get_glyph_id (MFLTFont *font, MFLTGlyph *g) +{ + FontInfoPango *font_info = (FontInfoPango *) font; + PangoGlyph pg = pango_fc_font_get_glyph (font_info->pango_fc_font, g->c); + + return (pg ? (int) pg : -1); +} + +int +get_metric (MFLTFont *font, MFLTGlyphString *gstring, int form, int to) +{ + FontInfoPango *font_info = (FontInfoPango *) font; + PangoFcFont fc_font = font_info->pango_fc_font; + int i; + + for (i = from; i < to; i++) + { + PangoRectangle inc, logical; + + pango_font_get_glyph_extents ((PangoFont *) fc_font, + gstring->glyphs[i].code, &inc, &logical); + g->lbearing = inc.x; + g->rbearing = inc.x + inc.width; + g->xadv = logical.width; + g->yadv = 0; + g->ascent = - inc.y; + g->descent = inc.height + inc.y; + } +} + #endif int -- 1.7.10.4