Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify build.py #3

Merged
merged 1 commit into from
Feb 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
language: python
python: 3.8
sudo: required
install:
- sudo add-apt-repository ppa:fontforge/fontforge -y
- sudo apt-get update -qq
- sudo apt-get install fontforge
- pip install -r requirements.txt
- pip install https://github.com/behdad/fonttools/zipball/master
dist: bionic
addons:
apt:
sources:
# for some reason python3-fontforge is only available in focal
- sourceline: 'deb http://us.archive.ubuntu.com/ubuntu/ focal main restricted'
- sourceline: 'deb http://us.archive.ubuntu.com/ubuntu/ focal universe'
packages:
- python3
- python3-fontforge
- python3-jinja2
- python3-fonttools
script:
- make
deploy:
Expand Down
37 changes: 15 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
PYTHON = python3
REGULAR = RictyDiminished-with-FiraCode-Regular.ttf
REGULAR_UNLINK = RictyDiminished-with-FiraCode-Regular-unlinked.ttf
BOLD = RictyDiminished-with-FiraCode-Bold.ttf
Expand All @@ -10,38 +11,30 @@ BOLD_DISCORD_UNLINK = RictyDiminishedDiscord-with-FiraCode-Bold-unlinked.ttf
all: $(REGULAR) $(BOLD) $(REGULAR_DISCORD) $(BOLD_DISCORD)

$(REGULAR): $(REGULAR_UNLINK) ligatures.fea
python apply-feature.py "$(word 1, $^)" "$@"
$(PYTHON) apply-feature.py "$(word 1, $^)" "$@"

$(BOLD): $(BOLD_UNLINK) ligatures.fea
python apply-feature.py "$(word 1, $^)" "$@"
$(PYTHON) apply-feature.py "$(word 1, $^)" "$@"

$(REGULAR_DISCORD): $(REGULAR_DISCORD_UNLINK) ligatures.fea
python apply-feature.py "$(word 1, $^)" "$@"
$(PYTHON) apply-feature.py "$(word 1, $^)" "$@"

$(BOLD_DISCORD): $(BOLD_DISCORD_UNLINK) ligatures.fea
python apply-feature.py "$(word 1, $^)" "$@"
$(PYTHON) apply-feature.py "$(word 1, $^)" "$@"

ligatures.fea: ligatures.fea.jinja2 data.json build-feature.py
python build-feature.py
$(PYTHON) build-feature.py

$(REGULAR_UNLINK): build-py2.py RictyDiminished/RictyDiminished-Regular.ttf FiraCode/distr/otf/FiraCode-Regular.otf
fontforge -lang=py -script "$<" "$(word 2, $^)" "$(word 3, $^)" "$@" Regular false
$(REGULAR_UNLINK): RictyDiminished/RictyDiminished-Regular.ttf FiraCode/distr/otf/FiraCode-Regular.otf
$(PYTHON) build.py "$(word 1, $^)" "$(word 2, $^)" "$@" Regular false

$(BOLD_UNLINK): build-py2.py RictyDiminished/RictyDiminished-Bold.ttf FiraCode/distr/otf/FiraCode-Bold.otf
fontforge -lang=py -script "$<" "$(word 2, $^)" "$(word 3, $^)" "$@" Bold false
$(BOLD_UNLINK): RictyDiminished/RictyDiminished-Bold.ttf FiraCode/distr/otf/FiraCode-Bold.otf
$(PYTHON) build.py "$(word 1, $^)" "$(word 2, $^)" "$@" Bold false

$(REGULAR_DISCORD_UNLINK): build-py2.py RictyDiminished/RictyDiminishedDiscord-Regular.ttf FiraCode/distr/otf/FiraCode-Regular.otf
fontforge -lang=py -script "$<" "$(word 2, $^)" "$(word 3, $^)" "$@" Regular true
$(REGULAR_DISCORD_UNLINK): RictyDiminished/RictyDiminishedDiscord-Regular.ttf FiraCode/distr/otf/FiraCode-Regular.otf
$(PYTHON) build.py "$(word 1, $^)" "$(word 2, $^)" "$@" Regular true

$(BOLD_DISCORD_UNLINK): build-py2.py RictyDiminished/RictyDiminishedDiscord-Bold.ttf FiraCode/distr/otf/FiraCode-Bold.otf
fontforge -lang=py -script "$<" "$(word 2, $^)" "$(word 3, $^)" "$@" Bold true
$(BOLD_DISCORD_UNLINK): RictyDiminished/RictyDiminishedDiscord-Bold.ttf FiraCode/distr/otf/FiraCode-Bold.otf
$(PYTHON) build.py "$(word 1, $^)" "$(word 2, $^)" "$@" Bold true

build-py2.py: build-py3.py ligatures.csv
3to2 "$<" -w -x str
mv -f "$<" "$@"
mv -f "$<.bak" "$<"

clean:
-rm -f build-py2.py

.PHONY: all clean
.PHONY: all
6 changes: 3 additions & 3 deletions build-py3.py → build.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
firacode = fontforge.open(options.firacode)

# Load ligatures data and create data to generate feature file
with open('ligatures.csv', 'rb') as file:
with open('ligatures.csv', 'r') as file:
ligatures_reader = csv.reader(file, delimiter=' ')

ligatures = []
Expand All @@ -57,10 +57,10 @@

# Dump data
with open('data.json', 'w') as file:
file.write(unicode(json.dumps({
file.write(json.dumps({
'ligatures': ligatures,
'nullable_glyphs': nullable_glyphs,
})))
}))

# Copy needed glyphs from Fira Code font to Ricty
for (source_type, name) in glyphs:
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt

This file was deleted.