Description
I’ve realized what I was doing wrong, but I’m leaving the issue in case someone else has the same issue in the future. An explanation is at the bottom of this comment.
My problem
I’m building fonts from a Glyphs source, but having trouble applying ufo2ft filters.
For example, here’s what I’m getting when I try to add --filter PropagateAnchors
.
▶ fontmake -g "Familyname.glyphspackage" -o variable --output-path "variable_ttf/Familyname-Variable.ttf" --filter PropagateAnchors
usage: fontmake [-h] [--version] [-g GLYPHS | -u UFO [UFO ...] | -m DESIGNSPACE] [--glyph-data GLYPHDATA] [-o FORMAT [FORMAT ...]] [--output-path OUTPUT_PATH | --output-dir OUTPUT_DIR] [-i [INSTANCE_NAME]] [--variable-fonts [VARIABLE_FONT_FILENAME]] [-M]
[--family-name FAMILY_NAME] [--round-instances] [--designspace-path DESIGNSPACE_PATH] [--master-dir MASTER_DIR] [--instance-dir INSTANCE_DIR] [--no-write-skipexportglyphs] [--validate-ufo] [--check-compatibility | --no-check-compatibility]
[--expand-features-to-instances] [--fea-include-dir FEA_INCLUDE_DIR] [--no-generate-GDEF] [--save-ufo-as-zip | --ufo-structure {package,zip,json}] [--indent-json] [--keep-overlaps] [--overlaps-backend BACKEND] [--keep-direction]
[--ttf-curves {cu2qu,mixed,keep-quad,keep-cubic}] [-e ERROR] [-f] [-a [AUTOHINT]] [-A] [--cff-round-tolerance FLOAT] [--optimize-cff OPTIMIZE_CFF] [--subroutinizer {compreffor,cffsubr}] [--no-optimize-gvar] [--filter CLASS] [--no-auto-use-my-metrics]
[--drop-implied-oncurves] [--interpolate-binary-layout [MASTER_DIR]] [--feature-writer CLASS] [--debug-feature-file FILE] [--mti-source MTI_SOURCE] [--production-names | --no-production-names] [--subset | --no-subset] [-s | -S] [--timing]
[--verbose LEVEL]
[INPUTS ...]
fontmake: error: Failed to load --filter:
AttributeError: module 'ufo2ft.filters' has no attribute 'PropagateAnchors'
I’m also having trouble running --filter DecomposeTransformedComponentsFilter
, even though I am following the format suggested in USAGE.md:
DecomposeTransformedComponents
: Decomposes any components which have a non-identity transformation matrix (i.e. which are translated or scaled). For example, au
glyph from ann
component flipped horizontally. Fonts constructed in this way can have rasterizing and hinting errors (see here and here). To fix fonts with these errors, add--filter DecomposeTransformedComponentsFilter
to thefontmake
command line.
I’m building in a venv, with versions:
- FontMake
3.7.1
- ufo2ft
2.33.4
FontMake seems to be building without issue, otherwise.
Am I missing something?
One additional question
How can I run multiple filters? Would I add it twice, like --filter DecomposeTransformedComponentsFilter --filter PropagateAnchors
, or once, with a comma-separated list, like --filter DecomposeTransformedComponentsFilter,PropagateAnchors
, or in some other way?
UPDATE: I figured it out
I was missing something: it isn’t --filter PropagateAnchors
, it’s --filter PropagateAnchorsFilter
(with the Filter
on the end).
Also, yes, using two filters seems to work well like this:
fontmake -g "familyname.glyphs" -o variable --filter DecomposeTransformedComponentsFilter --filter PropagateAnchorsFilter
Possible improvement to docs?
I was trying to use --filter PropagateAnchors
because in USAGE.md, the filter is listed as simply PropagateAnchors
– with code highlighting, suggesting that it is the literal code expected. However, the actual argument required is PropagateAnchorsFilter
, with the repeated word "Filter". Maybe the docs should include this "Filter" with the labels? So, it could be adjusted like this:
- `PropagateAnchors`: Creates additional anchors for composite glyphs based on the anchors of their components.
+ `PropagateAnchorsFilter`: Creates additional anchors for composite glyphs based on the anchors of their components.
Or, perhaps even better, maybe these args could be simplified to also work with the simpler arg: --filter PropagateAnchors
? I’m not sure what it would take to make this work, though, and it may not be worth the added lines of code.
Maintainers: feel free to close this if no action seems warranted. I just figured I might suggest possible improvements. Thanks!
Activity