The Multi-Line view is a reflowable text preview area for use with vanilla, with support for zoom and glyph selection. This is the same component which is used to display glyphs in the Space Center.

from mojo.UI import MultiLineView
from vanilla import Window

class MultiLineViewExample:

    def __init__(self, font):

        self.w = Window((600, 400), minSize=(300, 300))

        self.w.lineView = MultiLineView(
                (0, 0, -0, -0),
                pointSize=30,
                selectionCallback=self.lineViewSelectionCallback)
        self.w.lineView.setFont(font)

        glyphs = [font[glyphName] for glyphName in font.glyphOrder]

        self.w.lineView.set(glyphs)

        self.w.open()

    def lineViewSelectionCallback(self, sender):
        print(sender.getSelectedGlyph())

MultiLineViewExample(CurrentFont())
Last edited on 01/09/2021