Skip to content

Commit

Permalink
Remove google fonts submodule; add IBM Plex and Codeface submodules
Browse files Browse the repository at this point in the history
It turns out that every font we want is in Codeface except for Plex,
which
has its own git repo. So now all of our source fonts are submodulized!
  • Loading branch information
ToxicFrog committed Aug 31, 2018
1 parent d5db9c0 commit 9810633
Show file tree
Hide file tree
Showing 108 changed files with 42 additions and 36 deletions.
15 changes: 10 additions & 5 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
[submodule "fira"]
path = fira
url = https://github.com/tonsky/FiraCode
[submodule "google-fonts"]
path = input-fonts/google
url = https://github.com/google/fonts.git
path = fonts/fira
url = https://github.com/tonsky/FiraCode.git
shallow = true
[submodule "codeface"]
path = fonts/codeface
url = https://github.com/chrissimpkins/codeface.git
shallow = true
[submodule "plex"]
path = fonts/plex
url = https://github.com/IBM/plex.git
shallow = true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Here's a couple examples of the fonts generated: SF Mono & Menlo with ligatures

Use automatic mode to easily convert 1 or more font(s).

1. Put the font(s) you want into `input-fonts/`.
1. Put the font(s) you want into `fonts/`.
1. Edit `ligatures.py` to disable any ligatures you don't want, and/or enable any (non-ligature) characters you want from Fira Code in addition to the ligatures.
1. Edit `build.py` to add your new font(s) to the `prefixed_fonts` list. It supports globbing, so if (e.g.) you want to ligaturize all the different weights of FooFont you can add `'FooFont*'` to the list.
1. Run `make`.
Expand All @@ -49,7 +49,7 @@ Use automatic mode to easily convert 1 or more font(s).

### Manual ###

1. Move/copy the font you want to ligaturize into `input-fonts/` (or somewhere else convenient).
1. Move/copy the font you want to ligaturize into `fonts/` (or somewhere else convenient).
2. Edit `ligatures.py` to disable any ligatures you don't want.
3. Run the script:

Expand Down
41 changes: 20 additions & 21 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@

prefixed_fonts = [
# Apache 2.0 license
'google/apache/cousine/*.ttf',
'Droid*',
'Meslo*',
'google/apache/robotomono/*.ttf',
'fonts/codeface/fonts/cousine/*.ttf',
'fonts/codeface/fonts/droid-sans-mono/*.ttf',
'fonts/codeface/fonts/meslo/*.ttf',
'fonts/codeface/fonts/roboto-mono/*.ttf',

# MIT license
'DejaVu*',
'Hack*',
'fonts/codeface/fonts/dejavu-sans-mono/*.ttf',
'fonts/codeface/fonts/hack/*.ttf',

# SIL OFL with no Reserved Font Name
'Edlo*',
'FantasqueSansMono-Normal/*',
'google/ofl/inconsolata/*.ttf',
'fonts/codeface/fonts/edlo/*.ttf',
'fonts/codeface/fonts/fantasque-sans-mono/*.ttf',
'fonts/codeface/fonts/inconsolata/*.ttf',
]

#### Fonts that need to be renamed. ####
Expand All @@ -48,17 +48,17 @@
renamed_fonts = {
# This doesn't have a reserved name, but if we don't rename it it'll collide
# with its sibling Fantasque Sans Mono Normal, listed above.
'FantasqueSansMono-NoLoopK/*': 'Liga Fantasque Sans Mono NoLoopK',
'fonts/FantasqueSansMono-NoLoopK/*.otf': 'Liga Fantasque Sans Mono NoLoopK',

# SIL OFL with reserved name
'google/ofl/anonymouspro/*.ttf': 'Liganymous',
'google/ofl/ibmplexmono/*.ttf': 'Ligalex Mono',
'google/ofl/oxygenmono/*.ttf': 'Liga O2 Mono',
'google/ofl/sourcecodepro/*.ttf': 'LigaSrc Pro',
'SourceCodeVariable*': 'LigaSrc Variable',
'fonts/codeface/fonts/anonymous-pro/*.ttf': 'Liganymous',
'fonts/plex/IBM-Plex-Mono/fonts/complete/ttf/*.ttf': 'Ligalex Mono',
'fonts/codeface/fonts/oxygen-mono/*.otf': 'Liga O2 Mono',
'fonts/codeface/fonts/source-code-pro/*.ttf': 'LigaSrc Pro',
'fonts/SourceCodeVariable*': 'LigaSrc Variable',

# UFL
'google/ufl/ubuntumono/*.ttf': 'Ubuntu Mono Ligaturized',
'fonts/codeface/fonts/ubuntu-mono/*.ttf': 'Ubuntu Mono Ligaturized',
}

#### Fonts we can't ligaturize. ####
Expand All @@ -76,13 +76,12 @@

import sys
from glob import glob
from os import path
from ligaturize import ligaturize_font

for pattern in prefixed_fonts:
files = glob(path.join('input-fonts', pattern))
files = glob(pattern)
if not files:
print("Error: pattern 'input-fonts/%s' didn't match any files." % pattern)
print("Error: pattern '%s' didn't match any files." % pattern)
sys.exit(1)
for input_file in files:
ligaturize_font(
Expand All @@ -92,9 +91,9 @@
scale_character_glyphs_threshold=SCALE_CHARACTER_GLYPHS_THRESHOLD)

for pattern,name in renamed_fonts.iteritems():
files = glob(path.join('input-fonts', pattern))
files = glob(pattern)
if not files:
print("Error: pattern 'input-fonts/%s' didn't match any files." % pattern)
print("Error: pattern '%s' didn't match any files." % pattern)
sys.exit(1)
for input_file in files:
ligaturize_font(
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions fonts/codeface
Submodule codeface added at ac9064
Submodule fira updated from 000000 to ade27f
1 change: 1 addition & 0 deletions fonts/plex
Submodule plex added at c33c83
Binary file removed input-fonts/CamingoCode-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/DejaVuSansMono.ttf
Binary file not shown.
Binary file removed input-fonts/DroidSansMono.ttf
Binary file not shown.
Binary file removed input-fonts/Edlo.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed input-fonts/Hack-Bold.ttf
Binary file not shown.
Binary file removed input-fonts/Hack-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/MesloLGL-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/MesloLGLDZ-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/MesloLGM-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/MesloLGMDZ-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/MesloLGS-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/MesloLGSDZ-Regular.ttf
Binary file not shown.
Binary file removed input-fonts/SFMono-Regular.otf
Binary file not shown.
Binary file removed input-fonts/SFMono-Semibold.otf
Binary file not shown.
1 change: 0 additions & 1 deletion input-fonts/google
Submodule google deleted from 08b5f4
15 changes: 8 additions & 7 deletions ligaturize.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def get_ligature_source(fontname):
for weight in ['Bold', 'Retina', 'Medium', 'Regular', 'Light']:
if fontname.endswith('-' + weight):
# Exact match for one of the Fira Code weights
return 'fira/distr/otf/FiraCode-%s.otf' % weight
return 'fonts/fira/distr/otf/FiraCode-%s.otf' % weight

# No exact match. Guess that we want 'Bold' if the font name has 'Bold' in
# it, and 'Regular' otherwise.
if 'Bold' in fontname:
return 'fira/distr/otf/FiraCode-Bold.otf'
return 'fira/distr/otf/FiraCode-Regular.otf'
return 'fonts/fira/distr/otf/FiraCode-Bold.otf'
return 'fonts/fira/distr/otf/FiraCode-Regular.otf'

class LigatureCreator(object):

Expand Down Expand Up @@ -241,7 +241,8 @@ def update_font_metadata(font, new_name):
font.fullname = new_name
font.fontname = new_name.replace(' ', '')

print("Ligaturizing font '%s' as '%s'" % (old_name, new_name))
print("Ligaturizing font %s (%s) as '%s'" % (
path.basename(font.path), old_name, new_name))

font.copyright += COPYRIGHT
font.sfnt_names = tuple(
Expand All @@ -266,7 +267,7 @@ def ligaturize_font(input_font_file, output_dir, ligature_font_file,

update_font_metadata(font, name)

print('Reading ligatures from %s' % ligature_font_file)
print(' ...using ligatures from %s' % ligature_font_file)
firacode = fontforge.open(ligature_font_file)

creator = LigatureCreator(font, firacode, **kwargs)
Expand All @@ -284,7 +285,7 @@ def ligaturize_font(input_font_file, output_dir, ligature_font_file,

# Generate font & move to output directory
output_font_file = path.join(output_dir, font.fontname + '.ttf')
print("Saved ligaturized font '%s' as %s" % (font.fullname, output_font_file))
print(" ...saving to '%s' (%s)" % (output_font_file, font.fullname))
font.generate(output_font_file)


Expand All @@ -300,7 +301,7 @@ def parse_args():
parser.add_argument("--ligature-font-file",
type=str, default='', metavar='PATH',
help="The file to copy ligatures from. If unspecified, ligaturize will"
" attempt to pick a suitable one from fira/distr/otf/ based on the input"
" attempt to pick a suitable one from fonts/fira/distr/otf/ based on the input"
" font's weight.")
parser.add_argument("--copy-character-glyphs",
default=False, action='store_true',
Expand Down
Binary file modified output-fonts/LigaCousine-Bold.ttf
Binary file not shown.
Binary file modified output-fonts/LigaCousine-BoldItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigaCousine-Italic.ttf
Binary file not shown.
Binary file removed output-fonts/LigaCousine-Regular.ttf
Binary file not shown.
Binary file modified output-fonts/LigaCousine.ttf
Binary file not shown.
Binary file added output-fonts/LigaDejaVuSansMono-Bold.ttf
Binary file not shown.
Binary file added output-fonts/LigaDejaVuSansMono-BoldOblique.ttf
Binary file not shown.
Binary file added output-fonts/LigaDejaVuSansMono-Oblique.ttf
Binary file not shown.
Binary file modified output-fonts/LigaFantasqueSansMono-Bold.ttf
Binary file not shown.
Binary file modified output-fonts/LigaFantasqueSansMono-BoldItalic.ttf
Binary file not shown.
Binary file removed output-fonts/LigaFantasqueSansMono-Italic.ttf
Binary file not shown.
Binary file added output-fonts/LigaFantasqueSansMono-RegItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigaFantasqueSansMono-Regular.ttf
Binary file not shown.
Binary file modified output-fonts/LigaFantasqueSansMonoNoLoopK-Bold.ttf
Binary file not shown.
Binary file modified output-fonts/LigaFantasqueSansMonoNoLoopK-BoldItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigaHack-Bold.ttf
Binary file not shown.
Binary file added output-fonts/LigaHack-BoldItalic.ttf
Binary file not shown.
Binary file added output-fonts/LigaHack-Italic.ttf
Binary file not shown.
Binary file modified output-fonts/LigaHack-Regular.ttf
Binary file not shown.
Binary file modified output-fonts/LigaInconsolata-Bold.ttf
Binary file not shown.
Binary file modified output-fonts/LigaInconsolata-Regular.ttf
Binary file not shown.
Binary file removed output-fonts/LigaInconsolata-g-g.ttf
Binary file not shown.
Binary file removed output-fonts/LigaInconsolata.ttf
Binary file not shown.
Binary file removed output-fonts/LigaMesloLGL-Regular.ttf
Binary file not shown.
Binary file removed output-fonts/LigaMesloLGLDZ-Regular.ttf
Binary file not shown.
Binary file removed output-fonts/LigaMesloLGM-Regular.ttf
Binary file not shown.
Binary file added output-fonts/LigaMesloLGMDZ-Bold.ttf
Binary file not shown.
Binary file added output-fonts/LigaMesloLGMDZ-BoldItalic.ttf
Binary file not shown.
Binary file added output-fonts/LigaMesloLGMDZ-Italic.ttf
Binary file not shown.
Binary file removed output-fonts/LigaMesloLGS-Regular.ttf
Binary file not shown.
Binary file removed output-fonts/LigaMesloLGSDZ-Regular.ttf
Binary file not shown.
Binary file modified output-fonts/LigaO2Mono-Regular.ttf
Binary file not shown.
Binary file modified output-fonts/LigaRobotoMono-Bold.ttf
Binary file not shown.
Binary file modified output-fonts/LigaRobotoMono-BoldItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigaRobotoMono-Italic.ttf
Binary file not shown.
Binary file modified output-fonts/LigaRobotoMono-Regular.ttf
Binary file not shown.
Binary file removed output-fonts/LigaRobotoMonoLight-Light.ttf
Binary file not shown.
Binary file removed output-fonts/LigaRobotoMonoLight-LightItalic.ttf
Binary file not shown.
Binary file removed output-fonts/LigaRobotoMonoMedium-Medium.ttf
Binary file not shown.
Binary file removed output-fonts/LigaRobotoMonoMedium-MediumItalic.ttf
Binary file not shown.
Binary file removed output-fonts/LigaRobotoMonoThin-Thin.ttf
Binary file not shown.
Binary file removed output-fonts/LigaRobotoMonoThin-ThinItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigaSrcPro-Black.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-BlackIt.ttf
Binary file not shown.
Binary file modified output-fonts/LigaSrcPro-Bold.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-BoldIt.ttf
Binary file not shown.
Binary file modified output-fonts/LigaSrcPro-ExtraLight.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-ExtraLightIt.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-It.ttf
Binary file not shown.
Binary file modified output-fonts/LigaSrcPro-Light.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-LightIt.ttf
Binary file not shown.
Binary file modified output-fonts/LigaSrcPro-Medium.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-MediumIt.ttf
Binary file not shown.
Binary file modified output-fonts/LigaSrcPro-Regular.ttf
Binary file not shown.
Binary file removed output-fonts/LigaSrcPro-SemiBold.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-Semibold.ttf
Binary file not shown.
Binary file added output-fonts/LigaSrcPro-SemiboldIt.ttf
Binary file not shown.
Binary file modified output-fonts/LigaSrcVariable-Roman.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-ExtraLight.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-ExtraLightItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-Italic.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-Light.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-LightItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-Medium.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-MediumItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-Text.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-TextItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-Thin.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono-ThinItalic.ttf
Binary file not shown.
Binary file modified output-fonts/LigalexMono.ttf
Binary file not shown.
Binary file modified output-fonts/Liganymous-Bold.ttf
Binary file not shown.
Binary file modified output-fonts/Liganymous-BoldItalic.ttf
Binary file not shown.
Binary file modified output-fonts/Liganymous-Italic.ttf
Binary file not shown.
Binary file removed output-fonts/Liganymous-Regular.ttf
Binary file not shown.
Binary file modified output-fonts/Liganymous.ttf
Binary file not shown.
Binary file modified output-fonts/UbuntuMonoLigaturized-Italic.ttf
Binary file not shown.
Binary file modified output-fonts/UbuntuMonoLigaturized-Regular.ttf
Binary file not shown.

0 comments on commit 9810633

Please sign in to comment.