is there a way to convert defcon glyph object to RGlyph?

  • it is again me, maybe again with a quite trivial question

    glyphWindow.getGlyph() returns defcon object.
    I want to use it like an RGlyph (the method which usually uses RGlyph as a parameter, in some cases has to glyphWindow.getGlyph()) to access the points. Like this:

    from mojo.UI import AllGlyphWindows
    for glyphWindow in AllGlyphWindows():
       glyphWindow.getGlyph()[0].points # throws error, because it doesn't have points attr, and RFont does

    Is there a way to get RFont out of Defcon object? or to treat defcon glyph like fontParts glyph object?
    Or you think that I should create another method for defcon objects than for RFont that does the same thing? (I guess making more methods can cause more troubles with the debugging in the future)

  • admin

    hi Rafał, I’ve been there too :)

    you can wrap an RGlyph around a defcon glyph, like this:

    for glyphWindow in AllGlyphWindows():
        # get RGlyph from defcon glyph
        g = RGlyph(glyphWindow.getGlyph())
        # do stuff using the FontParts API