Skip to content

Commit

Permalink
Modifying the Nerdfonts sources & build script
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbell committed Nov 20, 2019
1 parent 3858ad7 commit 6ed2bab
Show file tree
Hide file tree
Showing 1,847 changed files with 5,886 additions and 591,362 deletions.
32 changes: 16 additions & 16 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
" ", ""
)
file_path = OUTPUT_DIR / file_name
file_pathNF = OUTPUT_DIR / "CascadiaNF.ttf"
#file_pathNF = OUTPUT_DIR / "CascadiaNF.ttf"
file_pathPL = OUTPUT_DIR / "CascadiaPL.ttf"

# 4. Creating NerdFont variants
instanceNF = generator.generate_instance(instance_descriptor) #rebuilding these instead of as a deepcopy avoids an error when compiling the TTF
#instanceNF = generator.generate_instance(instance_descriptor) #rebuilding these instead of as a deepcopy avoids an error when compiling the TTF
instancePL = generator.generate_instance(instance_descriptor)


Expand All @@ -47,19 +47,19 @@
setattr(instanceNF.info,"openTypeOS2Panose",[2,11,6,9,2,0,0,2,0,4])
setattr(instancePL.info,"openTypeOS2Panose",[2,11,6,9,2,0,0,2,0,4])

instanceNF.info.familyName = "Cascadia Code NF"
#instanceNF.info.familyName = "Cascadia Code NF"
instancePL.info.familyName = "Cascadia Code PL"

#4.2 GET BACK TO WORK

NF_UFO = ufoLib2.objects.font.Font.open(INPUT_DIR / "nerdfonts" / "NerdfontsNF.ufo")
#NF_UFO = ufoLib2.objects.font.Font.open(INPUT_DIR / "nerdfonts" / "NerdfontsNF.ufo")
PL_UFO = ufoLib2.objects.font.Font.open(INPUT_DIR / "nerdfonts" / "NerdfontsPL.ufo")

#4.5 Adding glyphs
print ("Adding Nerd Font glyphs")
for glyph in NF_UFO.glyphOrder:
if glyph not in instanceNF.glyphOrder:
instanceNF.addGlyph(NF_UFO.get(glyph))
#for glyph in NF_UFO.glyphOrder:
# if glyph not in instanceNF.glyphOrder:
# instanceNF.addGlyph(NF_UFO.get(glyph))

for glyph in PL_UFO.glyphOrder:
if glyph not in instancePL.glyphOrder:
Expand All @@ -68,50 +68,50 @@
# 5. Generate non-Ligature versions

instance_noLIG = copy.deepcopy(instance)
instanceNF_noLIG = copy.deepcopy(instanceNF)
#instanceNF_noLIG = copy.deepcopy(instanceNF)
instancePL_noLIG = copy.deepcopy(instancePL)

with open(INPUT_DIR / "features" / "features.fea", 'r') as feaCode:
noLIG_fea = feaCode.read()

instance_noLIG.features.text = noLIG_fea
instanceNF_noLIG.features.text = noLIG_fea
#instanceNF_noLIG.features.text = noLIG_fea
instancePL_noLIG.features.text = noLIG_fea

instance_noLIG.info.familyName = "Cascadia Mono"
instanceNF_noLIG.info.familyName = "Cascadia Mono NF"
#instanceNF_noLIG.info.familyName = "Cascadia Mono NF"
instancePL_noLIG.info.familyName = "Cascadia Mono PL"

# 6. Compile all TTFs
print ("Compiling")

instance_font = ufo2ft.compileTTF(instance, removeOverlaps=True, inplace=True)
instanceNF_font = ufo2ft.compileTTF(instanceNF, removeOverlaps=True, inplace=True)
#instanceNF_font = ufo2ft.compileTTF(instanceNF, removeOverlaps=True, inplace=True)
instancePL_font = ufo2ft.compileTTF(instancePL, removeOverlaps=True, inplace=True)

instance_noLIG_font = ufo2ft.compileTTF(instance_noLIG, removeOverlaps=True, inplace=True)
instanceNF_noLIG_font = ufo2ft.compileTTF(instanceNF_noLIG, removeOverlaps=True, inplace=True)
#instanceNF_noLIG_font = ufo2ft.compileTTF(instanceNF_noLIG, removeOverlaps=True, inplace=True)
instancePL_noLIG_font = ufo2ft.compileTTF(instancePL_noLIG, removeOverlaps=True, inplace=True)

#7. Merge VTT hinting code
print ("Adding VTT Code")
vtt_data_file = (INPUT_DIR / "vtt_data" / "CascadiaCode.ttx")
vttLib.transfer.merge_from_file(instance_font, vtt_data_file)
vttLib.transfer.merge_from_file(instanceNF_font, vtt_data_file)
#vttLib.transfer.merge_from_file(instanceNF_font, vtt_data_file)
vttLib.transfer.merge_from_file(instancePL_font, vtt_data_file)
vttLib.transfer.merge_from_file(instance_noLIG_font, vtt_data_file)
vttLib.transfer.merge_from_file(instanceNF_noLIG_font, vtt_data_file)
#vttLib.transfer.merge_from_file(instanceNF_noLIG_font, vtt_data_file)
vttLib.transfer.merge_from_file(instancePL_noLIG_font, vtt_data_file)

# 8. Save
print ("Saving")
OUTPUT_DIR.mkdir(exist_ok=True)
instance_font.save(file_path.with_name("Cascadia.ttf"))
instanceNF_font.save(file_path.with_name("CascadiaNF.ttf"))
#instanceNF_font.save(file_path.with_name("CascadiaNF.ttf"))
instancePL_font.save(file_path.with_name("CascadiaPL.ttf"))

instance_noLIG_font.save(file_path.with_name("CascadiaMono.ttf"))
instanceNF_noLIG_font.save(file_path.with_name("CascadiaMonoNF.ttf"))
#instanceNF_noLIG_font.save(file_path.with_name("CascadiaMonoNF.ttf"))
instancePL_noLIG_font.save(file_path.with_name("CascadiaMonoPL.ttf"))

print ("All done")
Expand Down
68 changes: 0 additions & 68 deletions sources/nerdfonts/NerdfontsNF.ufo/fontinfo.plist

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6ed2bab

Please sign in to comment.