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
[merge] OS/2 table Mixed Versions Crash #1865
Comments
Hit this again trying to merge fonts A and B, with A and B having OS/2 table versions of 1 and 3, respectively. |
I see that OS/2 v5 has a fonttools/Lib/fontTools/merge.py Line 298 in c89c948
we just need to handle the new attributes. |
from what I can tell in https://docs.microsoft.com/en-us/typography/opentype/spec/OS2#lps, it should be enough that we take the min() of all the fonts' |
@ClintGoss that's strange, v1 and v3 are supported and the merger should already take the maximum between the OS/2 versions. Can you provide a test font, the exact command you run and the error you got? |
Ah I see. The merger is not handling attributes like |
Glad you see the issue ... because it is actually difficult for me to isolate a demonstration case. I've got merge and pyftsubset running hundreds of times in a rather arcane and massive pipeline / build process. |
Got a crash in pyftmerge when merging several fonts with OS/2 tables that have mixed versions.
If a font with a v5 OS/2 table follows font(s) with v4 OS/2 tables, I get:
File "C:\App\Python37\lib\site-packages\fontTools\misc\loggingTools.py", line 375, in wrapper
return func(*args, **kwds)
File "D:\Kurinto\Bin\Bin_CG\kmerge.py", line 1196, in main
font.save(outfile)
File "C:\App\Python37\lib\site-packages\fontTools\ttLib\ttFont.py", line 173, in save
writer_reordersTables = self._save(tmp)
File "C:\App\Python37\lib\site-packages\fontTools\ttLib\ttFont.py", line 212, in _save
self._writeTable(tag, writer, done, tableCache)
File "C:\App\Python37\lib\site-packages\fontTools\ttLib\ttFont.py", line 633, in _writeTable
tabledata = self.getTableData(tag)
File "C:\App\Python37\lib\site-packages\fontTools\ttLib\ttFont.py", line 651, in getTableData
return self.tables[tag].compile(self)
File "C:\App\Python37\lib\site-packages\fontTools\ttLib\tables\O_S_2f_2.py", line 152, in compile
d['usLowerOpticalPointSize'] = round(self.usLowerOpticalPointSize * 20)
AttributeError: 'table_O_S_2f_2' object has no attribute 'usLowerOpticalPointSize'
Confession: I have not done any serious debugging here. I am hypothesizing the cause of the failure ... but it does seem reasonable given that, when I hacked my one font with a v5 OS/2 table to v4, the issue went away.
The text was updated successfully, but these errors were encountered: