mojo.glyphPreview

class GlyphPreview()

A vanilla Group subclass that is able to display a glyph.

from vanilla import Window
from mojo.glyphPreview import GlyphPreview

class SimpleGlyphWindow:

    def __init__(self, glyph):

        self.w = Window((400, 400), glyph.name, minSize=(100, 100))

        self.w.glyphPreview = GlyphPreview((0, 0, -0, -0))
        self.w.glyphPreview.setGlyph(glyph)

        selection = [(p.x, p.y) for p in glyph.selectedPoints]
        self.w.glyphPreview.setSelection(selection)

        self.w.open()

SimpleGlyphWindow(CurrentGlyph())

The following custom colors can be passed as NSColor objects when initializing the preview:

  • contourColor
  • contourStrokeColor
  • componentColor
  • componentStrokeColor
  • selectionColor
Inherits from subclass: mojo.glyphPreview.GlyphPreview

setGlyph(glyph)

Set a glyph into the preview.

Last edited on 18/03/2024