X-Git-Url: http://git.chise.org/gitweb/?p=m17n%2Fm17n-test.git;a=blobdiff_plain;f=flt.c;h=23d894a9a9727c2b5497172b5e14a7bb332d7c0e;hp=5756bd31229452cece1da785dfbc07dbdf0110c4;hb=5b15d5cd2f8cd4505328f2b99f270caf61d734af;hpb=874557fa6f54bf924a35fe9e50ea0929a76baa24 diff --git a/flt.c b/flt.c index 5756bd3..23d894a 100644 --- a/flt.c +++ b/flt.c @@ -32,8 +32,11 @@ #include #include #include + #endif +#include + static FT_Library ft_library; int @@ -1357,6 +1360,7 @@ main (int argc, char **argv) MText *mt; MFLTFont *font; int len, i, j; + unsigned char *buf; if (argc < 3) { @@ -1379,7 +1383,14 @@ main (int argc, char **argv) font->get_metrics = get_metrics; font->drive_otf = drive_otf; - mt = mconv_decode_stream (msymbol ("utf-8"), stdin); + i = 0; + buf = malloc (4096); + while ((j = fread (buf + i, 1, 4096, stdin)) == 4096) + { + i += 4096; + buf = realloc (buf, i + 4096); + } + mt = mtext_from_data (buf, i, MTEXT_FORMAT_UTF_8); len = mtext_len (mt); for (i = 0, j = mtext_character (mt, i, len, '\n'); i < len; i = j + 1, j = mtext_character (mt, i, len, '\n')) @@ -1397,6 +1408,7 @@ main (int argc, char **argv) i = j; } m17n_object_unref (mt); + free (buf); close_font (font); M17N_FINI (); return 0;