Exemple #1
0
# robofab manual
# 	Generatefonts howto
#	usage examples

import os.path
from robofab.world import CurrentFont

font = CurrentFont()
path = font.path
dir, fileName = os.path.split(path)
path = os.sep.join([dir, font.info.fullName])
font.generate('mactype1', path)
# We'll put the fonts into a folder called "FabFonts" next the .vfb file
macPath = os.path.join(fontPath, 'FabFonts', 'ForMac')
pcPath = os.path.join(fontPath, 'FabFonts', 'ForPC')
bothPath = os.path.join(fontPath, 'FabFonts', 'ForBoth')

# Now, we'll use that little function we made earlier to make the folders
makeFolder(macPath)
makeFolder(pcPath)
makeFolder(bothPath)

# A dict of all the font types we want to output
fontTypes = {	'mac'	:	['mactype1', 'macttf', 'macttdfont'],
		'pc'	:	['pctype1', 'pcmm'],
		'both'	:	['otfcff', 'otfttf']
		}

# Finally, let's generate the fonts!
for macType in fontTypes['mac']:
	print "generating %s..."%macType
	font.generate(macType, macPath)
for pcType in fontTypes['pc']:
	print "generating %s..."%pcType
	font.generate(pcType, pcPath)
for bothType in fontTypes['both']:
	print "generating %s..."%bothType
	font.generate(bothType, bothPath)
print 'Done!'

# Wow! Could it be any easier than that?
# robofab manual
# Font object
#	method examples, available in FontLab
from robofab.world import CurrentFont
f = CurrentFont()

# the keys() method returns a list of glyphnames:
print f.selection

# generate font binaries
f.generate('otfcff')
# robofab manual
# Generatefonts howto
# usage examples

import os.path
from robofab.world import CurrentFont

font = CurrentFont()
path = font.path
dir, fileName = os.path.split(path)
path = os.sep.join([dir, font.info.fullName])
font.generate('mactype1', path)
Exemple #5
0
# robofab manual
# Font object
# method examples, available in FontLab

from robofab.world import CurrentFont
f = CurrentFont()

# the keys() method returns a list of glyphnames:
print f.selection

# generate font binaries
f.generate('otfcff')