Updates to Makefile
This commit is contained in:
parent
95f4dd4156
commit
e18cb54f9c
3 changed files with 63 additions and 36 deletions
64
Makefile
64
Makefile
|
@ -1,45 +1,45 @@
|
||||||
all: MSX-Screen0.woff MSX-Screen0.ttf MSX-Screen1.woff MSX-Screen1.ttf
|
PNGS = $(shell ./countchars.sh characters.png "pngs/%03.0f.png")
|
||||||
|
NARROWSVGS = $(shell ./countchars.sh characters.png "narrow-svgs/%03.0f.svg")
|
||||||
|
WIDESVGS = $(shell ./countchars.sh characters.png "wide-svgs/%03.0f.svg")
|
||||||
|
|
||||||
pngs: characters.png
|
all: msx-screen0.woff
|
||||||
|
|
||||||
|
pngs:
|
||||||
mkdir -p pngs
|
mkdir -p pngs
|
||||||
|
|
||||||
|
$(PNGS): characters.png | pngs
|
||||||
gm convert -crop 8x8 characters.png +adjoin pngs/%03d.png
|
gm convert -crop 8x8 characters.png +adjoin pngs/%03d.png
|
||||||
touch pngs
|
|
||||||
|
narrow-svgs:
|
||||||
#PNGS=$(wildcard pngs/*.png)
|
|
||||||
#SVGS=$(patsubst pngs/%.png, %.svg, $(PNGS))
|
|
||||||
#
|
|
||||||
#%.svg: pngs/%.png | pngs
|
|
||||||
# echo $@ $<
|
|
||||||
#
|
|
||||||
#$(SVGS): %.svg: pngs/%.png | pngs
|
|
||||||
# echo $@ $<
|
|
||||||
# touch "$@"
|
|
||||||
|
|
||||||
svgs: narrow-svgs wide-svgs
|
|
||||||
|
|
||||||
narrow-svgs: pngs
|
|
||||||
mkdir -p narrow-svgs
|
mkdir -p narrow-svgs
|
||||||
for i in pngs/???.png ;\
|
|
||||||
do \
|
|
||||||
f=$$(basename "$$i") ;\
|
|
||||||
./createsvg.sh "$$i" "narrow-svgs/$${f%%.png}.svg" 6 8 ;\
|
|
||||||
done
|
|
||||||
touch narrow-svgs
|
|
||||||
|
|
||||||
wide-svgs: pngs
|
wide-svgs:
|
||||||
mkdir -p wide-svgs
|
mkdir -p wide-svgs
|
||||||
for i in pngs/???.png ;\
|
|
||||||
do \
|
$(NARROWSVGS): narrow-svgs/%.svg: pngs/%.png | narrow-svgs
|
||||||
f=$$(basename "$$i") ;\
|
./createsvg.sh "$<" "$@" 6 8
|
||||||
./createsvg.sh "$$i" "wide-svgs/$${f%%.png}.svg" 8 8 ;\
|
|
||||||
done
|
$(WIDESVGS): wide-svgs/%.svg: pngs/%.png | wide-svgs
|
||||||
touch wide-svgs
|
./createsvg.sh "$<" "$@" 8 8
|
||||||
|
|
||||||
|
svgs: $(NARROWSVGS) $(WIDESVGS)
|
||||||
|
|
||||||
unicode2msx.txt: msx2utf8.py
|
unicode2msx.txt: msx2utf8.py
|
||||||
./msx2utf8.py -l | awk '{ print $$2" "$$1 }' > unicode2msx.txt
|
./msx2utf8.py -l | awk '{ print $$2" "$$1 }' > unicode2msx.txt
|
||||||
|
|
||||||
msx-screen0.sfd msx-screen0.woff: svgs unicode2msx.txt importchars.py
|
msx-screen0.sfd msx-screen0.woff: $(NARROWSVGS) unicode2msx.txt importchars.py
|
||||||
fontforge -script importchars.py unicode-to-msx.txt narrow-svgs/ msx-screen0.sfd msx-screen0.woff
|
fontforge -script importchars.py \
|
||||||
|
--output-sfd msx-screen0.sfd \
|
||||||
|
--output-woff msx-screen0.woff \
|
||||||
|
--fullname 'MSX-Screen0' \
|
||||||
|
unicode2msx.txt narrow-svgs
|
||||||
|
|
||||||
|
msx-screen0.sfd msx-screen0.woff: $(NARROWSVGS) unicode2msx.txt importchars.py
|
||||||
|
fontforge -script importchars.py \
|
||||||
|
--output-sfd msx-screen0.sfd \
|
||||||
|
--output-woff msx-screen0.woff \
|
||||||
|
--fullname 'MSX-Screen0' \
|
||||||
|
unicode2msx.txt narrow-svgs
|
||||||
|
|
||||||
|
|
||||||
MSX-Screen0.woff: msx-screen0.sfd
|
MSX-Screen0.woff: msx-screen0.sfd
|
||||||
|
|
8
countchars.sh
Executable file
8
countchars.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
gm identify -format "%W %H" "$1" | while read width height
|
||||||
|
do
|
||||||
|
cols=$((width / 8))
|
||||||
|
rows=$((height / 8))
|
||||||
|
seq -f "$2" 0 $((cols*rows - 1))
|
||||||
|
done
|
|
@ -1,18 +1,37 @@
|
||||||
import fontforge
|
import fontforge
|
||||||
|
import argparse
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('charmap')
|
||||||
|
parser.add_argument('svgdir')
|
||||||
|
parser.add_argument('--fullname')
|
||||||
|
parser.add_argument('--output-sfd')
|
||||||
|
parser.add_argument('--output-woff')
|
||||||
|
parser.add_argument('--output-ttf')
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
print(args)
|
||||||
|
|
||||||
font = fontforge.font()
|
font = fontforge.font()
|
||||||
|
|
||||||
f = open(sys.argv[1])
|
font.ascent = 1024 - 128
|
||||||
|
font.descent = 128
|
||||||
|
|
||||||
|
font.fullname = args.fullname
|
||||||
|
|
||||||
|
f = open(args.charmap)
|
||||||
for line in f:
|
for line in f:
|
||||||
codepoint, msxcode = line.strip().split()
|
codepoint, msxcode = line.strip().split()
|
||||||
codepoint = int(codepoint)
|
codepoint = int(codepoint)
|
||||||
msxcode = int(msxcode)
|
msxcode = int(msxcode)
|
||||||
glyph = font.createChar(codepoint)
|
glyph = font.createChar(codepoint)
|
||||||
svgfile = "{:03d}.svg".format(msxcode)
|
svgfile = "{:03d}.svg".format(msxcode)
|
||||||
glyph.importOutlines(os.path.join(sys.argv[2], svgfile))
|
glyph.importOutlines(os.path.join(args.svgdir, svgfile))
|
||||||
|
glyph.simplify()
|
||||||
|
glyph.autoHint()
|
||||||
|
|
||||||
font.save(sys.argv[3])
|
font.save(args.output_sfd)
|
||||||
font.generate(sys.argv[4])
|
font.generate(args.output_woff)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue