Description
Expected Behavior
Opentype.js should output text with ligatures for getPath() conversion.
Current Behavior
Result of font.getPath() call results in text which doesn't have ligatures, even if font supports them.
I explicitly request 'liga' feature in getPath() call:
font.getPath(
htmlBlock.text,
0,
0,
htmlBlock.fontSize,
{
letterSpacing: htmlBlock.letterSpacing,
features: {
'liga': true,
}
}
);
Release 1.3.4 converts to path silently changing ligatures to standard letters.
I tried @Connum fork of opentype.js, branch which fixes #554 (PR: #564) - this throw error "Substitution type 11 is not supported in chaining substitution". Seems logical, this branch adds check:
if (substitutionType === '12') {
<lookup code>
} else {
throw new Error(`Substitution type ${substitutionType} is not supported in chaining substitution`);
}
around substitution parsing.
FontForge reports this font contains mutiple definitions of 'liga' lookups:
To see the difference look at provided example, more informations about it in 'Steps to Reproduce' section.
Possible Solution
No idea, I'm newbie in font world :)
Steps to Reproduce (for bugs)
I provide minimal example - upper text is how browser renders this text (with ligatures), lower text is upper text converted by opentype.js conversion to path commands. Notice different letters 'd', 'u' and 'fft' ligature...
... or just look at this screenshot:
Context
I try to use opentype.js as a tool to convert HTML text to SVG path elements. I treat opentype.js as 'magic box' which returns appropriate drawing commands.
Your Environment
- Version used: 1.3.4 / branch: (Handle rlig for latin script #564)
- Font used: LobsterTwo-Bold.otf (provided in ZIP file)
- Browser Name and version: Chromium 78 / Chrome 103
- Operating System and version (desktop or mobile): Ubuntu 22.04 LTS
- Link to your project: minimalexample.zip