This is quite simple question I think, but I need to print some random text in the preview tab (not in console) from the macro. How do I do that? like Glyphs.font.glyphs.text(‘A’)
What is a preview tab?
when you dbl click on a glyph and you can write to test… whats that called? maybe thats why i didnt find anything in the doc
You mean you want to set the text in an Edit Tab? Or open a new tab with some text?
Font.newTab("Hello World")
1 Like
for my propose is the same… I’ll generate the string and I want to display it in any edit tab. could be current or new one
Thanks - What if I need to add more text to that current tab?
import random
random.seed()
rnd = random.randint ( 0,6 )
letters = [
['F','/F.ss01','/F.ss02','/F.ss03','/F.ss06','/F.ss07','/F.ss08'],
['O','/O.ss01','/O.ss02','/O.ss03','/O.ss06','/O.ss07','/O.ss08'],
['N','/N.ss01','/N.ss02','/N.ss03','/N.ss06','/N.ss07','/N.ss08'],
['T','/T.ss01','/T.ss02','/T.ss03','/T.ss06','/T.ss07','/T.ss08']
]
Font.newTab(letters[0][random.randint ( 0,6 )] + letters[1][random.randint ( 0,6 )] + letters[2][random.randint ( 0,6 )] + letters[3][random.randint ( 0,6 )])
Anyone notice why this code just print only 2 letters instead of 4? Also sometimes print FT others NT… it’s just weird
You can do:
Font.currentTab.text = newText
Try adding a ‘/’ before the single letters.
1 Like