PKG_CHECK_MODULES(M17NGUI, m17n-gui)
PKG_CHECK_MODULES(M17NFLT, m17n-flt)
PKG_CHECK_MODULES(OTF, libotf)
-PKG_CHECK_MODULES(PANGO, pangoft2)
+PKG_CHECK_MODULES(PANGO, pangocairo)
-AC_ARG_WITH(harfbuzz, [Harfbuzz source directory], HBDIR="$withval", HBDIR="../harfbuzz")
-if test -d "$HBDIR/src/.libs"; then
- HB_CFLAGS="-I$HBDIR/src"
- for o in global open stream buffer gdef gsub gpos; do
- HB_LIBS="$HB_LIBS $HBDIR/src/.libs/harfbuzz-$o.o"
- done
+AC_ARG_WITH(harfbuzz, [Harfbuzz source directory],
+ HBDIR="$withval",
+ HBDIR="../pango/pango/opentype")
+if test -d "$HBDIR"; then
+ HB_CFLAGS="-I$HBDIR"
+ HB_LIBS="-l$HBDIR/libharfbuzz.la"
fi
AC_SUBST(HB_CFLAGS)
#elif defined (FLT_HB)
#include <m17n-flt.h>
-#include <harfbuzz.h>
+#include <hb.h>
#define PROGNAME "flt-hb"
#else /* (defined (FLT_PANGO)) */
#include <m17n-flt.h>
#define PANGO_ENABLE_ENGINE
#define PANGO_ENABLE_BACKEND
-#include <pango/pango.h>
+#include <pango/pangcairo.h>
#include <pango/pango-ot.h>
-#include <pango/pangoft2.h>
-#include <pango/pangofc-font.h>
#endif
*str = '\0';
}
+static OTF_GlyphString otf_gstring;
+
+static void
+setup_otf_gstring (int size)
+{
+ if (otf_gstring.size == 0)
+ {
+ otf_gstring.glyphs = (OTF_Glyph *) xmalloc (sizeof (OTF_Glyph) * size);
+ otf_gstring.size = size;
+ }
+ else if (otf_gstring.size < size)
+ {
+ otf_gstring.glyphs = xrealloc (otf_gstring.glyphs,
+ sizeof (OTF_Glyph) * size);
+ otf_gstring.size = size;
+ }
+ otf_gstring.used = size;
+ memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * size);
+}
+
int
drive_otf (MFLTFont *font, MFLTOtfSpec *spec,
MFLTGlyphString *in, int from, int to,
MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
{
- int len = to - from;
- int i, gidx;
OTF *otf = ((FontInfoOTF *) font)->otf;
- OTF_GlyphString otf_gstring;
+ int len = to - from;
+ int i, j, gidx;
OTF_Glyph *otfg;
- char script[4], langsys[4];
+ char script[5], *langsys = NULL;
char *gsub_features = NULL, *gpos_features = NULL;
if (len == 0)
return from;
- if (! otf)
- goto simple_copy;
- otf_gstring.glyphs = NULL;
- if (OTF_get_table (otf, "head") < 0)
- {
- OTF_close (otf);
- ((FontInfoOTF *) font)->otf = NULL;
- goto simple_copy;
- }
-
- tag_name (script, spec->script);
- tag_name (langsys, spec->langsys);
-
- if (spec->gsub_count > 0)
+ OTF_tag_name (spec->script, script);
+ if (spec->langsys)
{
- gsub_features = alloca (6 * spec->gsub_count);
- if (gsub_features)
- {
- if (OTF_check_table (otf, "GSUB") < 0)
- gsub_features = NULL;
- else
- encode_features (gsub_features, spec->gsub_count, spec->gsub);
- }
+ langsys = alloca (5);
+ OTF_tag_name (spec->langsys, langsys);
}
- if (spec->gpos_count)
+ for (i = 0; i < 2; i++)
{
- gpos_features = alloca (6 * spec->gpos_count);
- if (gpos_features)
+ char *p;
+
+ if (spec->features[i] && spec->features[i][1] != 0xFFFFFFFF)
{
- if (OTF_check_table (otf, "GPOS") < 0)
- gpos_features = NULL;
+ for (j = 0; spec->features[i][j]; j++);
+ if (i == 0)
+ p = gsub_features = alloca (6 * j);
else
- encode_features (gpos_features, spec->gpos_count, spec->gpos);
+ p = gpos_features = alloca (6 * j);
+ for (j = 0; spec->features[i][j]; j++)
+ {
+ if (spec->features[i][j] == 0xFFFFFFFF)
+ *p++ = '*', *p++ = ',';
+ else
+ {
+ OTF_tag_name (spec->features[i][j], p);
+ p[4] = ',';
+ p += 5;
+ }
+ }
+ *--p = '\0';
}
}
- otf_gstring.size = otf_gstring.used = len;
- otf_gstring.glyphs = (OTF_Glyph *) malloc (sizeof (OTF_Glyph) * len);
- memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * len);
+ setup_otf_gstring (len);
for (i = 0; i < len; i++)
{
otf_gstring.glyphs[i].c = in->glyphs[from + i].c;
font_info = malloc (sizeof (FontInfoOTF));
font_info->face = face;
font_info->otf = OTF_open_ft_face (face);
+ if (OTF_get_table (font_info->otf, "head") < 0)
+ {
+ OTF_close (font_info->otf);
+ FT_Done_Face (font_info->face);
+ free (font_info);
+ return NULL;
+ }
return ((MFLTFont *) font_info);
}
#include <stdio.h>
#include <string.h>
#include <m17n.h>
-#include <m17n-misc.h>
int
main (int argc, char **argv)
{
- MSymbol lang;
MPlist *imlist, *pl;
M17N_INIT ();
- lang = (argc > 1) ? msymbol (argv[1]) : Mnil;
- imlist = minput_list (lang);
+ imlist = minput_list ((argc > 1) ? msymbol (argv[1]) : Mnil);
for (pl = imlist; mplist_key (pl) != Mnil; pl = mplist_next (pl))
{
MPlist *p = mplist_value (pl);
- MSymbol name;
+ MSymbol lang, name, sane;
lang = mplist_value (p);
p = mplist_next (p);
name = mplist_value (p);
+ p = mplist_next (p);
+ sane = mplist_value (p);
- printf ("%s %s\n", msymbol_name (lang), msymbol_name (name));
+ printf ("%s %s %s\n", msymbol_name (lang), msymbol_name (name),
+ sane == Mt ? "ok" : "no");
}
m17n_object_unref (imlist);