Open mattlag opened 9 years ago
Also, if two glyphs share a unicode value, Font.download() fails. Ideally duplicates would be ignored as opposed to causing failures.
Also, x/y values cannot be decimal, they have to be whole integers, otherwise font creation fails.
I'm just going to collect all my notes about the issues I ran into in this issue :-)
I believe the spec supports decimal point positions
Perhaps duplicates would be automatically generated as components, if the spec really doesn't allow this? :)
“Font.glyphs must be sorted by Unicode”: that shouldn’t be a requirement. A lot of space can be saved when glyph order and glyph classes in GPOS/GSUB are optimized by range.
Having “two glyphs share a unicode value” is wrong, the cmap doesn’t allow that.
I can implement the sorting. I still don't understand (nor can I find any docs about) if the fonts do need to be sorted, but we can implement it as an option.
You're right about the .notdef glyph. That's an important one. I think step 1 is to mention it in the docs, but it would be interesting if we could generate a warning if it's not there.
More generally, I was thinking about a linter that would check for these kinds of issues. If anyone's interested?
@davelab6 could you point me to the spec about decimal values? I also was under the impression only integers were allowed.
Thanks, everyone. These are just things that currently cause Font.download to fail - whether or not they should cause failures is a good discussion :-)
Decimal values would be nice to have, lots of the math for flat handles cause lots of decimals. And at 1000upm, rounding can actually cause visible discrepancies.
I think a linter would be fantastic for people constructing their own Font objects! Right now it's just trial and error for me :-)
Was the sorting option implemented on this? I'm having issue with Stix font (https://sourceforge.net/projects/stixfonts/), when downloaded the resulting font produces an error with OTS-sanitize as well as with Chrome: OTS parsing error: cmap: Out of order end range (54272 <= 65533)
. The original font tests and loads fine however. I'm wondering if this could be sorting issue with how segments are sorted?
For Glyphr Studio, I'm generating an opentype.Font object manually. I was getting lots of 'not a valid font file' errors as a result of Font.download() - and I discovered it was just because the Font.glyphs array was not sorted. Specifically:
Ideally, opentype.js would do this sorting. And, even better, add a default .notdef glyph if there isn't one.
At the very least, this should be added to the Readme example.
Thanks!