Missing fonts in UFOOperator built programatically.
I'm trying to create a UFOOperator on the fly using fonts that are open in RoboFont. I'm adding sources with addSource with the font object set in the SourceDescriptor. However, getFonts() doesn't return the fonts after the UFOOperator is populated. It looks like self.fonts is only updated in loadFonts and updateFonts with the latter being dependent on the fonts already existing. Should self.fonts update when addSource is called or should self.fonts be updated by the entity that called addSource?
The demo below runs in RoboFont with > 1 one open.
from ufoProcessor.ufoOperator import UFOOperator
from fontTools import designspaceLib
fonts = AllFonts()
axisTag = "cool"
ufoOperator = UFOOperator()
axis = designspaceLib.AxisDescriptor(
tag=axisTag,
name="Cool Axis",
minimum=0,
maximum=len(fonts)-1,
default=0
)
ufoOperator.addAxis(axis)
for i, font in enumerate(fonts):
source = designspaceLib.SourceDescriptor(
filename=f"source.{i}",
path=font.path,
name=f"source.{i}",
font=font.asDefcon(),
location={axisTag : i}
)
ufoOperator.addSource(source)
print("getFonts():")
print(ufoOperator.getFonts())
print("")
print("iterate through sources:")
for source in ufoOperator.sources:
print(source.name, source.font)
there could be a one way sync: when a script adds a sourceDescriptor operator could check if a font is given. If there is one add it to the operator.fonts dict: https://github.com/LettError/ufoProcessor/blob/master/Lib/ufoProcessor/ufoOperator.py#L286-L290