Draft
edit

When opening a font in the interface, RoboFont needs to load data from all glyphs in the font – in order to render the glyph cells in the Font Overview, and to build the font’s unicode map (used when typing text in the Space Center, for example).

In the UFO format, each glyph is stored as a separate .glif file inside the UFO package; the more glyphs in a font, the more individual files need to be parsed. Because of this, fonts with a large amount of glyphs can have a negative impact on the speed and performance of RoboFont.

To make the opening of large fonts faster, RoboFont includes a preference setting to control the maximum amount of glyphs which are loaded when a font is opened. The remaining glyphs can be loaded later, if required.

This page gives an overview of all settings and dialogs related to working with fonts with a large amount of glyphs in RoboFont.

Setting the maximum amount of glyphs

The maximum amount of glyphs which are loaded when a font is opened is controlled by the setting Max glyph count to read instantly from disk in the Character Set Preferences. The default value is 2000 glyphs.

This preference is stored internally as loadFontGlyphLimit, and can also be edited with the Preferences Editor.

Opening Large Fonts warning

When opening a font which contains more glyphs than the limit defined in the Max glyph count preference, a pop-up window with a warning will appear:

Click on the OK button to close the dialog. Select the checkbox if you don’t want RoboFont to show this message again.

If you have previously selected the Don’t show this message again checkbox, and wish to undo this choice: use the Preferences Editor to set the warningsLevel setting to always.

‘Load All Glyphs’ button

When a font containing more glyphs than the Max glyph count limit is opened, a small button labeled Load All Glyphs will appear at the bottom left of the Font Overview window. Pressing this button will force RoboFont to load data from all glyphs in the font.

Simple font window

An alternative to loading just a limited amount of glyphs from a large font is loading all glyphs using a simplified font window. Instead of the usual Font Overview interface with glyph cells, we can use Python to create a simpler (and faster) font window with only a plain list of glyph names. Double-clicking a glyph name opens a Glyph Editor for that glyph.

from AppKit import NSURL, NSDocumentController
from vanilla import Window, List
from defconAppKit.windows.baseWindow import BaseWindowController
from lib.doodleDocument import DoodleDocument
from mojo.UI import OpenGlyphWindow, OpenSpaceCenter, OpenFontInfoSheet

class SimpleFontWindow(BaseWindowController):
    
    def __init__(self, font):
        
        self._font = font
        
        if font.path:
            document = DoodleDocument.alloc().init()
            document.setFileURL_(NSURL.fileURLWithPath_(font.path))

            dc = NSDocumentController.sharedDocumentController()
            dc.addDocument_(document)
        
        self._canUpdateChangeCount = True
        
        self.w = Window((250, 500), "SimpleFontWindow", minSize=(200, 300))
        
        glyphs = font.keys()
        glyphs.sort()
        
        self.w.glyphs = List((0, 0, -0, -0), glyphs, doubleClickCallback=self.openGlyph)
        
        toolbarItems = [
                dict(itemIdentifier="spaceCenter",
                     label="Space Center",
                     imageNamed="toolbarSpaceCenterAlternate",
                     callback=self.openSpaceCenter
                     ),
                dict(itemIdentifier="fontInfo",
                     label="Font Info",
                     imageNamed="toolbarFontInfo",
                     callback=self.openFontInfo
                     )
                ]
        self.w.addToolbar(toolbarIdentifier="SimpleToolbar", toolbarItems=toolbarItems)
        
        windowController = self.w.getNSWindowController()
        windowController.setShouldCloseDocument_(True)
        self._font.UIdocument().addWindowController_(windowController)
                
        self._font.addObserver(self, "fontChanged", "Font.Changed")

        self.setUpBaseWindowBehavior()
        self.w.open()
    
    def openGlyph(self, sender):
        sel = sender.getSelection()
        if sel:
            i = sel[0]        
            name = sender[i]
            self._canUpdateChangeCount = False
            OpenGlyphWindow(self._font[name])
            self._canUpdateChangeCount = True
                
    def openSpaceCenter(self, sender):
        self._canUpdateChangeCount = False
        OpenSpaceCenter(self._font)
        self._canUpdateChangeCount = True
    
    def openFontInfo(self, sender):
        self._canUpdateChangeCount = False
        OpenFontInfoSheet(self._font, self.w)
        self._canUpdateChangeCount = True
    
    # notifications
    def fontChanged(self, notification):
        if self._canUpdateChangeCount:
            self._font.UIdocument().updateChangeCount_(0)
    
    
fonts = OpenFont(showInterface=False)
if not isinstance(fonts, list):
    fonts = [fonts]

for font in fonts:
    SimpleFontWindow(font)

  • redo last screenshots
  • fix display bug in Character Set Preferences
Last edited on 26/06/2018