-
Notifications
You must be signed in to change notification settings - Fork 43
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
Document lib keys modifying ufo2ft's behavior #286
base: main
Are you sure you want to change the base?
Conversation
8a7a7e7
to
e77743f
Compare
Oops, missed conversionError and reverseDirection. I think I was looking for conversionError actually (googlefonts/cu2qu#158). The setup of the filter chain is... convoluted. compileTTF shadows TTFPreProcessor shadows CubicToQuadraticFilter... |
Oops once more, pre and post mean:
|
This is really helpful; thanks for starting it! I have a question that I’m unsure about, even after looking at your docs and the UFO spec: How would I add multiple ufo2ft filters? For example, I’d like to add both the This seems to work, mostly (but has a partially unexpected result for the flattenComponents filter, whether or not I use the decomposeComponents filter): <key>com.github.googlei18n.ufo2ft.filters</key>
<array>
<dict>
<key>name</key>
<string>flattenComponents</string>
<key>pre</key>
<integer>1</integer>
</dict>
<dict>
<key>name</key>
<string>decomposeComponents</string>
<key>include</key>
<array>
<string>quotesingle</string>
<string>quotedbl</string>
<string>quoteleft</string>
<string>quoteright</string>
<string>quotedblleft</string>
<string>quotedblright</string>
<string>quotesinglbase</string>
<string>quotedblbase</string>
</array>
</dict>
</array> In Python: font.lib["com.github.googlei18n.ufo2ft.filters"] = [
{
'name': 'flattenComponents',
'pre': 1
},
{
'name': 'decomposeComponents',
'include': "quotesingle quotedbl quoteleft quoteright quotedblleft quotedblright quotesinglbase quotedblbase".split()
},
] |
Right on the money, except |
yep |
Does it matter that Stephen's approach<key>pre</key>
<integer>1</integer> instead of: documentation approach<key>pre</key>
<true /> ? |
Don't think so. Both evaluate to |
I ended my string with
<key>com.github.googlei18n.ufo2ft.filters</key>
<array>
<dict>
<key>include</key>
<array>
<string>quotesingle</string>
<string>quotedbl</string>
<string>quoteleft</string>
<string>quoteright</string>
<string>quotedblleft</string>
<string>quotedblright</string>
<string>quotesinglbase</string>
<string>quotedblbase</string>
</array>
<key>name</key>
<string>decomposeComponents</string>
</dict>
<dict>
<key>name</key>
<string>decomposeTransformedComponents</string>
<key>pre</key>
<integer>1</integer>
</dict>
<dict>
<key>name</key>
<string>flattenComponents</string>
<key>pre</key>
<integer>1</integer>
</dict>
</array> My RoboFont script, in case it’s relevant (Click to expand)from vanilla.dialogs import *
inputFonts = getFile("select UFOs", allowsMultipleSelection=True, fileTypes=["ufo"])
for fontPath in inputFonts:
font = OpenFont(fontPath, showInterface=False)
# for other font info attributes, see
# http://unifiedfontobject.org/versions/ufo3/fontinfo.plist/
font.info.openTypeOS2VendorID = "ARRW"
font.info.copyright = "Copyright 2017-2020 Arrow Type"
# un-nest nested components # https://github.com/googlefonts/fontbakery/issues/296
font.lib["com.github.googlei18n.ufo2ft.filters"] = [
{
'name': 'decomposeComponents',
'include': "u b q d p arrowleft arrowup arrowright arrowdown arrowrighttail arrowlefttailfeather arrowlefttriangle \
nine Adieresis.titl Odieresis.titl Udieresis.titl Odieresis.RECT_titl Udieresis.RECT_titl \
quotesingle quotedbl quoteleft quoteright quotedblleft quotedblright quotesinglbase quotedblbase".split()
},
{
'name': 'decomposeTransformedComponents',
'pre': 1
},
{
'name': 'flattenComponents',
'pre': 1
},
]
print("Updated info for:")
print("family: ", font.info.familyName, "\n ", "style: ", font.info.styleName)
font.save()
font.close() |
Plists keys are sorted alphabetically. |
right, but an array (of dicts, or whatever) should keep the order.And the filter order matters |
But looking at the script the filters are in order? |
Tackle #240.
Stub stub.
PS: You can copy-paste it into e.g. https://livesphinx.herokuapp.com/ to get a rendered preview.