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

Reading familyName from public.fontInfo and writing into variable font #1113

Open
ryanbugden opened this issue Jul 29, 2024 · 5 comments
Open

Comments

@ryanbugden
Copy link

When I generate a variable font, the public.fontInfo['familyName'] doesn't seem to be considered during compilation.
I see there has been some work done on the fontTools side. Is there still some work to be done there, or is the ball in the fontmake court?
fonttools/fonttools#2606

I have a workflow set up wherein there is a working dated Beta variable font being distributed while a final font is being tested/developed/not distributed. I need these variable fonts to have different family names from each other, and ideally, I would like to not have to change the family name of the default source UFO during the generation workflow.

Thanks!

@ryanbugden
Copy link
Author

Here is a small test setup. After running build.sh and looking at TestTest_Variable.ttx, "Foobar" still makes it into crucial nameIDs.

variable font name test.zip

P.S. Should this issue be placed in ufo2ft? Apologies if so!

@anthrotype
Copy link
Member

thanks for the bug report and the reproducer. It is supposed to work, yes. Support for "public.fontInfo" key of <variable-font><lib> is implemented in ufo2ft, so the bug belongs there but it's ok, we can take a look.

@anthrotype
Copy link
Member

ok so, the variable-font's public.fontInfo below

          <key>public.fontInfo</key>
          <dict>
            <key>familyName</key>
            <string>TestTest Variable</string>
            <key>styleMapFamilyName</key>
            <string>TestTest Variable</string>
            <key>styleMapStyleName</key>
            <string>regular</string>
            <key>styleName</key>
            <string>Regular</string>
          </dict>

currently generates the following name table:

  <name>
    <namerecord nameID="256" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Weight
    </namerecord>
    <namerecord nameID="257" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Foobar2
    </namerecord>
    <namerecord nameID="258" platformID="1" platEncID="0" langID="0x0" unicode="True">
      Foobar 1
    </namerecord>
    <namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
      TestTest Variable
    </namerecord>
    <namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
      Regular
    </namerecord>
    <namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
      0.000;NONE;Foobar-Foobar2
    </namerecord>
    <namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
      Foobar Foobar2
    </namerecord>
    <namerecord nameID="5" platformID="3" platEncID="1" langID="0x409">
      Version 0.000
    </namerecord>
    <namerecord nameID="6" platformID="3" platEncID="1" langID="0x409">
      Foobar-Foobar2
    </namerecord>
    <namerecord nameID="16" platformID="3" platEncID="1" langID="0x409">
      Foobar
    </namerecord>
    <namerecord nameID="17" platformID="3" platEncID="1" langID="0x409">
      Foobar2
    </namerecord>
    <namerecord nameID="18" platformID="3" platEncID="1" langID="0x409">
      Foobar Foobar2
    </namerecord>
    <namerecord nameID="256" platformID="3" platEncID="1" langID="0x409">
      Weight
    </namerecord>
    <namerecord nameID="257" platformID="3" platEncID="1" langID="0x409">
      Foobar2
    </namerecord>
    <namerecord nameID="258" platformID="3" platEncID="1" langID="0x409">
      Foobar 1
    </namerecord>
  </name>

@ryanbugden just to confirm, is the expected result that all the occurrences of "Foobar" be replaced by "TestTest Variable" (i.e. the overridden value of familyName)?

@anthrotype
Copy link
Member

I see what's going on. Basically the variable-font's public.fontInfo gets merged into the default UFO's fontinfo.plist, overriding those individual fields that are mentioned in the former, but the other ones that you do not override stay unchanged. The merged info is then used to build the various tables, including name table.
In your particular case, I see the string "Foobar" is also present in more name fields than the particular ones you are overriding in the public.fontInfo key, e.g. the openTypeNamePreferredFamilyName, postscriptFontName and others.
Either you have to override each of those with your desired string, or if you wish ufo2ft to generate the rest from a basic set of core name strings you have to remove the more specific ones from the default UFO's fontinfo.plist.
I hope this makes sense.

@ryanbugden
Copy link
Author

Thank you for looking into this @anthrotype ! That all makes sense now. I'm curious as to how I can override nameID 16 and 17. Overriding all of the font info keys that are in the default UFO, as below, doesn't seem to remove Foobar and Foobar 2 as those two name IDs.

            <key>familyName</key>
            <string>TestTest Variable</string>
            <key>styleName</key>
            <string>Regular</string>
            <key>styleMapFamilyName</key>
            <string>TestTest Variable</string>
            <key>styleMapStyleName</key>
            <string>regular</string>
            <key>postscriptFontName</key>
            <string>TestTest-Variable</string>
            <key>postscriptFullName</key>
            <string>TestTestVariable</string>
            <key>postscriptWeightName</key>
            <string>Normal</string>
            <key>openTypeNameCompatibleFullName</key>
            <string>TestTest Variable</string>
            <key>openTypeNamePreferredFamilyName</key>
            <string>TestTest Variable</string>
            <key>openTypeNamePreferredSubfamilyName</key>
            <string>Regular</string>

Unrelated, but is there a standard for how to treat the style/subfamily name in a variable font? Follow the default instance? Fold that style name into FullNames as well?

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

No branches or pull requests

2 participants