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
Exporting fonts must set UPM=1000, even if their UPM is higher than that. #115
Comments
Thanks for the detailed report Matt; I'll look into it next week. |
I seem to have the same issue. I am playing with replacing my own font implementation in pdfjs with opentype.js. Chrome, Firefox (pdf.js) and Mac Preview are displaying the font correctly, however, Adobe Reader messes it up: Please let me know if I can do anything helping to track down this issue. |
@rkusa That's weird -- can you send me the font + code you used to generate this? |
I thought I'd add this as well - Here is my font export code: Which relies heavily on the Glyph object: I first encountered this, and documented a lot of details in this bug: In the process I used TTX to investigate the exported OTF, but couldn't see anything that would cause problems (but, I'm rather novice at the full implications of OTF table values). All the postscript code for the glyphs was exported correctly. @davelab6 did a TTX diff of Merriweather Sans original vs. Merriweather Sans exported through Glyphr Studio: So, hopefully this helps. |
@mattlag thanks so much! I'll investigate and let you know. |
I've tracked the bug to the CFF fontMatrix, which defines an affine transform for the glyph outlines. The fontMatrix defaults to OpenType.js didn't set the fontMatrix anywhere, and so all fonts used the default font matrix, which is only suitable for fonts with a UPM of 1000. I now create a fontMatrix based on the unitsPerEm. Thanks @mattlag and @davelab6 for helping me find the bug. Especially the TTX export helped in tracking down the bug. Also, please let me know if anything else is off. |
Awesome - thanks! I'll update to 0.4.7 and let you know if anything goes wrong. |
@mattlag please use version 0.4.8, which I just pushed (and includes the fix). |
Great - will do. Thanks. |
Ran into a bunch of issues when trying to export a font where it looked like the letter spacing and line height / bounding box were all messed up:
Finally figured it out that the setting options.unitsPerEm = 1000 regardless of the font's UPM solved the issue:
This is Merriweather Sans with a UPM of 2048, but exported at 1000.
Also, the blinking cursor seems to be the right height, but the selection area seems to be too small:
I'm on Windows, I tried this out in PowerPoint, Word, and Adobe Illustrator.
The text was updated successfully, but these errors were encountered: