-
-
Notifications
You must be signed in to change notification settings - Fork 72
Lookuptype 6 tests #105
Copy link
Copy link
Open
Description
I'm testing as follows:
import { Font } from "./Font.js";
const font = new Font("boink");
font.src = `./fonts/Recursive_VF_1.064.ttf`;
// font.src = `./fonts/MehrNastaliqWeb-Regular.ttf`;
font.onload = (evt) => {
let font = evt.detail.font;
const { cmap, name, GSUB } = font.opentype.tables;
let scripts = GSUB.getSupportedScripts();
scripts.forEach((script) => {
let langsys = GSUB.getSupportedLangSys(script);
langsys.forEach((lang) => {
let langSysTable = GSUB.getLangSysTable(script, lang);
let features = GSUB.getFeatures(langSysTable);
let featureCount = features.length;
features.forEach((feature) => {
const lookupIDs = feature.lookupListIndices;
lookupIDs.forEach((id) => {
const lookup = GSUB.getLookup(id);
// Only dump lookup type 6 for DFLT/dflt
if (lookup.lookupType === 6 && lang === "dflt") {
const subtable = lookup.getSubTable(0);
const coverage = subtable.getCoverageTable();
console.log(coverage);
// console.log(subtable);
}
});
});
});
});
};For Recusive, this outputs stuff like:
CoverageTable { coverageFormat: 768 }
CoverageTable { coverageFormat: 768 }
CoverageTable { coverageFormat: 768 }
CoverageTable { coverageFormat: 768 }
CoverageTable { coverageFormat: 45062 }
CoverageTable { coverageFormat: 3 }
CoverageTable { coverageFormat: 3 }
CoverageTable { coverageFormat: 3 }
CoverageTable { coverageFormat: 3 }
Which seems wrong.
If I understand https://github.com/Pomax/Font.js/blob/master/src/opentype/tables/advanced/shared/subtables/gsub.js#L301 correctly there's only getters for substFormat 1 and 2, while most fonts I test with have a substFormat of 3.
Dumping the subtable appears to provide valid data, if these offsets are supposed to jump around this much (from 1 to 1410, to 1, to 20, etc.)
LookupType6 {
substFormat: 3,
coverageOffset: 1,
backtrackGlyphCount: 164,
backtrackCoverageOffsets: [
1, 1410, 1, 20, 1, 0, 52, 2, 3, 530, 532, 0,
536, 542, 3, 1257, 1257, 10, 3, 1, 122, 1, 1368, 1,
20, 1, 0, 53, 2, 2, 533, 535, 0, 553, 558, 3,
1, 0, 1, 8, 1, 1324, 743, 1, 0, 1, 8, 2,
64, 11, 536, 530, 531, 532, 537, 538, 539, 540, 541, 542,
1257, 1, 0, 1, 8, 2, 28, 11, 543, 544, 545, 546,
547, 548, 549, 550, 551, 552, 1258, 2, 2, 520, 529, 0,
1255, 1255, 10, 1, 0, 1, 8, 1, 6, 735, 1, 1,
521, 1, 0, 1,
... 64 more items
],
inputGlyphCount: 810,
inputCoverageOffsets: [
811, 812, 813, 814, 815, 2, 11, 560, 560, 0, 563, 564,
1, 566, 571, 3, 585, 588, 9, 598, 598, 13, 600, 602,
14, 606, 606, 17, 612, 613, 18, 617, 629, 20, 631, 635,
33, 694, 698, 38, 4, 0, 1, 8, 1, 4056, 1, 8,
4, 10, 18, 26, 32, 734, 3, 300, 946, 735, 3, 300,
964, 732, 2, 946, 733, 2, 964, 1, 0, 1, 8, 1,
6, 929, 2, 1, 240, 264, 0, 1, 0, 1, 8, 2,
22, 8, 1195, 1196, 1197, 1198, 1199, 1200, 1201, 1195, 2, 2,
301, 307, 0, 1062,
... 710 more items
],
lookaheadGlyphCount: 12,
lookaheadCoverageOffsets: [
30, 48, 3, 1,
4152, 3, 4152, 4152,
4152, 0, 0, 3
],
substitutionCount: 0,
substLookupRecords: []
}
Getting backtrackCoverage, inputCoverage and lookaheadCoverage with a list of glyphs sounds like what I could use for Wakamai Fondue. Is there a way to get to that?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels