Skip to content
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

Option to manipulate xAvgCharWidth #1167

Merged
merged 2 commits into from
Apr 12, 2023
Merged

Conversation

Finii
Copy link
Collaborator

@Finii Finii commented Apr 12, 2023

Description

[why]
Some old applications seem to depend on obsolete xAvgCharWidth values to
show 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 the xAvgCharWidth as base for
the 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:

  • If not specified the behavior of the patcher does not change
  • If just given the xAvgCharWidth is copied over from the source
  • If a number is added that number is used as xAvgCharWidth
  • If the number added is zero we will calculate the old style xAvgCharWidth

Fixes: #522

Requirements / Checklist

What does this Pull Request (PR) do?

Add possibility to manipulate the OS/2 table entry xAvgCharWidth, which fontforge 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)

Finii added 2 commits April 12, 2023 16:02
[why]
When we have a ttc and tweak the contained fonts we recalculate the
total checksum after each tweak while we only need to tweak it after all
changes (included fonts) have been tweaked.

[how]
Pull the total checksum recalculation out of the subfonts loop.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
[why]
Some old applications seem to depend on obsolete xAvgCharWidth values to
show 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 the xAvgCharWidth as base for
the 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`:
* If not specified the behavior of the patcher does not change
* If just given the xAvgCharWidth is copied over from the source
* If a number is added that number is used as xAvgCharWidth
* If the number added is zero we will calculate the old style xAvgCharWidth

Fixes: #522

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii merged commit 156f9bf into master Apr 12, 2023
@Finii Finii deleted the feature/manipulate-avgxwidth branch April 12, 2023 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong letter space after patching Korean font
1 participant