Bad glyphs code points produce by layout function with Arabic font
MaximeHPP opened this issue · 1 comments
Here is the Tajawal-Medium
font which you can download via Google Font: https://fonts.google.com/specimen/Tajawal
After parsing the font and calling the layout function (without additional params) on an Arabic string, I get the right array of glyphs but with the wrong codePoints
for each. Each codePoints
is the one of the base glyph (without substitution). I checked via another lib like opentype.js
and the glyphs have their own unicode.
I need the true unicode because I don't use the path to display the text.
Steps to reproduce:
- Download the font
- Run
const fontObject = fontkit.create(font);
const glyphs = fontObject.layout('هناك حقي').glyphs;
const codePoint = glyphs[0].codePoints[0];
console.log(glyphs[0], fontObject.glyphForCodePoint(codePoint));
You can see not the same glyphs but the same code point.
Do you have any idea ? 🙏
If I understood correctly this codepoint table contains the unicodes of the characters replaced by the glyph. However, I noticed that even when ligatures are used to replace several characters, no glyph is considered as a ligature and the codepoint array is empty.