def generateGlyphsToFont(self, exportFont=None, layerName=None):
     font = RFont(showUI=False) if exportFont is None else exportFont
     currentFont = self.currentFont
     filterName = self.currentFilterName
     currentFilter = self.filters[filterName]
     if currentFont is not None and len(currentFont.selection):
         glyphs = [currentFont[glyphName] for glyphName in currentFont.selection if glyphName in currentFont]
         for glyph in glyphs:
             if len(glyph.components) > 0:
                 for comp in glyph.components:
                     baseGlyphName = comp.baseGlyph
                     baseGlyph = currentFont[baseGlyphName]
                     baseFilteredGlyph = currentFilter(baseGlyph)
                     newFont.insertGlyph(baseFilteredGlyph, baseGlyphName)
                     newFont[baseGlyphName].unicode = baseFilteredGlyph.unicode
             filteredGlyph = currentFilter(glyph)
             if filteredGlyph is not None:
                 if exportFont is None:
                     font.insertGlyph(filteredGlyph, glyph.name)
                 else:
                     glyph = font[glyph.name] if layerName is None else font[glyph.name].getLayer(layerName)
                     glyph.clearContours()
                     glyph.clearComponents()
                     glyph.appendGlyph(filteredGlyph)
         font.showUI()
     else:
         message(u'PenBallWizard', 'No selected glyphs to generate')
Beispiel #2
0
 def generateGlyphsToFont(self, exportFont=None, layerName=None):
     font = RFont(showUI=False) if exportFont is None else exportFont
     currentFont = self.currentFont
     filterName = self.currentFilterName
     currentFilter = self.filters[filterName]
     if currentFont is not None and len(currentFont.selection):
         glyphs = [
             currentFont[glyphName] for glyphName in currentFont.selection
             if glyphName in currentFont
         ]
         for glyph in glyphs:
             if len(glyph.components) > 0:
                 for comp in glyph.components:
                     baseGlyphName = comp.baseGlyph
                     baseGlyph = currentFont[baseGlyphName]
                     baseFilteredGlyph = currentFilter(baseGlyph)
                     newFont.insertGlyph(baseFilteredGlyph, baseGlyphName)
                     newFont[
                         baseGlyphName].unicode = baseFilteredGlyph.unicode
             filteredGlyph = currentFilter(glyph)
             if filteredGlyph is not None:
                 if exportFont is None:
                     font.insertGlyph(filteredGlyph, glyph.name)
                 else:
                     glyph = font[
                         glyph.name] if layerName is None else font[
                             glyph.name].getLayer(layerName)
                     glyph.clearContours()
                     glyph.clearComponents()
                     glyph.appendGlyph(filteredGlyph)
         font.showUI()
     else:
         message(u'PenBallWizard', 'No selected glyphs to generate')
 def generateGlyphsToFont(self, sender):
     newFont = RFont(showUI=False)
     font = self.currentFont
     filterName = self.currentFilterName
     currentFilter = self.filters[filterName]
     if font is not None:
         glyphs = [font[glyphName] for glyphName in font.selection if glyphName in font]
         for glyph in glyphs:
             if len(glyph.components) > 0:
                 for comp in glyph.components:
                     baseGlyphName = comp.baseGlyph
                     baseGlyph = font[baseGlyphName]
                     baseFilteredGlyph = currentFilter(baseGlyph)
                     newFont.insertGlyph(baseFilteredGlyph, baseGlyphName)
                     newFont[baseGlyphName].unicode = baseFilteredGlyph.unicode
             filteredGlyph = currentFilter(glyph)
             if filteredGlyph is not None:
                 newFont.insertGlyph(filteredGlyph, glyph.name)
         newFont.showUI()
Beispiel #4
0
#coding=utf-8

from mutatorScale.objects.scaler import MutatorScaleEngine
from mutatorScale.utilities.fontUtils import intersect
from robofab.world import RFont

paths = [
    'testFonts/two-axes/regular-low-contrast.ufo',
    'testFonts/two-axes/bold-low-contrast.ufo'
]
outputPath = 'testFonts/two-axes/scaled-low-contrast.ufo'

fonts = []
for p in paths:
    fonts.append(RFont(p))

scaler = MutatorScaleEngine(fonts)
scaler.set({'scale': (0.85, 0.8)})

outputFont = RFont()
for glyphName in 'AHIO':
    glyph = scaler.getScaledGlyph(glyphName, (95, 75))
    outputFont.insertGlyph(glyph, glyphName)

outputFont.save(outputPath)
Beispiel #5
0
#coding=utf-8

from mutatorScale.objects.scaler import MutatorScaleEngine
from mutatorScale.utilities.fontUtils import intersect
from robofab.world import RFont

paths = [
    'testFonts/two-axes/regular-low-contrast.ufo',
    'testFonts/two-axes/bold-low-contrast.ufo'
]
outputPath = 'testFonts/two-axes/scaled-low-contrast.ufo'

fonts = []
for p in paths:
    fonts.append(RFont(p))

scaler = MutatorScaleEngine(fonts)
scaler.set({
'scale' : (0.85, 0.8)
})

outputFont = RFont()
for glyphName in 'AHIO':
    glyph = scaler.getScaledGlyph(glyphName, (95, 75))
    outputFont.insertGlyph(glyph, glyphName)

outputFont.save(outputPath)