RedHatOfficial / RedHatFont

Red Hat's Open Source Fonts - Red Hat Display and Red Hat Text
SIL Open Font License 1.1
479 stars 55 forks source link

Enable fsSelection bit 6 for non-RIBBI fonts #22

Closed m4rc1e closed 5 years ago

m4rc1e commented 5 years ago

At Google Fonts, we need to enable OS/2.fsSelection bit 6 in non-RIBBI fonts in order for them to work in Google Docs. This Pr enables bit 6 when the user runs ttfPostProcess.py.

I've bumped the version number to v1.004. It's currently v1.003.

I've regenerated the fonts. Here's the output from Diffenator when I compare v1.003 against v1.004 for the Text family.

Bold

Displaying the 50 most significant items in each table. To increase use the '-ol' flag

names modified: 4

id string_a string_b
(3, 1, 0, 0) 1.003;MCKL;RedHatText-Bold 1.004;MCKL;RedHatText-Bold
(3, 3, 1, 1033) 1.003;MCKL;RedHatText-Bold 1.004;MCKL;RedHatText-Bold
(5, 1, 0, 0) Version 1.003; Red Hat Text Bold Version 1.004; Red Hat Text Bold
(5, 3, 1, 1033) Version 1.003; Red Hat Text Bold Version 1.004; Red Hat Text Bold

attribs modified: 2

table attrib value_a value_b
head modified 2019/04/08 20:50:54 2019/07/01 13:45:43
head fontRevision 1.00299 1.004

Bold Italic

Displaying the 50 most significant items in each table. To increase use the '-ol' flag

names modified: 4

id string_a string_b
(3, 1, 0, 0) 1.003;MCKL;RedHatText-BoldItalic 1.004;MCKL;RedHatText-BoldItalic
(3, 3, 1, 1033) 1.003;MCKL;RedHatText-BoldItalic 1.004;MCKL;RedHatText-BoldItalic
(5, 1, 0, 0) Version 1.003; Red Hat Text Bold Italic Version 1.004; Red Hat Text Bold Italic
(5, 3, 1, 1033) Version 1.003; Red Hat Text Bold Italic Version 1.004; Red Hat Text Bold Italic

attribs modified: 3

table attrib value_a value_b
OS/2 fsSelection 801 289
head modified 2019/04/08 20:50:54 2019/07/01 13:45:43
head fontRevision 1.00299 1.004

Italic

Displaying the 50 most significant items in each table. To increase use the '-ol' flag

names modified: 4

id string_a string_b
(3, 1, 0, 0) 1.003;MCKL;RedHatText-Italic 1.004;MCKL;RedHatText-Italic
(3, 3, 1, 1033) 1.003;MCKL;RedHatText-Italic 1.004;MCKL;RedHatText-Italic
(5, 1, 0, 0) Version 1.003; Red Hat Text Italic Version 1.004; Red Hat Text Italic
(5, 3, 1, 1033) Version 1.003; Red Hat Text Italic Version 1.004; Red Hat Text Italic

attribs modified: 3

table attrib value_a value_b
OS/2 fsSelection 769 257
head fontRevision 1.00299 1.004
head modified 2019/04/08 20:50:54 2019/07/01 13:45:44

Medium

Displaying the 50 most significant items in each table. To increase use the '-ol' flag

names modified: 4

id string_a string_b
(3, 1, 0, 0) 1.003;MCKL;RedHatText-Medium 1.004;MCKL;RedHatText-Medium
(3, 3, 1, 1033) 1.003;MCKL;RedHatText-Medium 1.004;MCKL;RedHatText-Medium
(5, 1, 0, 0) Version 1.003; Red Hat Text Medium Version 1.004; Red Hat Text Medium
(5, 3, 1, 1033) Version 1.003; Red Hat Text Medium Version 1.004; Red Hat Text Medium

attribs modified: 3

table attrib value_a value_b
OS/2 fsSelection 256 320
head modified 2019/04/08 20:50:54 2019/07/01 13:45:43
head fontRevision 1.00299 1.004

Medium Italic

Displaying the 50 most significant items in each table. To increase use the '-ol' flag

names modified: 4

id string_a string_b
(3, 1, 0, 0) 1.003;MCKL;RedHatText-MediumItalic 1.004;MCKL;RedHatText-MediumItalic
(3, 3, 1, 1033) 1.003;MCKL;RedHatText-MediumItalic 1.004;MCKL;RedHatText-MediumItalic
(5, 1, 0, 0) Version 1.003; Red Hat Text Medium Italic Version 1.004; Red Hat Text Medium Italic
(5, 3, 1, 1033) Version 1.003; Red Hat Text Medium Italic Version 1.004; Red Hat Text Medium Italic

attribs modified: 3

table attrib value_a value_b
OS/2 fsSelection 769 257
head modified 2019/04/08 20:50:55 2019/07/01 13:45:44
head fontRevision 1.00299 1.004

Regular

Displaying the 50 most significant items in each table. To increase use the '-ol' flag

names modified: 4

id string_a string_b
(3, 1, 0, 0) 1.003;MCKL;RedHatText-Regular 1.004;MCKL;RedHatText-Regular
(3, 3, 1, 1033) 1.003;MCKL;RedHatText-Regular 1.004;MCKL;RedHatText-Regular
(5, 1, 0, 0) Version 1.003; Red Hat Text Version 1.004; Red Hat Text
(5, 3, 1, 1033) Version 1.003; Red Hat Text Version 1.004; Red Hat Text

attribs modified: 2

table attrib value_a value_b
head modified 2019/04/08 20:50:55 2019/07/01 13:45:44
head fontRevision 1.00299 1.004

As we can see, the nametable records indicate the version number has been bumped and the fontRevision also shows the new version number. The fsSelection is greater for non-RIBBI styles since it now set to Regular. The fsSelection is also less for Italic fonts because the Oblique fsSelection bit has been disabled. The results are the same for the Display family.

No other changes have been made to the fonts. To verify this for yourself you can use fontdiffenator. If you want raw diffs, convert the fonts to .ttx using fonttools and compare them using a differ such as vimdiff.

Note: Non-RIBBI fonts are any fonts not in [Regular, Italic, Bold, Bold Italic].

m4rc1e commented 5 years ago

It would be better to change the fsSelection bit in the sources, instead of using this post processing approach. Unfortunately, I wasn't able to do this. If anyone is able to adjust the fsSelection in the sources, I'll happily close this pr. I may take a stab at this later.

Keep this open for now.

benkiel commented 5 years ago

@m4rc1e, Jeremy asked me to look at this and fix without the post process. I'm currently on vacation, but should have a PR for fixing it by Tuesday of next week.

m4rc1e commented 5 years ago

Fabulous thank you!. I'll close this pr.

benkiel commented 5 years ago

@m4rc1e To confirm the above as I work through this, when you said "fsSelection is also less for Italic because the Oblique fsSelection bit has been disabled", you meant that your code didn't change this, but that the prior change to the WWS selection bits, turning off Oblique, changed this, correct?