is there a way to access “Number Values” parameter in each master via script?
Thank you.
is there a way to access “Number Values” parameter in each master via script?
Thank you.
I added it to the wrapper and the docu (both will be online soon).
Thank you!
I’m trying to access value with this code :
font = Glyphs.font
master = font.selectedFontMaster
print(master.numberValueForName_("newNumber").value)
It return me
<native-selector value of <GSInfoValue 0x60000467d680> 0>
What I’m doing wrong ?
Add a () after the value, like this: numberValueForName_(“name”).value()
Which is the method to add a Number Value to Font ?
I tried all method with GSFont, but I didn’t succeed.
Number values are set on masters.
I also tried all GSFontMaster Method…
I see, the wrapper code is not yet in the latest shipping version.
Here is what you can do in the meantime:
someMaster.setNumberValueValue_forName_(15, 'SomeName')
Got a couple questions on this same topic.
font = Glyphs.font
master = font.selectedFontMaster
print (master.numbers())
prints out something like this
(
"<GSInfoValue 0x600005be3120> 70",
"<GSInfoValue 0x600039b31920> 100",
)
# Access the current font
font = Glyphs.font
font.disableUpdateInterface()
# Iterate through all font masters
for master in font.masters:
# Check if the master's name is in our predefined dictionary
if master.name in master_values:
# Iterate through each name-value pair for this master
for name, value in master_values[master.name].items():
# Set the number value for this name
master.setNumberValueValue_forName_(value, name)
print(f"Set {name} to {value} for {master.name}")
else:
print(f"No predefined values for {master.name}")
font.enableUpdateInterface()