*** empty log message ***
authorhanda <handa>
Thu, 23 Aug 2007 02:26:02 +0000 (02:26 +0000)
committerhanda <handa>
Thu, 23 Aug 2007 02:26:02 +0000 (02:26 +0000)
flt.c

diff --git a/flt.c b/flt.c
index 1461243..100f1ac 100644 (file)
--- a/flt.c
+++ b/flt.c
@@ -279,7 +279,7 @@ encode_features (char *str, int count, unsigned *features)
 }
 
 int
-drive_otf (MFLTFont *font, MFLT_OTF_Spec *spec,
+drive_otf (MFLTFont *font, MFLTOtfSpec *spec,
           MFLTGlyphString *in, int from, int to,
           MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
 {
@@ -352,9 +352,16 @@ drive_otf (MFLTFont *font, MFLT_OTF_Spec *spec,
       for (i = 0, otfg = otf_gstring.glyphs; i < otf_gstring.used; i++, otfg++)
        {
          MFLTGlyph *g = out->glyphs + out->used;
+         int j;
 
          *g = in->glyphs[from + otfg->f.index.from];
-         g->c = otfg->c;
+         g->c = 0;
+         for (j = from + otfg->f.index.from; j <= from + otfg->f.index.to; j++)
+           if (in->glyphs[j].code == otfg->glyph_id)
+             {
+               g->c = in->glyphs[j].c;
+               break;
+             }
          g->code = otfg->glyph_id;
          out->used++;
        }
@@ -697,8 +704,8 @@ const HB_FontClass hb_fontClass = {
     getPointInOutline, getGlyphMetrics, getFontMetric
 };
 
-HB_Error
-setup_features (int gsubp, FontInfoHB *font_info, MFLT_OTF_Spec *spec,
+void
+setup_features (int gsubp, FontInfoHB *font_info, MFLTOtfSpec *spec,
                FeatureInfo *info)
 {
   int count, preordered;
@@ -713,18 +720,18 @@ setup_features (int gsubp, FontInfoHB *font_info, MFLT_OTF_Spec *spec,
     {
       if (! font_info->gsub)
        {
-         if ((err = load_gsub (font_info)) != HB_Err_Ok)
-           return err;
+         if (load_gsub (font_info) != HB_Err_Ok)
+           return;
        }
-      if ((err = HB_GSUB_Select_Script (font_info->gsub, spec->script, &script))
+      if (HB_GSUB_Select_Script (font_info->gsub, spec->script, &script)
          != HB_Err_Ok)
-       return err;
+       return;
       if (spec->langsys)
        {
-         if ((err = HB_GSUB_Select_Language (font_info->gsub, spec->langsys,
-                                             script, &langsys, &req_feature))
+         if (HB_GSUB_Select_Language (font_info->gsub, spec->langsys,
+                                      script, &langsys, &req_feature)
              != HB_Err_Ok)
-           return err;
+           return;
        }
       else
        langsys = req_feature = 0xFFFF;
@@ -735,18 +742,18 @@ setup_features (int gsubp, FontInfoHB *font_info, MFLT_OTF_Spec *spec,
     {
       if (! font_info->gpos)
        {
-         if ((err = load_gpos (font_info)) != HB_Err_Ok)
-           return err;
+         if (load_gpos (font_info) != HB_Err_Ok)
+           return;
        }
-      if ((err = HB_GPOS_Select_Script (font_info->gpos, spec->script, &script))
+      if (HB_GPOS_Select_Script (font_info->gpos, spec->script, &script)
          != HB_Err_Ok)
-       return err;
+       return;
       if (spec->langsys)
        {
-         if ((err = HB_GPOS_Select_Language (font_info->gpos, spec->langsys,
-                                             script, &langsys, &req_feature))
+         if (HB_GPOS_Select_Language (font_info->gpos, spec->langsys,
+                                      script, &langsys, &req_feature)
              != HB_Err_Ok)
-           return err;
+           return;
        }
       else
        langsys = req_feature = 0xFFFF;
@@ -757,13 +764,12 @@ setup_features (int gsubp, FontInfoHB *font_info, MFLT_OTF_Spec *spec,
   for (preordered = 0; preordered < count; preordered++)
     if (features[preordered] == 0)
       {
-       if ((err = (gsubp
-                   ? HB_GSUB_Query_Features (font_info->gsub, script, langsys,
-                                             &feature_list)
-                   : HB_GPOS_Query_Features (font_info->gpos, script, langsys,
-                                             &feature_list)))
+       if ((gsubp ? HB_GSUB_Query_Features (font_info->gsub, script, langsys,
+                                            &feature_list)
+            : HB_GPOS_Query_Features (font_info->gpos, script, langsys,
+                                      &feature_list))
            != HB_Err_Ok)
-         return err;
+         return;
        break;
       }
   if (feature_list)
@@ -775,11 +781,10 @@ setup_features (int gsubp, FontInfoHB *font_info, MFLT_OTF_Spec *spec,
   if (req_feature != 0xFFFF)
     info->indices[i++] = req_feature;
   for (j = 0; j < preordered; j++)
-    if ((err = (gsubp
-               ? HB_GSUB_Select_Feature (font_info->gsub, features[j],
-                                         script, langsys, &index)
-               : HB_GPOS_Select_Feature (font_info->gpos, features[j],
-                                         script, langsys, &index)))
+    if ((gsubp ? HB_GSUB_Select_Feature (font_info->gsub, features[j],
+                                        script, langsys, &index)
+        : HB_GPOS_Select_Feature (font_info->gpos, features[j],
+                                  script, langsys, &index))
        == HB_Err_Ok)
       info->indices[i++] = index;
   if (feature_list)
@@ -794,15 +799,14 @@ setup_features (int gsubp, FontInfoHB *font_info, MFLT_OTF_Spec *spec,
                                           script, langsys, &index)
                 : HB_GPOS_Select_Feature (font_info->gpos, feature_list[j],
                                           script, langsys, &index))
-               == FT_Err_Ok))
+               == HB_Err_Ok))
          info->indices[i++] = index;
       }
   info->count = i;
-  return HB_Err_Ok;
 }
 
 GsubGposInfo *
-setup_otf_spec (MFLTFont *font, MFLT_OTF_Spec *spec)
+setup_otf_spec (MFLTFont *font, MFLTOtfSpec *spec)
 {
   FontInfoHB *font_info = (FontInfoHB *) font;
   GsubGposInfo *ginfo;
@@ -814,15 +818,13 @@ setup_otf_spec (MFLTFont *font, MFLT_OTF_Spec *spec)
     return (ginfo->gsub.count + ginfo->gpos.count > 0 ? ginfo : NULL);
   ginfo = calloc (1, sizeof (GsubGposInfo));
   mplist_push (font_info->otf_spec_cache, spec->sym, ginfo);
-  if (setup_features (1, font_info, spec, &(ginfo->gsub)) != HB_Err_Ok)
-    return NULL;
-  if (setup_features (0, font_info, spec, &(ginfo->gpos)) != HB_Err_Ok)
-    return NULL;
+  setup_features (1, font_info, spec, &(ginfo->gsub));
+  setup_features (0, font_info, spec, &(ginfo->gpos));
   return ginfo;
 }
 
 int
-drive_otf (MFLTFont *font, MFLT_OTF_Spec *spec,
+drive_otf (MFLTFont *font, MFLTOtfSpec *spec,
           MFLTGlyphString *in, int from, int to,
           MFLTGlyphString *out, MFLTGlyphAdjustment *adjustment)
 {