Print some text in 'preview tab'

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 :slight_smile:

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

    rnd = random.randint ( 0,6 )

    letters = [

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