summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mfluadir/otfcc/lib/consolidate/otl/gsub-ligature.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/mfluadir/otfcc/lib/consolidate/otl/gsub-ligature.c')
-rw-r--r--Build/source/texk/web2c/mfluadir/otfcc/lib/consolidate/otl/gsub-ligature.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/mfluadir/otfcc/lib/consolidate/otl/gsub-ligature.c b/Build/source/texk/web2c/mfluadir/otfcc/lib/consolidate/otl/gsub-ligature.c
new file mode 100644
index 00000000000..c284feb6bf9
--- /dev/null
+++ b/Build/source/texk/web2c/mfluadir/otfcc/lib/consolidate/otl/gsub-ligature.c
@@ -0,0 +1,29 @@
+#include "gsub-ligature.h"
+
+bool consolidate_gsub_ligature(otfcc_Font *font, table_OTL *table, otl_Subtable *_subtable,
+ const otfcc_Options *options) {
+ subtable_gsub_ligature *subtable = &(_subtable->gsub_ligature);
+ subtable_gsub_ligature nt;
+ iSubtable_gsub_ligature.init(&nt);
+ for (glyphid_t k = 0; k < subtable->length; k++) {
+ if (!GlyphOrder.consolidateHandle(font->glyph_order, &subtable->items[k].to)) {
+ logWarning("[Consolidate] Ignored missing glyph /%s.\n", subtable->items[k].to.name);
+ continue;
+ }
+ fontop_consolidateCoverage(font, subtable->items[k].from, options);
+ Coverage.shrink(subtable->items[k].from, false);
+ if (!subtable->items[k].from->numGlyphs) {
+ logWarning("[Consolidate] Ignoring empty ligature substitution to "
+ "glyph /%s.\n",
+ subtable->items[k].to.name);
+ continue;
+ }
+ iSubtable_gsub_ligature.push(
+ &nt, ((otl_GsubLigatureEntry){
+ .from = subtable->items[k].from, .to = Handle.dup(subtable->items[k].to),
+ }));
+ subtable->items[k].from = NULL;
+ }
+ iSubtable_gsub_ligature.replace(subtable, nt);
+ return (subtable->length == 0);
+}