5 #include FT_TRUETYPE_TABLES_H
6 #include <fontconfig/fontconfig.h>
7 #include <fontconfig/fcfreetype.h>
12 #define PROGNAME "flt-gui"
14 #elif defined (FLT_OTF)
18 #define PROGNAME "flt-otf"
20 #else /* defined (FLT_HB) */
24 #define PROGNAME "flt-hb"
28 static FT_Library ft_library;
31 new_face (char *fontname, char **err)
40 pat = FcNameParse ((FcChar8 *) fontname);
43 *err = "invalid name format";
46 if (FcPatternGetString (pat, FC_FAMILY, 0, &fam) != FcResultMatch)
48 *err = "no family name";
51 if (FcPatternGetDouble (pat, FC_PIXEL_SIZE, 0, &pixelsize) != FcResultMatch)
53 FcPatternAddBool (pat, FC_SCALABLE, FcTrue);
54 FcPatternDel (pat, FC_PIXEL_SIZE);
55 os = FcObjectSetBuild (FC_FILE, NULL);
56 fs = FcFontList (NULL, pat, os);
59 *err = "no matching font";
62 FcPatternGetString (fs->fonts[0], FC_FILE, 0, &file);
64 if (FT_New_Face (ft_library, (char *) file, 0, &face))
66 FcFontSetDestroy (fs);
67 FcObjectSetDestroy (os);
68 FcPatternDestroy (pat);
69 *err = "font open fail";
72 FcFontSetDestroy (fs);
73 FcObjectSetDestroy (os);
74 FcPatternDestroy (pat);
75 if (FT_Set_Pixel_Sizes (face, pixelsize, pixelsize))
77 *err = "set pixelsize fail";
95 open_font (char *fontname, char **err)
97 FT_Face ft_face = new_face (fontname, err);
107 fontset = mfontset ("generic");
108 mface_put_prop (face, Mfontset, fontset);
109 mplist_add (plist, Mface, face);
110 mplist_add (plist, Mdevice, Mnil);
111 frame = mframe (plist);
112 m17n_object_unref (plist);
113 m17n_object_unref (face);
114 m17n_object_unref (fontset);
116 font = calloc (1, sizeof (MFLTFont));
117 font->font = mfont_encapsulate (frame, Mfreetype, ft_face);
118 font->face = ft_face;
123 close_font (MFLTFont *font)
125 FT_Done_Face (font->face);
127 m17n_object_unref (frame);
131 flt (MText *mt, int from, int to, MFLTFont *font, char *flt_name)
133 MDrawControl control;
135 memset (&control, 0, sizeof (MDrawControl));
136 control.two_dimensional = 1;
137 control.enable_bidi = 1;
138 control.anti_alias = 1;
139 /*control.disable_caching = 1;*/
140 mtext_put_prop (mt, from, to, Mfont, font->font);
141 mdraw_text_extents (frame, mt, from, to, &control, NULL, NULL, NULL);
145 #else /* FLT_OTF or FLT_HB */
153 get_glyph_id (MFLTFont *font, MFLTGlyph *g)
155 FT_Face face = ((FontInfo *) font)->face;
157 g->code = FT_Get_Char_Index (face, g->code);
159 return (g->code ? 0 : -1);
163 get_metric (MFLTFont *font, MFLTGlyphString *gstring, int from, int to)
165 FT_Face face = ((FontInfo *) font)->face;
167 for (; from < to; from++)
169 MFLTGlyph *g = gstring->glyphs + from;
170 FT_Glyph_Metrics *metrics;
172 if (FT_Load_Glyph (face, g->code, FT_LOAD_DEFAULT))
174 metrics = &face->glyph->metrics;
175 g->lbearing = metrics->horiBearingX;
176 g->rbearing = metrics->horiBearingX + metrics->width;
177 g->xadv = metrics->horiAdvance;
178 g->yadv = metrics->vertAdvance;
179 g->ascent = metrics->horiBearingY;
180 g->descent = metrics->height - metrics->horiBearingY;
186 flt (MText *mt, int from, int to, MFLTFont *font, char *flt_name)
188 MFLTGlyphString gstring;
192 memset (&gstring, 0, sizeof (MFLTGlyphString));
193 gstring.glyph_size = sizeof (MFLTGlyph);
194 gstring.allocated = len * 2;
195 gstring.glyphs = alloca (sizeof (MFLTGlyph) * gstring.allocated);
196 for (i = 0; i < len; i++)
197 gstring.glyphs[i].c = mtext_ref_char (mt, from + i);
199 return mflt_run (&gstring, 0, len, font, msymbol (flt_name));
210 #define DEVICE_DELTA(table, size) \
211 (((size) >= (table).StartSize && (size) <= (table).EndSize) \
212 ? ((table).DeltaValue[(size) - (table).StartSize] << 6) \
216 adjust_anchor (OTF_Anchor *anchor, FT_Face face,
217 unsigned code, unsigned x_ppem, unsigned y_ppem, int *x, int *y)
219 if (anchor->AnchorFormat == 2)
222 int ap = anchor->f.f1.AnchorPoint;
224 FT_Load_Glyph (face, (FT_UInt) code, FT_LOAD_MONOCHROME);
225 outline = &face->glyph->outline;
226 if (ap < outline->n_points)
228 *x = outline->points[ap].x;
229 *y = outline->points[ap].y;
232 else if (anchor->AnchorFormat == 3)
234 if (anchor->f.f2.XDeviceTable.offset)
235 *x += DEVICE_DELTA (anchor->f.f2.XDeviceTable, x_ppem);
236 if (anchor->f.f2.YDeviceTable.offset)
237 *y += DEVICE_DELTA (anchor->f.f2.YDeviceTable, y_ppem);
242 tag_name (char *str, unsigned tag)
245 *str++ = (tag >> 16) & 0xFF;
246 *str++ = (tag >> 8) & 0xFF;
252 encode_features (char *str, int count, unsigned *features)
257 for (i = 0; i < count; i++)
259 unsigned tag = features[i];
269 str = tag_name (str, tag);
282 drive_otf (MFLTFont *font, MFLT_OTF_Spec *spec,
283 MFLTGlyphString *in, int from, int to,
284 MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
288 OTF *otf = ((FontInfoOTF *) font)->otf;
289 OTF_GlyphString otf_gstring;
291 char script[4], langsys[4];
292 char *gsub_features = NULL, *gpos_features = NULL;
299 otf_gstring.glyphs = NULL;
300 if (OTF_get_table (otf, "head") < 0)
303 ((FontInfoOTF *) font)->otf = NULL;
307 tag_name (script, spec->script);
308 tag_name (langsys, spec->langsys);
310 if (spec->gsub_count > 0)
312 gsub_features = alloca (6 * spec->gsub_count);
315 if (OTF_check_table (otf, "GSUB") < 0)
316 gsub_features = NULL;
318 encode_features (gsub_features, spec->gsub_count, spec->gsub);
321 if (spec->gpos_count)
323 gpos_features = alloca (6 * spec->gpos_count);
326 if (OTF_check_table (otf, "GPOS") < 0)
327 gpos_features = NULL;
329 encode_features (gpos_features, spec->gpos_count, spec->gpos);
333 otf_gstring.size = otf_gstring.used = len;
334 otf_gstring.glyphs = (OTF_Glyph *) malloc (sizeof (OTF_Glyph) * len);
335 memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * len);
336 for (i = 0; i < len; i++)
338 otf_gstring.glyphs[i].c = in->glyphs[from + i].c;
339 otf_gstring.glyphs[i].glyph_id = in->glyphs[from + i].code;
342 OTF_drive_gdef (otf, &otf_gstring);
347 if (OTF_drive_gsub (otf, &otf_gstring, script, langsys, gsub_features)
350 if (out->allocated < out->used + otf_gstring.used)
352 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, otfg++)
354 MFLTGlyph *g = out->glyphs + out->used;
356 *g = in->glyphs[from + otfg->f.index.from];
358 g->code = otfg->glyph_id;
364 if (out->allocated < out->used + len)
366 for (i = 0; i < len; i++)
367 out->glyphs[out->used++] = in->glyphs[from + i];
370 font->get_metric (font, out, gidx, out->used);
375 MFLTGlyph *base = NULL, *mark = NULL, *g;
376 int x_ppem, y_ppem, x_scale, y_scale;
378 if (OTF_drive_gpos (otf, &otf_gstring, script, langsys, gpos_features)
382 face = ((FontInfo *) font)->face;
383 x_ppem = face->size->metrics.x_ppem;
384 y_ppem = face->size->metrics.y_ppem;
385 x_scale = face->size->metrics.x_scale;
386 y_scale = face->size->metrics.y_scale;
388 for (i = 0, otfg = otf_gstring.glyphs, g = out->glyphs + gidx;
389 i < otf_gstring.used; i++, otfg++, g++)
393 if (! otfg->glyph_id)
395 switch (otfg->positioning_type)
401 int format = otfg->f.f1.format;
403 if (format & OTF_XPlacement)
405 = otfg->f.f1.value->XPlacement * x_scale / 0x10000;
406 if (format & OTF_XPlaDevice)
408 += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem);
409 if (format & OTF_YPlacement)
411 = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000);
412 if (format & OTF_YPlaDevice)
414 -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem);
415 if (format & OTF_XAdvance)
417 += otfg->f.f1.value->XAdvance * x_scale / 0x10000;
418 if (format & OTF_XAdvDevice)
420 += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem);
421 if (format & OTF_YAdvance)
423 += otfg->f.f1.value->YAdvance * y_scale / 0x10000;
424 if (format & OTF_YAdvDevice)
426 += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem);
427 adjustment[i].set = 1;
431 /* Not yet supported. */
437 goto label_adjust_anchor;
438 default: /* i.e. case 6 */
445 int base_x, base_y, mark_x, mark_y;
447 base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000;
448 base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000;
449 mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000;
450 mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000;;
452 if (otfg->f.f4.base_anchor->AnchorFormat != 1)
453 adjust_anchor (otfg->f.f4.base_anchor, face, prev->code,
454 x_ppem, y_ppem, &base_x, &base_y);
455 if (otfg->f.f4.mark_anchor->AnchorFormat != 1)
456 adjust_anchor (otfg->f.f4.mark_anchor, face, g->code,
457 x_ppem, y_ppem, &mark_x, &mark_y);
458 adjustment[i].xoff = (base_x - mark_x);
459 adjustment[i].yoff = - (base_y - mark_y);
460 adjustment[i].back = (g - prev);
461 adjustment[i].set = 1;
464 if (otfg->GlyphClass == OTF_GlyphClass0)
466 else if (otfg->GlyphClass == OTF_GlyphClassMark)
472 free (otf_gstring.glyphs);
476 font->get_metric (font, in, from, to);
477 for (i = 0; i < len; i++)
479 MFLTGlyph *g = in->glyphs + (from + i);
481 out->glyphs[out->used++] = *g;
483 if (otf_gstring.glyphs)
484 free (otf_gstring.glyphs);
489 open_font (char *fontname, char **err)
491 FT_Face face = new_face (fontname, err);
492 FontInfoOTF *font_info;
496 font_info = malloc (sizeof (FontInfoOTF));
497 font_info->font.get_glyph_id = get_glyph_id;
498 font_info->font.get_metric = get_metric;
499 font_info->font.drive_otf = drive_otf;
500 font_info->face = face;
501 font_info->otf = OTF_open_ft_face (face);
502 return ((MFLTFont *) font_info);
506 close_font (MFLTFont *font)
508 FontInfoOTF *font_info = (FontInfoOTF *) font;
510 OTF_close (font_info->otf);
511 FT_Done_Face (font_info->face);
531 HB_StreamRec gdef_stream;
535 MPlist *otf_spec_cache;
539 convertStringToGlyphIndices (HB_Font font, const HB_UChar16 *string,
540 hb_uint32 length, HB_Glyph *glyphs,
541 hb_uint32 *numGlyphs, HB_Bool rightToLeft)
547 getGlyphAdvances (HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs,
548 HB_Fixed *advances, int flags /*HB_ShaperFlag*/)
552 for (i = 0; i < numGlyphs; i++)
557 canRender (HB_Font font, const HB_UChar16 *string, hb_uint32 length)
563 getPointInOutline (HB_Font font, HB_Glyph glyph, int flags /*HB_ShaperFlag*/,
564 hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos,
567 FT_Face face = font->faceData;
570 if ((error = (HB_Error) FT_Load_Glyph (face, glyph, flags)))
572 if (face->glyph->format != ft_glyph_format_outline)
573 return (HB_Error) HB_Err_Invalid_GPOS_SubTable;
574 *nPoints = face->glyph->outline.n_points;
577 if (point > *nPoints)
578 return (HB_Error) HB_Err_Invalid_GPOS_SubTable;
580 *xpos = face->glyph->outline.points[point].x;
581 *ypos = face->glyph->outline.points[point].y;
587 getGlyphMetrics (HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
592 getFontMetric (HB_Font font, HB_FontMetric metric)
597 #define MAKE_TAG(name) ((((FT_ULong) (name)[0]) << 24) \
598 | (((FT_ULong) (name)[1]) << 16) \
599 | (((FT_ULong) (name)[2]) << 8) \
603 new_stream (FT_Face face, char *tagname, HB_Stream stream)
605 FT_ULong tag = MAKE_TAG (tagname);
609 if (! FT_IS_SFNT (face))
610 return HB_Err_Invalid_Argument;
612 if (FT_Load_Sfnt_Table (face, tag, 0, NULL, &len))
613 return HB_Err_Table_Missing;
616 return HB_Err_Out_Of_Memory;
617 if (FT_Load_Sfnt_Table (face, tag, 0, buf, &len))
620 return HB_Err_Table_Missing;
622 stream->base = (HB_Byte *) buf;
625 stream->cursor = NULL;
631 load_gdef (FontInfoHB *font_info)
635 if (! font_info->gdef_stream.base)
637 err = new_stream ((FT_Face) font_info->hb_font.faceData, "GDEF",
638 &font_info->gdef_stream);
639 if (err != HB_Err_Ok)
642 return HB_Load_GDEF_Table (&font_info->gdef_stream, &font_info->gdef);
646 load_gsub (FontInfoHB *font_info)
650 HB_LookupList *lookup_list;
653 if (! font_info->gdef)
655 if ((err = load_gdef (font_info)) != HB_Err_Ok)
658 err = new_stream ((FT_Face) font_info->hb_font.faceData, "GSUB", &stream);
659 if (err != HB_Err_Ok)
661 err = HB_Load_GSUB_Table (&stream, &font_info->gsub,
662 font_info->gdef, &font_info->gdef_stream);
664 lookup_list = &font_info->gsub->LookupList;
665 for (i = 0; i < lookup_list->LookupCount; i++)
666 lookup_list->Properties[i] = HB_GLYPH_PROPERTIES_UNKNOWN;
671 load_gpos (FontInfoHB *font_info)
675 HB_LookupList *lookup_list;
678 if (! font_info->gdef)
680 if ((err = load_gdef (font_info)) != HB_Err_Ok)
683 err = new_stream ((FT_Face) font_info->hb_font.faceData, "GPOS", &stream);
684 if (err != HB_Err_Ok)
686 err = HB_Load_GPOS_Table (&stream, &font_info->gpos,
687 font_info->gdef, &font_info->gdef_stream);
689 lookup_list = &font_info->gpos->LookupList;
690 for (i = 0; i < lookup_list->LookupCount; i++)
691 lookup_list->Properties[i] = HB_GLYPH_PROPERTIES_UNKNOWN;
695 const HB_FontClass hb_fontClass = {
696 convertStringToGlyphIndices, getGlyphAdvances, canRender,
697 getPointInOutline, getGlyphMetrics, getFontMetric
701 setup_features (int gsubp, FontInfoHB *font_info, MFLT_OTF_Spec *spec,
704 int count, preordered;
705 unsigned int *features;
706 FT_UShort script, langsys;
707 FT_UShort req_feature, index;
708 FT_UInt *feature_list;
714 if (! font_info->gsub)
716 if ((err = load_gsub (font_info)) != HB_Err_Ok)
719 if ((err = HB_GSUB_Select_Script (font_info->gsub, spec->script, &script))
724 if ((err = HB_GSUB_Select_Language (font_info->gsub, spec->langsys,
725 script, &langsys, &req_feature))
730 langsys = req_feature = 0xFFFF;
731 count = spec->gsub_count;
732 features = spec->gsub;
736 if (! font_info->gpos)
738 if ((err = load_gpos (font_info)) != HB_Err_Ok)
741 if ((err = HB_GPOS_Select_Script (font_info->gpos, spec->script, &script))
746 if ((err = HB_GPOS_Select_Language (font_info->gpos, spec->langsys,
747 script, &langsys, &req_feature))
752 langsys = req_feature = 0xFFFF;
753 count = spec->gpos_count;
754 features = spec->gpos;
757 for (preordered = 0; preordered < count; preordered++)
758 if (features[preordered] == 0)
761 ? HB_GSUB_Query_Features (font_info->gsub, script, langsys,
763 : HB_GPOS_Query_Features (font_info->gpos, script, langsys,
770 for (i = 0; feature_list[i]; i++);
773 info->indices = malloc (sizeof (FT_UShort) * ((req_feature != 0xFFFF) + i));
775 if (req_feature != 0xFFFF)
776 info->indices[i++] = req_feature;
777 for (j = 0; j < preordered; j++)
779 ? HB_GSUB_Select_Feature (font_info->gsub, features[j],
780 script, langsys, &index)
781 : HB_GPOS_Select_Feature (font_info->gpos, features[j],
782 script, langsys, &index)))
784 info->indices[i++] = index;
786 for (j = 0; feature_list[j]; j++)
788 for (k = preordered + 1; k < count; k++)
789 if (feature_list[j] == features[k])
793 ? HB_GSUB_Select_Feature (font_info->gsub, feature_list[j],
794 script, langsys, &index)
795 : HB_GPOS_Select_Feature (font_info->gpos, feature_list[j],
796 script, langsys, &index))
798 info->indices[i++] = index;
805 setup_otf_spec (MFLTFont *font, MFLT_OTF_Spec *spec)
807 FontInfoHB *font_info = (FontInfoHB *) font;
810 if (spec->gsub_count + spec->gpos_count == 0)
812 ginfo = mplist_get (font_info->otf_spec_cache, spec->sym);
814 return (ginfo->gsub.count + ginfo->gpos.count > 0 ? ginfo : NULL);
815 ginfo = calloc (1, sizeof (GsubGposInfo));
816 mplist_push (font_info->otf_spec_cache, spec->sym, ginfo);
817 if (setup_features (1, font_info, spec, &(ginfo->gsub)) != HB_Err_Ok)
819 if (setup_features (0, font_info, spec, &(ginfo->gpos)) != HB_Err_Ok)
825 drive_otf (MFLTFont *font, MFLT_OTF_Spec *spec,
826 MFLTGlyphString *in, int from, int to,
827 MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
829 FontInfoHB *font_info = (FontInfoHB *) font;
834 HB_UShort *apply_order_save;
835 HB_UShort apply_count_save;
836 int gpos_applied = 0;
843 if (hb_buffer_new (&buf) != FT_Err_Ok)
845 for (i = from; i < to; i++)
847 if (hb_buffer_add_glyph (buf, in->glyphs[i].code, 0, i) != FT_Err_Ok)
850 ginfo = setup_otf_spec (font, spec);
853 if (ginfo->gsub.count > 0)
855 if (! font_info->gdef
856 && load_gdef (font_info) != HB_Err_Ok)
858 apply_order_save = font_info->gsub->FeatureList.ApplyOrder;
859 apply_count_save = font_info->gsub->FeatureList.ApplyCount;
860 font_info->gsub->FeatureList.ApplyOrder = ginfo->gsub.indices;
861 font_info->gsub->FeatureList.ApplyCount = ginfo->gsub.count;
862 err = HB_GSUB_Apply_String (font_info->gsub, buf);
863 font_info->gsub->FeatureList.ApplyOrder = apply_order_save;
864 font_info->gsub->FeatureList.ApplyCount = apply_count_save;
865 if (err != HB_Err_Ok && err != HB_Err_Not_Covered)
867 if (out->used + buf->in_length > out->allocated)
871 if (ginfo->gpos.count > 0
872 && (font_info->gpos || load_gpos (font_info) == HB_Err_Ok))
874 apply_order_save = font_info->gpos->FeatureList.ApplyOrder;
875 apply_count_save = font_info->gpos->FeatureList.ApplyCount;
876 font_info->gpos->FeatureList.ApplyOrder = ginfo->gpos.indices;
877 font_info->gpos->FeatureList.ApplyCount = ginfo->gpos.count;
878 err = HB_GPOS_Apply_String (&font_info->hb_font, font_info->gpos,
879 FT_LOAD_DEFAULT, buf, FALSE, FALSE);
880 font_info->gpos->FeatureList.ApplyOrder = apply_order_save;
881 font_info->gpos->FeatureList.ApplyCount = apply_count_save;
882 if (err == HB_Err_Ok)
888 for (i = 0; i < buf->in_length; i++)
890 HB_GlyphItem hg = buf->in_string + i;
891 HB_Position pos = buf->positions + i;
894 out->glyphs[out->used] = in->glyphs[hg->cluster];
895 g = out->glyphs + out->used++;
896 if (g->code != hg->gindex)
897 g->c = 0, g->code = hg->gindex;
898 adjustment[i].set = gpos_applied;
901 adjustment[i].xadv = pos->x_advance;
902 adjustment[i].yadv = pos->y_advance;
903 adjustment[i].xoff = pos->x_pos;
904 adjustment[i].yoff = - pos->y_pos;
905 adjustment[i].back = pos->back;
906 adjustment[i].advance_is_absolute = pos->new_advance;
913 hb_buffer_free (buf);
914 for (i = 0; i < len; i++)
915 out->glyphs[out->used++] = in->glyphs[from + i];
920 open_font (char *fontname, char **err)
922 FT_Face face = new_face (fontname, err);
923 FontInfoHB *font_info;
927 font_info = calloc (1, sizeof (FontInfoHB));
928 font_info->font.get_glyph_id = get_glyph_id;
929 font_info->font.get_metric = get_metric;
930 font_info->font.drive_otf = drive_otf;
931 font_info->face = face;
932 font_info->hb_font.klass = &hb_fontClass;
933 font_info->hb_font.faceData = face;
934 font_info->hb_font.userData = NULL;
935 font_info->hb_font.x_ppem = face->size->metrics.x_ppem;
936 font_info->hb_font.x_scale = face->size->metrics.x_scale;
937 font_info->hb_font.y_scale = face->size->metrics.y_scale;
938 font_info->hb_font.y_ppem = face->size->metrics.y_ppem;
939 font_info->otf_spec_cache = mplist ();
940 return ((MFLTFont *) font_info);
944 close_font (MFLTFont *font)
946 FontInfoHB *font_info = (FontInfoHB *) font;
951 HB_Done_GDEF_Table (font_info->gdef);
952 free (font_info->gdef_stream.base);
955 HB_Done_GSUB_Table (font_info->gsub);
957 HB_Done_GPOS_Table (font_info->gpos);
958 FT_Done_Face ((FT_Face) (font_info->hb_font.faceData));
959 for (p = font_info->otf_spec_cache; mplist_key (p) != Mnil;
962 GsubGposInfo *ginfo = mplist_value (p);
964 if (ginfo->gsub.count > 0)
965 free (ginfo->gsub.indices);
966 if (ginfo->gpos.count > 0)
967 free (ginfo->gpos.indices);
969 m17n_object_unref (font_info->otf_spec_cache);
977 main (int argc, char **argv)
979 char *font_name, *flt_name;
987 fprintf (stderr, "Usage: flt FONT-NAME FLT-NAME < TEXT-FILE\n");
994 FT_Init_FreeType (&ft_library);
996 font = open_font (font_name, &err);
999 fprintf (stderr, "Font error: %s: %s\n", argv[1], err);
1003 mt = mconv_decode_stream (msymbol ("utf-8"), stdin);
1004 len = mtext_len (mt);
1005 for (i = 0, j = mtext_character (mt, i, len, '\n'); i < len;
1006 i = j + 1, j = mtext_character (mt, i, len, '\n'))
1010 if (flt (mt, i, j, font, flt_name) < 0)
1012 fprintf (stderr, "Error in FLT processing.\n");
1016 m17n_object_unref (mt);