Option to manipulate xAvgCharWidth #1167
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
[why]
Some old applications seem to depend on obsolete
xAvgCharWidth
values toshow two-cell glyphs correctly. Fontforge can only generate OS/2 tables
version 4, but these applications need 2 or less. In fact they seem to
not look up the version number, but rely on the value being like it
always has been ;-)
One example is Windows
notepad
, that takes thexAvgCharWidth
as base forthe cell size and draws the two-cell chars in a cell twice that size -
without any regard to glyph width.
[how]
These issue seems to be encountered rather seldom and only with some
obscure (grin) applications. There is also no good way to handle this
automatically. So we add a command line option that allows the user to
tweak the value after patched-font generation.
The option is called
--xavgcharwidth
:xAvgCharWidth
is copied over from the sourcexAvgCharWidth
xAvgCharWidth
Fixes: #522
Requirements / Checklist
What does this Pull Request (PR) do?
Add possibility to manipulate the OS/2 table entry
xAvgCharWidth
, whichfontforge
does not allow to modify and always fills with 'modern' values.How should this be manually tested?
Any background context you can provide?
https://learn.microsoft.com/en-us/typography/opentype/spec/os2#xavgcharwidth
https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6OS2.html
fontforge/fontforge#4899
https://forum.glyphsapp.com/t/font-custom-parameters/1174
What are the relevant tickets (if any)?
Screenshots (if appropriate or helpful)