Created
November 3, 2020 19:12
-
-
Save eduairet/bc23b338b75c779d38a7edbb75882cdf to your computer and use it in GitHub Desktop.
This gist is intended to be used with the DrawBot app to test your Variable Fonts in an easy way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist is intended to be used with the DrawBot app to test your Variable Fonts in an easy way | |
x, y = 1920, 1080 # Set your canvas width and Height | |
myFont = '/path/VarFont.ttf' # Paste the path of your font | |
installFont(myFont) # Install the font | |
print(listFontVariations(myFont)) # Get the Data of your variable font | |
# Set variables for the axes you want to try | |
minVal = listFontVariations(myFont)['wght']['minValue'] | |
maxVal = listFontVariations(myFont)['wght']['maxValue'] | |
newPage(x, y) # Draw your Canvas | |
# Set your Slider(s) | |
Variable( | |
[dict( | |
name="Weight", | |
ui="Slider", | |
args=dict(value=1, minValue = minVal, maxValue = maxVal))], | |
#To add an extra axis, uncomment the code bellow and erase the closing square bracket before this comment | |
#dict( | |
#name="Height", | |
#ui="Slider", | |
#args=dict(value=2, minValue = minHeight, maxValue = maxHeight))], | |
globals() | |
) | |
font(myFont) | |
fontSize(300) | |
fontVariations(wght = Weight) | |
text("Test text", (x/2,y/2), align=('center')) | |
font('Menlo') | |
fontSize(40) | |
fontVariations(resetVariations=True) | |
text('wght = {0}'.format(Weight), (x/2, y*0.2), align=('center')) | |
uninstallFont(myFont) # Uninstall the font |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment