1 /* otfdrive.c -- OpenType font driver.
4 by AIST (National Institute of Advanced Industrial Science and Technology)
5 Registration Number H15PRO???
7 This file is part of the OTF library.
9 The OTF library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2, or (at
12 your option) any later version.
14 The OTF library is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with the OTF library; see the file COPYING. If not, write to
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */
31 #define GSTRING_DELETE(gstring, from, len) \
33 memmove (gstring->glyphs + from, gstring->glyphs + from + len, \
34 sizeof (OTF_Glyph) * (gstring->used - from - len)); \
35 gstring->used -= len; \
39 #define GSTRING_INSERT(gstring, pos, len) \
41 if (gstring->used + len > gstring->size) \
43 char *errfmt = "GSTRING%s"; \
45 gstring->size = gstring->used + len; \
46 gstring->glyphs = (OTF_Glyph *) realloc (gstring->glyphs, \
48 if (! gstring->glyphs) \
49 OTF_ERROR (OTF_ERROR_MEMORY, ""); \
51 memmove (gstring->glyphs + pos + len, gstring->glyphs + pos, \
52 sizeof (OTF_Glyph) * (gstring->used - pos)); \
53 gstring->used += len; \
58 gstring_subst (OTF_GlyphString *gstring, int from, int to,
59 OTF_GlyphID *ids, int num)
66 GSTRING_INSERT (gstring, from, (num - len));
68 GSTRING_DELETE (gstring, from, (len - num));
69 for (i = 0; i < num; i++)
70 gstring->glyphs[from + i].glyph_id = ids[i];
76 get_coverage_index (OTF_Coverage *coverage, OTF_GlyphID id)
80 if (coverage->CoverageFormat == 1)
82 for (i = 0; i < coverage->Count; i++)
83 if (coverage->table.GlyphArray[i] == id)
88 for (i = 0; i < coverage->Count; i++)
89 if (coverage->table.RangeRecord[i].Start <= id
90 && coverage->table.RangeRecord[i].End >= id)
91 return (coverage->table.RangeRecord[i].StartCoverageIndex
92 + (id - coverage->table.RangeRecord[i].Start));
98 get_class_def (OTF_ClassDef *class_def, OTF_GlyphID glyph_id)
100 if (class_def->ClassFormat == 1)
102 int idx = (int) glyph_id - (int) class_def->f.f1.StartGlyph;
104 if (idx >= 0 && idx < class_def->f.f1.GlyphCount)
105 return class_def->f.f1.ClassValueArray[idx];
111 for (i = 0; i < class_def->f.f2.ClassRangeCount; i++)
112 if (glyph_id >= class_def->f.f2.ClassRangeRecord[i].Start
113 && glyph_id <= class_def->f.f2.ClassRangeRecord[i].End)
114 return class_def->f.f2.ClassRangeRecord[i].Class;
120 get_langsys (OTF_ScriptList *script_list, char *script, char *language)
123 OTF_Tag script_tag = OTF_tag (script);
124 OTF_Tag langsys_tag = OTF_tag (language);
127 for (i = 0; i < script_list->ScriptCount; i++)
128 if (script_list->Script[i].ScriptTag == script_tag)
130 OTF_Script *script = script_list->Script + i;
133 return &script->DefaultLangSys;
134 for (j = 0; j < script->LangSysCount; j++)
135 if (script->LangSysRecord[j].LangSysTag == langsys_tag)
136 return script->LangSys + j;
137 return &script->DefaultLangSys;
144 get_feature_index (OTF_LangSys *LangSys, OTF_FeatureList *FeatureList,
145 char *features, int *feature_index)
152 int len = strlen (features) + 1;
155 for (p1 = p0; *p1; p1++)
161 int this_len = strlen (p0) + 1;
162 OTF_Tag tag = OTF_tag (p0);
168 for (i = 0; i < FeatureList->FeatureCount; i++)
169 if (tag == FeatureList->Feature[i].FeatureTag)
171 feature_index[nfeatures++] = i;
172 if (nfeatures == FeatureList->FeatureCount)
182 for (; nfeatures < LangSys->FeatureCount; nfeatures++)
183 feature_index[nfeatures] = LangSys->FeatureIndex[nfeatures];
190 match_ids (OTF_GlyphString *gstring, int gidx, int count, OTF_GlyphID *ids)
194 if (gstring->used - gidx < count)
196 for (i = 0; i < count; i++)
197 if (gstring->glyphs[gidx + i].glyph_id != ids[i])
203 match_classes (OTF_ClassDef *class_def, OTF_GlyphString *gstring, int gidx,
204 int count, unsigned *classes)
208 if (gstring->used - gidx < count)
210 for (i = 0; i < count; i++)
211 if (get_class_def (class_def, gstring->glyphs[gidx + i].glyph_id)
218 lookup_gsub (OTF_LookupList *lookup_list, unsigned lookup_list_index,
219 OTF_GlyphString *gstring, int gidx)
221 char *errfmt = "GSUB Looking up%s";
223 OTF_Lookup *lookup = lookup_list->Lookup + lookup_list_index;
224 unsigned int flag = lookup->LookupFlag;
225 int orig_gidx = gidx;
226 OTF_Glyph *g = gstring->glyphs + gidx;
231 && (flag & (1 << g->GlyphClass))))
234 /* Try all subtables until one of them handles the current glyph. */
235 for (i = 0; i < lookup->SubTableCount && gidx == orig_gidx; i++)
237 OTF_LookupSubTableGSUB *subtable = lookup->SubTable.gsub + i;
240 if (subtable->Coverage.offset)
242 coverage_idx = get_coverage_index (&subtable->Coverage,
244 if (coverage_idx < 0)
248 switch (lookup->LookupType)
251 if (subtable->Format == 1)
252 g->glyph_id += subtable->u.single1.DeltaGlyphID;
254 g->glyph_id = subtable->u.single2.Substitute[coverage_idx];
260 OTF_GSUB_Multiple1 *multiple1 = &subtable->u.multiple1;
261 OTF_Sequence *seq = multiple1->Sequence + coverage_idx;
263 gstring_subst (gstring, gidx, gidx + 1,
264 seq->Substitute, seq->GlyphCount);
265 gidx += seq->GlyphCount;
270 if (subtable->Format == 1)
272 OTF_GSUB_Alternate1 *alt1 = &subtable->u.alternate1;
273 OTF_AlternateSet *altset = alt1->AlternateSet + coverage_idx;
275 g->glyph_id = altset->Alternate[0];
279 OTF_ERROR (OTF_ERROR_GSUB_DRIVE, " (invalid SubFormat)");
283 if (subtable->Format == 1)
285 OTF_GSUB_Ligature1 *lig1 = &subtable->u.ligature1;
286 OTF_LigatureSet *ligset = lig1->LigatureSet + coverage_idx;
290 for (j = 0; j < ligset->LigatureCount; j++)
292 lig = ligset->Ligature + j;
293 if (match_ids (gstring, gidx + 1,
294 lig->CompCount - 1, lig->Component) < 0)
296 gstring_subst (gstring, gidx, gidx + lig->CompCount,
303 OTF_ERROR (OTF_ERROR_GSUB_DRIVE, " (invalid SubFormat)");
307 if (subtable->Format == 1)
309 OTF_GSUB_Context1 *context1 = &subtable->u.context1;
310 OTF_RuleSet *set = context1->RuleSet + coverage_idx;
315 for (j = 0; j < set->RuleCount; j++)
317 rule = set->Rule + j;
318 if (match_ids (gstring, gidx + 1,
319 rule->GlyphCount - 1, rule->Input) < 0)
321 orig_used = gstring->used;
322 for (k = 0; k < rule->LookupCount; k++)
323 lookup_gsub (lookup_list,
324 rule->LookupRecord[k].LookupListIndex,
326 gidx + rule->LookupRecord[k].SequenceIndex);
327 gidx += rule->GlyphCount + (gstring->used - orig_used);
331 else if (subtable->Format == 2)
333 OTF_GSUB_Context2 *context2 = &subtable->u.context2;
340 class = get_class_def (&context2->ClassDef, g->glyph_id);
341 set = context2->ClassSet + class;
342 for (j = 0; j < set->ClassRuleCnt; j++)
344 rule = set->ClassRule + j;
345 if (match_classes (&context2->ClassDef,
347 rule->GlyphCount - 1, rule->Class)
350 orig_used = gstring->used;
351 for (k = 0; k < rule->LookupCount; k++)
352 lookup_gsub (lookup_list,
353 rule->LookupRecord[k].LookupListIndex,
355 gidx + rule->LookupRecord[k].SequenceIndex);
356 gidx += rule->GlyphCount + (gstring->used - orig_used);
360 else /* subtable->Format == 3 */
362 OTF_GSUB_Context3 *context3 = &subtable->u.context3;
366 if (gstring->used - gidx < context3->GlyphCount)
368 /* Start from the secoding coverage_idx because the
369 first one is the same as subtable->Coverage and thus
371 for (j = 1; j < context3->GlyphCount; j++)
372 if (get_coverage_index (context3->Coverage + j,
373 gstring->glyphs[gidx + j].glyph_id)
376 if (j < context3->GlyphCount)
378 orig_used = gstring->used;
379 for (k = 0; k < context3->LookupCount; k++)
380 lookup_gsub (lookup_list,
381 context3->LookupRecord[k].LookupListIndex,
383 gidx + context3->LookupRecord[k].SequenceIndex);
384 gidx += context3->GlyphCount + (gstring->used - orig_used);
389 if (subtable->Format == 1)
390 OTF_ERROR (OTF_ERROR_GSUB_DRIVE, " (not yet supported)");
391 else if (subtable->Format == 2)
393 OTF_GSUB_ChainContext2 *context2 = &subtable->u.chain_context2;
394 OTF_ChainClassSet *set;
399 // printf ("GSUB 6-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
400 class = get_class_def (&context2->InputClassDef, g->glyph_id);
401 set = context2->ChainClassSet + class;
402 for (j = 0; j < set->ChainClassRuleCnt; j++)
404 OTF_ChainClassRule *rule = set->ChainClassRule + j;
405 int fore_idx = gidx + rule->InputGlyphCount;
408 if (gidx < rule->BacktrackGlyphCount
409 || (gidx + rule->InputGlyphCount
410 + rule->LookaheadGlyphCount) >= gstring->used)
412 for (k = 0; k < rule->BacktrackGlyphCount; k++)
413 if (get_class_def (&context2->BacktrackClassDef,
414 gstring->glyphs[gidx - 1 - k].glyph_id)
415 != rule->Backtrack[k])
417 if (k < rule->BacktrackGlyphCount)
419 for (k = 1; k < rule->InputGlyphCount; k++)
420 if (get_class_def (&context2->InputClassDef,
421 gstring->glyphs[gidx + k].glyph_id)
422 != rule->Input[k - 1])
424 if (k < rule->InputGlyphCount)
426 for (k = 0; k < rule->LookaheadGlyphCount; k++)
427 if (get_class_def (&context2->LookaheadClassDef,
428 gstring->glyphs[fore_idx + k].glyph_id)
429 != rule->LookAhead[k])
431 if (k < rule->LookaheadGlyphCount)
434 orig_used = gstring->used;
435 for (k = 0; k < rule->LookupCount; k++)
436 lookup_gsub (lookup_list,
437 rule->LookupRecord[k].LookupListIndex,
439 gidx + rule->LookupRecord[k].SequenceIndex);
440 gidx += rule->InputGlyphCount + (gstring->used - orig_used);
446 OTF_GSUB_ChainContext3 *context3 = &subtable->u.chain_context3;
447 int back_gidx = gidx - context3->BacktrackGlyphCount;
448 int fore_gidx = gidx + context3->InputGlyphCount;
453 || fore_gidx + context3->LookaheadGlyphCount > gstring->used)
456 for (j = 0; j < context3->BacktrackGlyphCount; j++)
457 if (get_coverage_index (context3->Backtrack + j,
458 gstring->glyphs[gidx - 1 - j].glyph_id)
461 if (j < context3->BacktrackGlyphCount)
464 /* Start from the secode coverage_idx because the first
465 one is the same as subtable->Coverage and thus
467 for (j = 1; j < context3->InputGlyphCount; j++)
468 if (get_coverage_index (context3->Input + j,
469 gstring->glyphs[gidx + j].glyph_id)
472 if (j < context3->InputGlyphCount)
475 for (j = 0; j < context3->LookaheadGlyphCount; j++)
476 if (get_coverage_index (context3->LookAhead + j,
477 gstring->glyphs[fore_gidx + j].glyph_id)
480 if (j < context3->LookaheadGlyphCount)
483 orig_used = gstring->used;
484 for (j = 0; j < context3->LookupCount; j++)
485 lookup_gsub (lookup_list,
486 context3->LookupRecord[j].LookupListIndex,
488 gidx + context3->LookupRecord[j].SequenceIndex);
489 gidx += context3->InputGlyphCount + (gstring->used - orig_used);
497 if (gidx == orig_gidx)
499 //printf ("not applied\n");
504 // printf ("done\n");
513 get_anchor (OTF_Anchor *anchor, OTF_ValueRecord *rec)
515 unsigned value_format = OTF_XPlacement | OTF_YPlacement;
517 rec->XPlacement = anchor->XCoordinate;
518 rec->YPlacement = anchor->YCoordinate;
519 if (anchor->AnchorFormat == 1)
522 else if (anchor->AnchorFormat == 2)
523 /* Not yet implemented */
525 else if (anchor->AnchorFormat == 3)
526 /* Not yet implemented */
533 lookup_gpos (OTF_LookupList *lookup_list, unsigned lookup_list_index,
534 OTF_GlyphString *gstring, int gidx)
536 char *errfmt = "GPOS Looking up%s";
538 OTF_Lookup *lookup = lookup_list->Lookup + lookup_list_index;
539 unsigned int flag = lookup->LookupFlag;
540 int orig_gidx = gidx;
541 OTF_Glyph *g = gstring->glyphs + gidx;
546 && (flag & (1 << g->GlyphClass))))
549 /* Try all subtables until one of them handles the current glyph. */
550 for (i = 0; i < lookup->SubTableCount && gidx == orig_gidx; i++)
552 OTF_LookupSubTableGPOS *subtable = lookup->SubTable.gpos + i;
555 // printf ("subtype:%d ", subtable->Format);
556 if (subtable->Coverage.offset)
558 coverage_idx = get_coverage_index (&subtable->Coverage,
560 if (coverage_idx < 0)
562 // printf ("not covererd ");
567 switch (lookup->LookupType)
570 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
573 if (gidx + 1 >= gstring->used)
575 if (subtable->Format == 1)
576 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
577 else if (subtable->Format == 2)
579 OTF_GPOS_Pair2 *pair2 = &subtable->u.pair2;
580 unsigned class1, class2;
582 // printf ("GPOS 2-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
584 class1 = get_class_def (&pair2->ClassDef1, g->glyph_id);
585 class2 = get_class_def (&pair2->ClassDef2, g[1].glyph_id);
586 g->positioning_type = lookup->LookupType;
587 g->f.f2.format = pair2->ValueFormat1;
589 = &pair2->Class1Record[class1].Class2Record[class2].Value1;
590 if (pair2->ValueFormat2)
593 g->positioning_type = lookup->LookupType;
594 g->f.f2.format = pair2->ValueFormat2;
596 = &pair2->Class1Record[class1].Class2Record[class2].Value2;
602 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
607 if (subtable->Format == 1)
609 OTF_GPOS_MarkBase1 *mark_base1 = &subtable->u.mark_base1;
610 OTF_MarkRecord *mark_record;
611 OTF_AnchorRecord *base_record;
612 int coverage_idx_base
613 = get_coverage_index (&mark_base1->BaseCoverage,
616 if (coverage_idx_base < 0)
618 // printf ("GPOS 4-1: c:0x%x g:0x%x\n", g->c, g->glyph_id);
619 mark_record = mark_base1->MarkArray.MarkRecord + coverage_idx;
621 = mark_base1->BaseArray.AnchorRecord + coverage_idx_base;
622 g->f.f4.mark_anchor = &mark_record->MarkAnchor;
624 = &base_record->Anchor[mark_record->Class];
625 g->positioning_type = lookup->LookupType;
629 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
633 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
639 if (subtable->Format == 1)
641 OTF_GPOS_MarkMark1 *mark_mark1 = &subtable->u.mark_mark1;
642 OTF_MarkRecord *mark1_record;
643 OTF_AnchorRecord *mark2_record;
644 int coverage_idx_base
645 = get_coverage_index (&mark_mark1->Mark2Coverage,
648 if (coverage_idx_base < 0)
650 // printf ("GPOS 6-1: c:0x%x g:0x%x\n", g->c, g->glyph_id);
651 mark1_record = mark_mark1->Mark1Array.MarkRecord + coverage_idx;
653 = mark_mark1->Mark2Array.AnchorRecord + coverage_idx_base;
654 g->f.f6.mark1_anchor = &mark1_record->MarkAnchor;
656 = &mark2_record->Anchor[mark1_record->Class];
657 g->positioning_type = lookup->LookupType;
661 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
665 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
669 if (subtable->Format == 1)
670 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
671 else if (subtable->Format == 2)
673 OTF_GPOS_ChainContext2 *context2 = &subtable->u.chain_context2;
674 OTF_ChainClassSet *set;
679 // printf ("GPOS 8-2: c:0x%x g:0x%x\n", g->c, g->glyph_id);
680 class = get_class_def (&context2->InputClassDef, g->glyph_id);
681 set = context2->ChainClassSet + class;
682 for (j = 0; j < set->ChainClassRuleCnt; j++)
684 OTF_ChainClassRule *rule = set->ChainClassRule + j;
685 int fore_idx = gidx + rule->InputGlyphCount;
688 if (gidx < rule->BacktrackGlyphCount
689 || (gidx + rule->InputGlyphCount
690 + rule->LookaheadGlyphCount) >= gstring->used)
692 for (k = 0; k < rule->BacktrackGlyphCount; k++)
693 if (get_class_def (&context2->BacktrackClassDef,
694 gstring->glyphs[gidx - 1 - k].glyph_id)
695 != rule->Backtrack[k])
697 if (k < rule->BacktrackGlyphCount)
699 for (k = 1; k < rule->InputGlyphCount; k++)
700 if (get_class_def (&context2->InputClassDef,
701 gstring->glyphs[gidx + k].glyph_id)
702 != rule->Input[k - 1])
704 if (k < rule->InputGlyphCount)
706 for (k = 0; k < rule->LookaheadGlyphCount; k++)
707 if (get_class_def (&context2->LookaheadClassDef,
708 gstring->glyphs[fore_idx + k].glyph_id)
709 != rule->LookAhead[k])
711 if (k < rule->LookaheadGlyphCount)
714 orig_used = gstring->used;
715 for (k = 0; k < rule->LookupCount; k++)
716 lookup_gpos (lookup_list,
717 rule->LookupRecord[k].LookupListIndex,
719 gidx + rule->LookupRecord[k].SequenceIndex);
720 gidx += rule->InputGlyphCount + (gstring->used - orig_used);
724 else if (subtable->Format == 3)
725 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
727 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (invalid subformat)");
731 OTF_ERROR (OTF_ERROR_GPOS_DRIVE, " (not yet supported)");
738 if (gidx == orig_gidx)
740 // printf ("not applied\n");
745 // printf ("done\n");
751 lookup_cmap (OTF_cmap *cmap, int c)
753 char *errfmt = "cmap driving%s";
757 if (! cmap || ! cmap->Unicode)
760 switch (cmap->Unicode->subtable.format)
764 OTF_EncodingSubtable4 *sub4 = cmap->Unicode->subtable.f.f4;
765 int segCount = sub4->segCountX2 / 2;
767 for (i = 0; i < segCount; i++)
768 if (c <= sub4->segments[i].endCount)
770 if (i == segCount || c < sub4->segments[i].startCount)
772 if (sub4->segments[i].idRangeOffset == 0xFFFF)
773 return c + sub4->segments[i].idDelta;
776 return sub4->glyphIdArray[sub4->segments[i].idRangeOffset
777 + (c - sub4->segments[i].startCount)];
782 OTF_ERROR (OTF_ERROR_CMAP_DRIVE, " (not yet supported)");
794 OTF_drive_cmap (OTF *otf, OTF_GlyphString *gstring)
800 && OTF_get_table (otf, "cmap") < 0)
804 for (i = 0; i < gstring->used; i++)
806 gstring->glyphs[i].glyph_id = lookup_cmap (cmap, gstring->glyphs[i].c);
807 if (gstring->glyphs[i].glyph_id < 0)
815 OTF_drive_gdef (OTF *otf, OTF_GlyphString *gstring)
821 && OTF_get_table (otf, "GDEF") < 0)
825 if (gdef->glyph_class_def.offset)
826 for (i = 0; i < gstring->used; i++)
827 gstring->glyphs[i].GlyphClass
828 = get_class_def (&gdef->glyph_class_def,
829 gstring->glyphs[i].glyph_id);
831 if (gdef->mark_attach_class_def.offset)
832 for (i = 0; i < gstring->used; i++)
833 gstring->glyphs[i].MarkAttachClass
834 = get_class_def (&gdef->mark_attach_class_def,
835 gstring->glyphs[i].glyph_id);
842 OTF_drive_gsub (OTF *otf, OTF_GlyphString *gstring,
843 char *script, char *language, char *features)
845 char *errfmt = "GSUB driving%s";
848 OTF_LangSys *LangSys;
854 && OTF_get_table (otf, "GSUB") < 0)
858 LangSys = get_langsys (&gsub->ScriptList, script, language);
862 feature_index = alloca (sizeof (int) * gsub->FeatureList.FeatureCount);
864 OTF_ERROR (OTF_ERROR_MEMORY, " feature list");
866 nfeatures = get_feature_index (LangSys, &gsub->FeatureList,
867 features, feature_index);
869 OTF_ERROR (OTF_ERROR_GSUB_DRIVE, " no feature");
871 for (i = 0; i < nfeatures; i++)
873 OTF_Feature *feature = gsub->FeatureList.Feature + feature_index[i];
875 for (j = 0; j < feature->LookupCount; j++)
879 while (gidx < gstring->used)
881 gidx = lookup_gsub (&gsub->LookupList,
882 feature->LookupListIndex[j], gstring, gidx);
893 OTF_drive_gpos (OTF *otf, OTF_GlyphString *gstring,
894 char *script, char *language, char *features)
896 char *errfmt = "GPOS driving%s";
899 OTF_LangSys *LangSys;
905 && OTF_get_table (otf, "GPOS") < 0)
909 LangSys = get_langsys (&gpos->ScriptList, script, language);
913 feature_index = alloca (sizeof (int) * gpos->FeatureList.FeatureCount);
915 OTF_ERROR (OTF_ERROR_MEMORY, " feature list");
917 nfeatures = get_feature_index (LangSys, &gpos->FeatureList,
918 features, feature_index);
920 OTF_ERROR (OTF_ERROR_GSUB_DRIVE, " no feature");
922 for (i = 0; i < nfeatures; i++)
924 OTF_Feature *feature = gpos->FeatureList.Feature + feature_index[i];
926 for (j = 0; j < feature->LookupCount; j++)
930 while (gidx < gstring->used)
932 gidx = lookup_gpos (&gpos->LookupList,
933 feature->LookupListIndex[j], gstring, gidx);
944 OTF_drive_tables (OTF *otf, OTF_GlyphString *gstring,
945 char *script, char *language,
946 char *gsub_features, char *gpos_features)
948 if (OTF_drive_cmap (otf, gstring) < 0)
950 if (OTF_drive_gdef (otf, gstring) < 0)
952 if ((! gsub_features || gsub_features[0])
953 && OTF_drive_gsub (otf, gstring, script, language, gsub_features) < 0)
955 if ((! gpos_features || gpos_features[0])
956 && OTF_drive_gpos (otf, gstring, script, language, gpos_features) < 0)