Single Window Mode + separate font overview



  • Is it possible to open a separate font overview window? :)

    Cheers Thom


  • admin

    You will have to write a tiny script that takes a font and creates a new window with a glyph collection view. Any double click could then open a glyph window.

    Could you elaborate why you would need a second (or multiple) font overviews?

    I can make you an example, if you wish...



  • I want the glyph collection view on a second screen. And all the rest on the main screen. :)

    I would like an example. Many thanks Frederik!

    Thom



  • I have this... But it is buggy. See if you scroll. If you change a glyph the factory doest work, only after scrolling/clicking on the overview.. Here I need a bit help :)

    from vanilla import *
    from defconAppKit.controls.glyphCollectionView import *
    from defconAppKit.windows.baseWindow import BaseWindowController
    from mojo.UI import SetCurrentGlyphByName
    
    class MyFont(BaseWindowController):
    
        def __init__(self, glyphs):
            self.w = Window((900,600), '')
            self.w.collectionView = GlyphCollectionView((15, 15, -15, -65), doubleClickCallback=self.double, cellRepresentationName='doodle.GlyphCell')
            self.w.collectionView.setCellSize((100, 100))
            self.setUpBaseWindowBehavior()
            
            self.w.collectionView.preloadGlyphCellImages()
            self.w.collectionView.set(glyphs)
            self.updateTitle()
            self.w.open()
            
        def updateTitle(self):
            title = f.info.familyName +' - '+ f.info.styleName+',  '+ str(CurrentGlyph())
            self.w.setTitle(title)
            
        def double(self, sender):
            order = f.lib.get('public.glyphOrder')
            SetCurrentGlyphByName(order[self.w.collectionView.getSelection()[0]])
            self.updateTitle()
    
    f = CurrentFont()
    g = CurrentGlyph()
    
    glyphs = []
    for g in f.lib.get('public.glyphOrder'):
        glyphs.append(f[g])
    
    MyFont(glyphs)