You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to turn the the UFOs plus Designspace at https://gitlab.gnome.org/GNOME/cantarell-fonts/tree/ufo-conversion/src into static instances, using varLib. This fails because VariationModelMutator._normalize does not take the axis mapping into consideration, it then passes bogus values to varLib that fails to find the neutral location.
frompathlibimportPathfromtypingimportOptionalimportfontTools.designspaceLibimportfontTools.varLibimportufoProcessorclassInMemoryDesignspaceProcessor(ufoProcessor.DesignSpaceProcessor):
defgenerateUFO(self, processRules=True, glyphNames=None, pairs=None, bend=True):
self.loadFonts()
self.findDefault()
ifself.defaultisNone:
raiseufoProcessor.UFOProcessorError(
"Can't generate UFO from this designspace: no default font.", self
)
forinstanceDescriptorinself.instances:
instanceDescriptor.font=self.makeInstance(
instanceDescriptor,
processRules,
glyphNames=glyphNames,
pairs=pairs,
bend=bend,
)
returnTrue# XXX: Works around bug in varLib that compares sourceDescriptor.location in design# space to defaultLoc in user space.deffindDefault(self) ->Optional[fontTools.designspaceLib.SourceDescriptor]:
"""Set and return SourceDescriptor at the default location or None. The default location is the set of all `default` values of all axes (user space). """self.default=Noneaxis_name_to_axis= {axis.name: axisforaxisinself.axes}
default_design_location= {
name: fontTools.varLib.models.piecewiseLinearMap(
value, dict(reversed(axis_name_to_axis[name].map))
)
forname, valueinself.defaultLoc.items()
}
forsourceDescriptorinself.sources:
ifsourceDescriptor.location==default_design_location:
self.default=sourceDescriptorreturnsourceDescriptorreturnNonedesignspace_path=Path("Cantarell.designspace")
designspace=InMemoryDesignspaceProcessor.fromfile(designspace_path)
designspace.useVarlib=Truedesignspace.generateUFO()
The text was updated successfully, but these errors were encountered:
madig
changed the title
AxisMapper._normalize does not handle axis mapping
VariationModelMutator._normalize does not handle axis mapping
Mar 8, 2019
It seems to me that AxisMapper only goes from user to design locations. Since in VariationModelMutator.__init__ we normalize the design locations but pass normalizeLocation the user min/max/default, we need to convert the design locations to user locations before passing them to _normalize.
I am trying to turn the the UFOs plus Designspace at https://gitlab.gnome.org/GNOME/cantarell-fonts/tree/ufo-conversion/src into static instances, using varLib. This fails because
VariationModelMutator._normalize
does not take the axis mapping into consideration, it then passes bogus values to varLib that fails to find the neutral location.Aside: A closer look at
AxisMapper._makeWarpFromList
shows that it appends a false default location:mapValues
is[(100.0, 20.0), (300.0, 40.0), (400.0, 80.0), (700.0, 126.0), (800.0, 170.0), (400.0, 400.0)]
because of https://github.com/LettError/ufoProcessor/blob/master/Lib/ufoProcessor/varModels.py#L29.Reproduction code snippet:
The text was updated successfully, but these errors were encountered: