예제 #1
0
def copy_fonts(font_awesome_src, target_font_dir):
    font_dir = os.path.join(font_awesome_src, 'webfonts')
    fonts = [os.path.join(font_dir, src_name) for src_name in FONTS]
    dest_path = os.path.join(target_font_dir, FONT_FILENAME)

    print(f'Merging fonts: {fonts} -> {dest_path}')
    merger = Merger()
    with merger.merge(fonts) as font:
        font.save(dest_path)

    rename_font_family(dest_path)
예제 #2
0
def simpleMerger(fontsPath, style, newName, onlySecureSet=False): #path of actual fonts
    print("start merging")
    merger = Merger()
    print(fontsPath)
    mergedFont = merger.merge(fontsPath)
    destination = newFolderForMerged("NotoCombined/fonts/TTF")
    if not os.path.exists(destination):
        os.makedirs(destination)
    mergedFontPath = os.path.join(destination, "NotoCombined"+style+".ttf")
    mergedFont.save(mergedFontPath)
    print(mergedFontPath)
    renameFonts("NotoCombined", newName)

    return os.path.abspath(os.path.join(destination, os.pardir))
def basicMerger(masterfont, *fontsToAdd, onlySecureSet=False):
    fontsPath = []
    fontsPath.append(masterfont)
    for ft in fontsToAdd:
        fontsPath.append(ft)
    #merge
    merger = Merger()
    mergedFont = merger.merge(fontsPath)
    flavor = str(os.path.basename(masterfont).split(".")[-1])
    if onlySecureSet is True:
        destination = masterfont.replace(os.path.basename(masterfont), "")
    else:
        new = os.path.basename(masterfont).split("-")[0]
        for i in fontsToAdd:
            new += i.replace("Noto", "")
        destination = newFolderForMerged(new)
    if not os.path.exists(destination):
        os.makedirs(destination)
    mergedFontPath = os.path.join(destination, os.path.basename(masterfont))
    mergedFont.save(mergedFontPath)
예제 #4
0
def main(dropOldGSUB, dropOldGPOS, fea, fontTarget):
    target = ttLib.TTFont(fontTarget)

    # make a font that only has the tables from the fea
    feaFont = ttLib.TTFont()
    Builder(fea, feaFont).build()

    merger = Merger()
    merger.duplicateGlyphsPerFont = [{}]
    tables = [(k, feaFont[k]) for k in feaFont.keys() if k != 'GlyphOrder']
    for k,table in tables:
        if k not in target \
                or (k == 'GSUB' and dropOldGSUB) \
                or (k == 'GPOS' and dropOldGPOS):
            print('replacing:', k, 'of', fontTarget)
            target[k] = table
        else: # merge
            print('merging:', k, 'into', fontTarget)
            target[k].merge(merger, [table])

    target.save(fontTarget)
    target.close()
예제 #5
0
def main(dropOldGSUB, dropOldGPOS, fea, fontTarget):
    target = ttLib.TTFont(fontTarget)

    # make a font that only has the tables from the fea
    feaFont = ttLib.TTFont()
    Builder(fea, feaFont).build()

    merger = Merger()
    merger.duplicateGlyphsPerFont = [{}]
    tables = [(k, feaFont[k]) for k in feaFont.keys() if k != 'GlyphOrder']
    for k, table in tables:
        if k not in target \
                or (k == 'GSUB' and dropOldGSUB) \
                or (k == 'GPOS' and dropOldGPOS):
            print('replacing:', k, 'of', fontTarget)
            target[k] = table
        else:  # merge
            print('merging:', k, 'into', fontTarget)
            target[k].merge(merger, [table])

    target.save(fontTarget)
    target.close()
예제 #6
0
	def setUp(self):
		self.merger = Merger()

		self.table1 = ttLib.newTable('gasp')
		self.table1.version = 1
		self.table1.gaspRange = {
			0x8: 0xA ,
			0x10: 0x5,
		}

		self.table2 = ttLib.newTable('gasp')
		self.table2.version = 1
		self.table2.gaspRange = {
			0x6: 0xB ,
			0xFF: 0x4,
		}

		self.result = ttLib.newTable('gasp')
예제 #7
0
	def setUp(self):
		self.merger = Merger()
		self.table1 = ttLib.newTable('cmap')
		self.table2 = ttLib.newTable('cmap')
		self.mergedTable = ttLib.newTable('cmap')
		pass
예제 #8
0
def _merge_and_recompile(fontfiles, options=None):
	merger = Merger(options)
	merged = merger.merge(fontfiles)
	buf = _compile(merged)
	return ttLib.TTFont(buf)
def mergePowerlineFont(fontpath, powerlineFontPath):

    merged = Merger().merge([fontpath, powerlineFontPath])

    merged.save(fontpath)
예제 #10
0
 def mergeBitStreams(bsList, outfile):
     m = Merger()
     bsio = [BytesIO(s) for s in bsList]
     font = m.merge(bsio)
     font.save(outfile)