-
Notifications
You must be signed in to change notification settings - Fork 457
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
[ttLib/pyftmerge] Handle cmap merge better #635
Conversation
I was trying to merge Emoji fonts so I could get some color emoji on my Windows 7 machine occasionally when I discovered that |
class CmapMergeUnitTest(unittest.TestCase): | ||
def setUp(self): | ||
self.merger = Merger() | ||
self.table1 = ttLib.getTableClass('cmap')('cmap') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use ttLib.newTable()
Thanks for this! I left a few minor comments. Please address those and I'll merge. |
Changed the merge algorithm to properly handle cmap subtables of type 4 and 12 with platform id and encoding ids of 3/1 and 3/10 respectively. All other subtables are not merged and ignored. The resulting merged cmap table includes a subtable of format 4/3/1 and a format 12 subtable iff there are mappings outside of the BMP. If one font has two codepoints that point to the same glyph, and another font has the same code points pointing to two other glyphs, keep the behavior where the first replacement glyph is stored in 'locl' and output the third glpyh (or more) to let the user know that they were dropped, instead of failing to merge the font. Fixes fonttools#444 Fixes fonttools#322
Amended my commit with your recommendations :) |
Thanks! |
Changed the merge algorithm to properly handle cmap subtables
of type 4 and 12 with platform id and encoding ids of 3/1 and 3/10
respectively. All other subtables are not merged and ignored.
The resulting merged cmap table includes a subtable of format 4/3/1
and a format 12 subtable iff there are mappings outside of the BMP.
If one font has two codepoints that point to the same glyph,
and another font has the same code points pointing to two other glyphs,
keep the behavior where the first replacement glyph is stored in 'locl'
and output the third glpyh (or more) to let the user know that they were
dropped, instead of failing to merge the font.
Fixes #444
Fixes #322