Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad glyphs code points produce by layout function with Arabic font #304

Open
MaximeHPP opened this issue Mar 8, 2023 · 1 comment
Open

Comments

@MaximeHPP
Copy link

MaximeHPP commented Mar 8, 2023

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:

  1. Download the font
  2. 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 ? 🙏

@MaximeHPP
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant