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 mtext_put_prop (mt, from, to, Mfont, font->font);
134 mdraw_text_extents (frame, mt, from, to, NULL, NULL, NULL, NULL);
138 #else /* FLT_OTF or FLT_HB */
147 get_glyph_id (MFLTFont *font, MFLTGlyph *g)
149 FT_Face face = ((FontInfo *) font)->face;
151 g->code = FT_Get_Char_Index (face, g->code);
153 return (g->code ? 0 : -1);
157 get_metric (MFLTFont *font, MFLTGlyphString *gstring, int from, int to)
159 FT_Face face = ((FontInfo *) font)->face;
161 for (; from < to; from++)
163 MFLTGlyph *g = gstring->glyphs + from;
164 FT_Glyph_Metrics *metrics;
166 if (FT_Load_Glyph (face, g->code, FT_LOAD_DEFAULT))
168 metrics = &face->glyph->metrics;
169 g->lbearing = metrics->horiBearingX;
170 g->rbearing = metrics->horiBearingX + metrics->width;
171 g->xadv = metrics->horiAdvance;
172 g->yadv = metrics->vertAdvance;
173 g->ascent = metrics->horiBearingY;
174 g->descent = metrics->height - metrics->horiBearingY;
180 flt (MText *mt, int from, int to, MFLTFont *font, char *flt_name)
182 MFLTGlyphString gstring;
186 memset (&gstring, 0, sizeof (MFLTGlyphString));
187 gstring.glyph_size = sizeof (MFLTGlyph);
188 gstring.allocated = len * 2;
189 gstring.glyphs = alloca (sizeof (MFLTGlyph) * gstring.allocated);
190 for (i = 0; i < len; i++)
191 gstring.glyphs[i].c = mtext_ref_char (mt, from + i);
193 return mflt_run (&gstring, 0, len, font, msymbol (flt_name));
204 #define DEVICE_DELTA(table, size) \
205 (((size) >= (table).StartSize && (size) <= (table).EndSize) \
206 ? ((table).DeltaValue[(size) - (table).StartSize] << 6) \
210 adjust_anchor (OTF_Anchor *anchor, FT_Face face,
211 unsigned code, unsigned x_ppem, unsigned y_ppem, int *x, int *y)
213 if (anchor->AnchorFormat == 2)
216 int ap = anchor->f.f1.AnchorPoint;
218 FT_Load_Glyph (face, (FT_UInt) code, FT_LOAD_MONOCHROME);
219 outline = &face->glyph->outline;
220 if (ap < outline->n_points)
222 *x = outline->points[ap].x;
223 *y = outline->points[ap].y;
226 else if (anchor->AnchorFormat == 3)
228 if (anchor->f.f2.XDeviceTable.offset)
229 *x += DEVICE_DELTA (anchor->f.f2.XDeviceTable, x_ppem);
230 if (anchor->f.f2.YDeviceTable.offset)
231 *y += DEVICE_DELTA (anchor->f.f2.YDeviceTable, y_ppem);
236 tag_name (char *str, unsigned tag)
239 *str++ = (tag >> 16) & 0xFF;
240 *str++ = (tag >> 8) & 0xFF;
246 encode_features (char *str, int count, unsigned *features)
251 for (i = 0; i < count; i++)
253 unsigned tag = features[i];
263 str = tag_name (str, tag);
276 drive_otf (MFLTFont *font, MFLT_OTF_Spec *spec,
277 MFLTGlyphString *in, int from, int to,
278 MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
282 OTF *otf = ((FontInfo *) font)->otf;
283 OTF_GlyphString otf_gstring;
285 char script[4], langsys[4];
286 char *gsub_features = NULL, *gpos_features = NULL;
293 otf_gstring.glyphs = NULL;
294 if (OTF_get_table (otf, "head") < 0)
297 ((FontInfo *) font)->otf = NULL;
301 tag_name (script, spec->script);
302 tag_name (langsys, spec->langsys);
304 if (spec->gsub_count > 0)
306 gsub_features = alloca (6 * spec->gsub_count);
309 if (OTF_check_table (otf, "GSUB") < 0)
310 gsub_features = NULL;
312 encode_features (gsub_features, spec->gsub_count, spec->gsub);
315 if (spec->gpos_count)
317 gpos_features = alloca (6 * spec->gpos_count);
320 if (OTF_check_table (otf, "GPOS") < 0)
321 gpos_features = NULL;
323 encode_features (gpos_features, spec->gpos_count, spec->gpos);
327 otf_gstring.size = otf_gstring.used = len;
328 otf_gstring.glyphs = (OTF_Glyph *) malloc (sizeof (OTF_Glyph) * len);
329 memset (otf_gstring.glyphs, 0, sizeof (OTF_Glyph) * len);
330 for (i = 0; i < len; i++)
332 otf_gstring.glyphs[i].c = in->glyphs[from + i].c;
333 otf_gstring.glyphs[i].glyph_id = in->glyphs[from + i].code;
336 OTF_drive_gdef (otf, &otf_gstring);
341 if (OTF_drive_gsub (otf, &otf_gstring, script, langsys, gsub_features)
344 if (out->allocated < out->used + otf_gstring.used)
346 for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, otfg++)
348 MFLTGlyph *g = out->glyphs + out->used;
350 *g = in->glyphs[from + otfg->f.index.from];
352 g->code = otfg->glyph_id;
358 if (out->allocated < out->used + len)
360 for (i = 0; i < len; i++)
361 out->glyphs[out->used++] = in->glyphs[from + i];
364 font->get_metric (font, out, gidx, out->used);
369 MFLTGlyph *base = NULL, *mark = NULL, *g;
370 int x_ppem, y_ppem, x_scale, y_scale;
372 if (OTF_check_features (otf, 1,
373 spec->script, spec->langsys,
374 spec->gpos, spec->gpos_count) != 1
375 || (OTF_drive_gpos (otf, &otf_gstring, script, langsys,
379 face = ((FontInfo *) font)->face;
380 x_ppem = face->size->metrics.x_ppem;
381 y_ppem = face->size->metrics.y_ppem;
382 x_scale = face->size->metrics.x_scale;
383 y_scale = face->size->metrics.y_scale;
385 for (i = 0, otfg = otf_gstring.glyphs, g = out->glyphs + gidx;
386 i < otf_gstring.used; i++, otfg++, g++)
390 if (! otfg->glyph_id)
392 switch (otfg->positioning_type)
398 int format = otfg->f.f1.format;
400 if (format & OTF_XPlacement)
402 = otfg->f.f1.value->XPlacement * x_scale / 0x10000;
403 if (format & OTF_XPlaDevice)
405 += DEVICE_DELTA (otfg->f.f1.value->XPlaDevice, x_ppem);
406 if (format & OTF_YPlacement)
408 = - (otfg->f.f1.value->YPlacement * y_scale / 0x10000);
409 if (format & OTF_YPlaDevice)
411 -= DEVICE_DELTA (otfg->f.f1.value->YPlaDevice, y_ppem);
412 if (format & OTF_XAdvance)
414 += otfg->f.f1.value->XAdvance * x_scale / 0x10000;
415 if (format & OTF_XAdvDevice)
417 += DEVICE_DELTA (otfg->f.f1.value->XAdvDevice, x_ppem);
418 if (format & OTF_YAdvance)
420 += otfg->f.f1.value->YAdvance * y_scale / 0x10000;
421 if (format & OTF_YAdvDevice)
423 += DEVICE_DELTA (otfg->f.f1.value->YAdvDevice, y_ppem);
424 adjustment[i].set = 1;
428 /* Not yet supported. */
434 goto label_adjust_anchor;
435 default: /* i.e. case 6 */
442 int base_x, base_y, mark_x, mark_y;
444 base_x = otfg->f.f4.base_anchor->XCoordinate * x_scale / 0x10000;
445 base_y = otfg->f.f4.base_anchor->YCoordinate * y_scale / 0x10000;
446 mark_x = otfg->f.f4.mark_anchor->XCoordinate * x_scale / 0x10000;
447 mark_y = otfg->f.f4.mark_anchor->YCoordinate * y_scale / 0x10000;;
449 if (otfg->f.f4.base_anchor->AnchorFormat != 1)
450 adjust_anchor (otfg->f.f4.base_anchor, face, prev->code,
451 x_ppem, y_ppem, &base_x, &base_y);
452 if (otfg->f.f4.mark_anchor->AnchorFormat != 1)
453 adjust_anchor (otfg->f.f4.mark_anchor, face, g->code,
454 x_ppem, y_ppem, &mark_x, &mark_y);
455 adjustment[i].xoff = (base_x - mark_x);
456 adjustment[i].yoff = - (base_y - mark_y);
457 adjustment[i].back = (g - prev);
458 adjustment[i].set = 1;
461 if (otfg->GlyphClass == OTF_GlyphClass0)
463 else if (otfg->GlyphClass == OTF_GlyphClassMark)
469 free (otf_gstring.glyphs);
473 font->get_metric (font, in, from, to);
474 for (i = 0; i < len; i++)
476 MFLTGlyph *g = in->glyphs + (from + i);
478 out->glyphs[out->used++] = *g;
480 if (otf_gstring.glyphs)
481 free (otf_gstring.glyphs);
486 open_font (char *fontname, char **err)
488 FT_Face face = new_face (fontname, err);
493 font_info = malloc (sizeof (FontInfo));
494 font_info->font.get_glyph_id = get_glyph_id;
495 font_info->font.get_metric = get_metric;
496 font_info->font.drive_otf = drive_otf;
497 font_info->face = face;
498 font_info->otf = OTF_open_ft_face (face);
499 return ((MFLTFont *) font_info);
503 close_font (MFLTFont *font)
505 FontInfo *font_info = (FontInfo *) font;
507 OTF_close (font_info->otf);
508 FT_Done_Face (font_info->face);
528 HB_StreamRec gdef_stream;
532 MPlist *otf_spec_cache;
536 convertStringToGlyphIndices (HB_Font font, const HB_UChar16 *string,
537 hb_uint32 length, HB_Glyph *glyphs,
538 hb_uint32 *numGlyphs, HB_Bool rightToLeft)
544 getGlyphAdvances (HB_Font font, const HB_Glyph *glyphs, hb_uint32 numGlyphs,
545 HB_Fixed *advances, int flags /*HB_ShaperFlag*/)
549 for (i = 0; i < numGlyphs; i++)
554 canRender (HB_Font font, const HB_UChar16 *string, hb_uint32 length)
560 getPointInOutline (HB_Font font, HB_Glyph glyph, int flags /*HB_ShaperFlag*/,
561 hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos,
564 FT_Face face = font->faceData;
567 if ((error = (HB_Error) FT_Load_Glyph (face, glyph, flags)))
569 if (face->glyph->format != ft_glyph_format_outline)
570 return (HB_Error) HB_Err_Invalid_GPOS_SubTable;
571 *nPoints = face->glyph->outline.n_points;
574 if (point > *nPoints)
575 return (HB_Error) HB_Err_Invalid_GPOS_SubTable;
577 *xpos = face->glyph->outline.points[point].x;
578 *ypos = face->glyph->outline.points[point].y;
584 getGlyphMetrics (HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
589 getFontMetric (HB_Font font, HB_FontMetric metric)
594 #define MAKE_TAG(name) ((((FT_ULong) (name)[0]) << 24) \
595 | (((FT_ULong) (name)[1]) << 16) \
596 | (((FT_ULong) (name)[2]) << 8) \
600 new_stream (FT_Face face, char *tagname, HB_Stream stream)
602 FT_ULong tag = MAKE_TAG (tagname);
606 if (! FT_IS_SFNT (face))
607 return HB_Err_Invalid_Argument;
609 if (FT_Load_Sfnt_Table (face, tag, 0, NULL, &len))
610 return HB_Err_Table_Missing;
613 return HB_Err_Out_Of_Memory;
614 if (FT_Load_Sfnt_Table (face, tag, 0, buf, &len))
617 return HB_Err_Table_Missing;
619 stream->base = (HB_Byte *) buf;
622 stream->cursor = NULL;
628 load_gdef (FontInfo *font_info)
632 if (! font_info->gdef_stream.base)
634 err = new_stream ((FT_Face) font_info->hb_font.faceData, "GDEF",
635 &font_info->gdef_stream);
636 if (err != HB_Err_Ok)
639 return HB_Load_GDEF_Table (&font_info->gdef_stream, &font_info->gdef);
643 load_gsub (FontInfo *font_info)
647 HB_LookupList *lookup_list;
650 if (! font_info->gdef)
652 if ((err = load_gdef (font_info)) != HB_Err_Ok)
655 err = new_stream ((FT_Face) font_info->hb_font.faceData, "GSUB", &stream);
656 if (err != HB_Err_Ok)
658 err = HB_Load_GSUB_Table (&stream, &font_info->gsub,
659 font_info->gdef, &font_info->gdef_stream);
661 lookup_list = &font_info->gsub->LookupList;
662 for (i = 0; i < lookup_list->LookupCount; i++)
663 lookup_list->Properties[i] = HB_GLYPH_PROPERTIES_UNKNOWN;
668 load_gpos (FontInfo *font_info)
672 HB_LookupList *lookup_list;
675 if (! font_info->gdef)
677 if ((err = load_gdef (font_info)) != HB_Err_Ok)
680 err = new_stream ((FT_Face) font_info->hb_font.faceData, "GPOS", &stream);
681 if (err != HB_Err_Ok)
683 err = HB_Load_GPOS_Table (&stream, &font_info->gpos,
684 font_info->gdef, &font_info->gdef_stream);
686 lookup_list = &font_info->gpos->LookupList;
687 for (i = 0; i < lookup_list->LookupCount; i++)
688 lookup_list->Properties[i] = HB_GLYPH_PROPERTIES_UNKNOWN;
692 const HB_FontClass hb_fontClass = {
693 convertStringToGlyphIndices, getGlyphAdvances, canRender,
694 getPointInOutline, getGlyphMetrics, getFontMetric
698 setup_features (int gsubp, FontInfo *font_info, MFLT_OTF_Spec *spec,
701 int count, preordered;
702 unsigned int *features;
703 FT_UShort script, langsys;
704 FT_UShort req_feature, index;
705 FT_UInt *feature_list;
711 if (! font_info->gsub)
713 if ((err = load_gsub (font_info)) != HB_Err_Ok)
716 if ((err = HB_GSUB_Select_Script (font_info->gsub, spec->script, &script))
721 if ((err = HB_GSUB_Select_Language (font_info->gsub, spec->langsys,
722 script, &langsys, &req_feature))
727 langsys = req_feature = 0xFFFF;
728 count = spec->gsub_count;
729 features = spec->gsub;
733 if (! font_info->gpos)
735 if ((err = load_gpos (font_info)) != HB_Err_Ok)
738 if ((err = HB_GPOS_Select_Script (font_info->gpos, spec->script, &script))
743 if ((err = HB_GPOS_Select_Language (font_info->gpos, spec->langsys,
744 script, &langsys, &req_feature))
749 langsys = req_feature = 0xFFFF;
750 count = spec->gpos_count;
751 features = spec->gpos;
754 for (preordered = 0; preordered < count; preordered++)
755 if (features[preordered] == 0)
758 ? HB_GSUB_Query_Features (font_info->gsub, script, langsys,
760 : HB_GPOS_Query_Features (font_info->gpos, script, langsys,
767 for (i = 0; feature_list[i]; i++);
770 info->indices = malloc (sizeof (FT_UShort) * ((req_feature != 0xFFFF) + i));
772 if (req_feature != 0xFFFF)
773 info->indices[i++] = req_feature;
774 for (j = 0; j < preordered; j++)
777 ? HB_GSUB_Select_Feature (font_info->gsub, features[j],
778 script, langsys, &index)
779 : HB_GPOS_Select_Feature (font_info->gpos, features[j],
780 script, langsys, &index)))
783 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])
794 ? HB_GSUB_Select_Feature (font_info->gsub, feature_list[j],
795 script, langsys, &index)
796 : HB_GPOS_Select_Feature (font_info->gpos, feature_list[j],
797 script, langsys, &index))
800 info->indices[i++] = index;
808 setup_otf_spec (MFLTFont *font, MFLT_OTF_Spec *spec)
810 FontInfo *font_info = (FontInfo *) font;
813 if (spec->gsub_count + spec->gpos_count == 0)
815 ginfo = mplist_get (font_info->otf_spec_cache, spec->sym);
817 return (ginfo->gsub.count + ginfo->gpos.count > 0 ? ginfo : NULL);
818 ginfo = calloc (1, sizeof (GsubGposInfo));
819 mplist_push (font_info->otf_spec_cache, spec->sym, ginfo);
820 if (setup_features (1, font_info, spec, &(ginfo->gsub)) != HB_Err_Ok)
822 if (setup_features (0, font_info, spec, &(ginfo->gpos)) != HB_Err_Ok)
828 drive_otf (MFLTFont *font, MFLT_OTF_Spec *spec,
829 MFLTGlyphString *in, int from, int to,
830 MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
832 FontInfo *font_info = (FontInfo *) font;
837 HB_UShort *apply_order_save;
838 HB_UShort apply_count_save;
840 int gpos_applied = 0;
847 if (hb_buffer_new (&buf) != FT_Err_Ok)
849 for (i = from; i < to; i++)
851 if (hb_buffer_add_glyph (buf, in->glyphs[i].code, 0, i) != FT_Err_Ok)
854 ginfo = setup_otf_spec (font, spec);
857 if (ginfo->gsub.count > 0)
859 if (! font_info->gdef
860 && load_gdef (font_info) != HB_Err_Ok)
862 apply_order_save = font_info->gsub->FeatureList.ApplyOrder;
863 apply_count_save = font_info->gsub->FeatureList.ApplyCount;
865 font_info->gsub->FeatureList.ApplyOrder = ginfo->gsub.indices;
866 font_info->gsub->FeatureList.ApplyCount = ginfo->gsub.count;
867 err = HB_GSUB_Apply_String (font_info->gsub, buf);
868 if (err != HB_Err_Ok && err != HB_Err_Not_Covered)
870 if (out->used + buf->in_length > out->allocated)
874 if (ginfo->gpos.count > 0
875 && (font_info->gpos || load_gpos (font_info) == HB_Err_Ok))
879 apply_order_save = font_info->gsub->FeatureList.ApplyOrder;
880 apply_count_save = font_info->gsub->FeatureList.ApplyCount;
883 font_info->gpos->FeatureList.ApplyOrder = ginfo->gpos.indices;
884 font_info->gpos->FeatureList.ApplyCount = ginfo->gpos.count;
885 err = HB_GPOS_Apply_String (&font_info->hb_font, font_info->gpos,
886 FT_LOAD_DEFAULT, buf, FALSE, FALSE);
887 if (err == HB_Err_Ok)
893 font_info->gsub->FeatureList.ApplyOrder = apply_order_save;
894 font_info->gsub->FeatureList.ApplyCount = apply_count_save;
899 for (i = 0; i < buf->in_length; i++)
901 HB_GlyphItem hg = buf->in_string + i;
902 HB_Position pos = buf->positions + i;
905 out->glyphs[out->used] = in->glyphs[hg->cluster];
906 g = out->glyphs + out->used++;
907 if (g->code != hg->gindex)
908 g->c = 0, g->code = hg->gindex;
909 adjustment[i].set = gpos_applied;
912 adjustment[i].xadv = pos->x_advance;
913 adjustment[i].yadv = pos->y_advance;
914 adjustment[i].xoff = pos->x_pos;
915 adjustment[i].yoff = - pos->y_pos;
916 adjustment[i].back = pos->back;
917 adjustment[i].advance_is_absolute = pos->new_advance;
924 hb_buffer_free (buf);
925 for (i = 0; i < len; i++)
926 out->glyphs[out->used++] = in->glyphs[from + i];
931 open_font (char *fontname, char **err)
933 FT_Face face = new_face (fontname, err);
938 font_info = calloc (1, sizeof (FontInfo));
939 font_info->font.get_glyph_id = get_glyph_id;
940 font_info->font.get_metric = get_metric;
941 font_info->font.drive_otf = drive_otf;
942 font_info->face = face;
943 font_info->hb_font.klass = &hb_fontClass;
944 font_info->hb_font.faceData = face;
945 font_info->hb_font.userData = NULL;
946 font_info->hb_font.x_ppem = face->size->metrics.x_ppem;
947 font_info->hb_font.x_scale = face->size->metrics.x_scale;
948 font_info->hb_font.y_scale = face->size->metrics.y_scale;
949 font_info->hb_font.y_ppem = face->size->metrics.y_ppem;
950 font_info->otf_spec_cache = mplist ();
951 return ((MFLTFont *) font_info);
955 close_font (MFLTFont *font)
957 FontInfo *font_info = (FontInfo *) font;
962 HB_Done_GDEF_Table (font_info->gdef);
963 free (font_info->gdef_stream.base);
966 HB_Done_GSUB_Table (font_info->gsub);
968 HB_Done_GPOS_Table (font_info->gpos);
969 FT_Done_Face ((FT_Face) (font_info->hb_font.faceData));
970 for (p = font_info->otf_spec_cache; mplist_key (p) != Mnil;
973 GsubGposInfo *ginfo = mplist_value (p);
975 if (ginfo->gsub.count > 0)
976 free (ginfo->gsub.indices);
977 if (ginfo->gpos.count > 0)
978 free (ginfo->gpos.indices);
980 m17n_object_unref (font_info->otf_spec_cache);
988 main (int argc, char **argv)
990 char *font_name, *flt_name;
998 fprintf (stderr, "Usage: flt FONT-NAME FLT-NAME < TEXT-FILE\n");
1002 font_name = argv[1];
1005 FT_Init_FreeType (&ft_library);
1007 font = open_font (font_name, &err);
1010 fprintf (stderr, "Font error: %s: %s\n", argv[1], err);
1014 mt = mconv_decode_stream (msymbol ("utf-8"), stdin);
1015 len = mtext_len (mt);
1016 for (i = 0, j = mtext_character (mt, i, len, '\n'); i < len;
1017 i = j + 1, j = mtext_character (mt, i, len, '\n'))
1021 if (flt (mt, i, j, font, flt_name) < 0)
1023 fprintf (stderr, "Error in FLT processing.\n");
1027 m17n_object_unref (mt);