def getFontFileType():
	# took the following out, add in as needed: 'Mac TrueType font':ftMACTRUETYPE, 'Mac Type 1 font':ftMACTYPE1, 'Mac TrueType DFONT':ftMACTRUETYPE_DFONT, 'PC Type 1 font (binary/PFB)':ftTYPE1, 'PC MultipleMaster font (PFB)':ftTYPE1_MM, 'PC Type 1 font (ASCII/PFA)':ftTYPE1ASCII, 'PC MultipleMaster font (ASCII/PFA)':ftTYPE1ASCII_MM
	fontTypes = {'PC TrueType/TT OpenType font (TTF)':ftTRUETYPE, 'PS OpenType (CFF-based) font (OTF)':ftOPENTYPE}
	fontType = OneList(fontTypes.keys(), 'What type of font do you want?')
	if fontType is not None:
		return fontTypes[fontType]
	else:
		return None
Exemple #2
0
def _findFile(fontPath, message):
	dir, fileName = os.path.split(fontPath)
	fileList = []
	names = os.listdir(dir)
	for n in names:
		if n[-4:] != '.ufo' or n[-4:] != '.vfb' or n[-4:] != '.bak':
			fileList.append(n)
	fileList.append('Look elsewhere')
	f = OneList(fileList, message)
	if f == 'Look elsewhere':
		filePath = GetFile(message)
	elif f == None:
		filePath = None
	else:
		filePath = os.path.join(dir, f)
	return filePath
Exemple #3
0
def fuse(font):
	readGlyphList = getDataFile(font.path, 'Choose a dump file')
	if readGlyphList is not None:
		# Check to make sure that all compontents are present in the font
		checkedGlyphList = checkGlyphs(font, readGlyphList)
		if len(checkedGlyphList) == 0:
			mark = AskYesNoCancel('Do you wish to mark changed glyphs?')
			if mark != -1:
				saveBackup = AskYesNoCancel('Do you want a backup of changed glyphs?')
				if saveBackup != -1:
					makeGlyph(readGlyphList, font, 'Updating glyphs', mark, saveBackup)
					font.update()
					Message('Done updating glyphs')
		else:
			# Gives a list of the components missing from the VFB
			OneList(checkedGlyphList, 'Sorry, your VFB is missing:')
def getFontFileType():
	fontTypes = {'Mac TrueType font':ftMACTRUETYPE, 'Mac Type 1 font':ftMACTYPE1, 'Mac TrueType DFONT':ftMACTRUETYPE_DFONT, 'PC TrueType/TT OpenType font (TTF)':ftTRUETYPE, 'OpenType (PS) font (OTF)':ftOPENTYPE, 'PC Type 1 font (binary/PFB)':ftTYPE1, 'PC MultipleMaster font (PFB)':ftTYPE1_MM, 'PC Type 1 font (ASCII/PFA)':ftTYPE1ASCII, 'PC MultipleMaster font (ASCII/PFA)':ftTYPE1ASCII_MM}
	keysSorted = caseinsensitive_sort(fontTypes.keys())
	fontType = OneList(keysSorted, 'What type of font do you want?')
	return fontTypes[fontType]
	Message('This Font does not have a MM axis')

else:
	
	#Get the family name
	family = AskString('Family Name')
	if family is None:
		family = AskString('Please enter a Family Name')

	#Get number of axis
	numberOfAxis = math.log(fontMM[0].layers_number, 2)
	numberOfAxis = int(numberOfAxis)
	
	#Get the axis info
	if numberOfAxis >= 1:
		firstAxisType = OneList(axisTypes, 'What type is the first axis?')
		if firstAxisType is not None:
			axisTypes.remove(firstAxisType)
			axisInFont[firstAxisType] = getInstances(firstAxisType)
			axisTypesInOrder.append(firstAxisType)
		
	if numberOfAxis >= 2:
		secondAxisType = OneList(axisTypes, 'What type is the second axis?')
		if secondAxisType is not None:
			axisTypes.remove(secondAxisType)
			axisInFont[secondAxisType] = getInstances(secondAxisType)
			axisTypesInOrder.append(secondAxisType)
		
	if numberOfAxis >= 3:
		thirdAxisType = OneList(axisTypes, 'What type is the third axis?')
		if thirdAxisType is not None:
Exemple #6
0
from robofab.interface.all.dialogs import SelectFont, OneList, ProgressBar
from robofab.world import NewFont

src1 = SelectFont('Select source font one:')
if src1:
    src2 = SelectFont('Select source font two:')
    if src2:
        # collect a list of all compatible glyphs
        common = []
        for glyphName in src1.keys():
            if src2.has_key(glyphName):
                if src1[glyphName].isCompatible(src2[glyphName]):
                    common.append(glyphName)
        common.sort()
        selName = OneList(common, 'Select a glyph:')
        if selName:
            dest = NewFont()
            g1 = src1[selName]
            g2 = src2[selName]
            count = 1
            bar = ProgressBar('Interpolating...', 100)
            # add the sourec one glyph for reference
            dest.newGlyph(selName + '_000')
            dest[selName + '_000'].width = src1[selName].width
            dest[selName + '_000'].appendGlyph(src1[selName])
            dest[selName + '_000'].mark = 1
            dest[selName + '_000'].update()
            # add a new glyph and interpolate it
            while count != 100:
                factor = count * .01