From: handa Date: Tue, 22 Mar 2011 03:39:48 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd803399122dd9368b95036960dd3b130381db4e;p=m17n%2Fm17n-test.git *** empty log message *** --- diff --git a/Makefile.am b/Makefile.am index 55bd14b..4b99da3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ noinst_PROGRAMS = \ linebreak replace mimdemo mimdaemon fifotest1 fifotest2 imlist\ imtest findfont gdkdraw finddb imsim langname viewfile pangotest \ flt-gui flt-otf flt-hb flt-pango find-flt test key-aliases conv-by-im \ - mim-xml reader2 + mim-xml reader2 test mimdemo_LDADD = -lgd mimdaemon_LDADD = -lgd diff --git a/configure.ac b/configure.ac index 371ecaf..4b5dd7b 100644 --- a/configure.ac +++ b/configure.ac @@ -10,14 +10,14 @@ PKG_CHECK_MODULES(M17N, m17n-shell) 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) diff --git a/flt.c b/flt.c index 23d894a..884782a 100644 --- a/flt.c +++ b/flt.c @@ -20,7 +20,7 @@ #elif defined (FLT_HB) #include -#include +#include #define PROGNAME "flt-hb" #else /* (defined (FLT_PANGO)) */ @@ -28,10 +28,8 @@ #include #define PANGO_ENABLE_ENGINE #define PANGO_ENABLE_BACKEND -#include +#include #include -#include -#include #endif @@ -303,61 +301,74 @@ encode_features (char *str, int count, unsigned *features) *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; @@ -530,6 +541,13 @@ open_font (char *fontname, char **err) 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); } diff --git a/imlist.c b/imlist.c index 3735c92..3ea2172 100644 --- a/imlist.c +++ b/imlist.c @@ -1,27 +1,27 @@ #include #include #include -#include 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);