#include <otf.h>
#define PROGNAME "flt-otf"
-#else /* defined (FLT_HB) */
+#elif defined (FLT_HB)
#include <m17n-flt.h>
#include <harfbuzz.h>
#define PROGNAME "flt-hb"
+#else (defined (FLT_PANGO))
+
+#include <m17n-flt.h>
+#include <pango/pango-engine.h>
+#include <pango/pango-ot.h>
+#include <pango/pango-utils.h>
+
#endif
static FT_Library ft_library;
return 0;
}
-#else /* FLT_OTF or FLT_HB */
+#elif defined (FLT_OTF) || defined (FLT_HB)
typedef struct {
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