Commit 9c8d7cf7 authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

Use build directory to store ttfs

parent a9722cb3
features/tables.fea.backup
build/*
tests/*.pdf
tests/*.html
.directory
image: "debian:stretch"
generate-ttf:
stage: build
before_script:
- apt-get update -y
- apt-get install -y make fonttools python-fontforge
script:
- make compile
- mkdir -p ttfs/
- mv *.ttf ttfs/
artifacts:
paths:
- ttfs/
test:
stage: test
before_script:
- apt-get update -y
- apt-get install -y make libharfbuzz-bin
script:
- cp -r ttfs/* .
- make test
include: 'https://gitlab.com/smc/fonts-all/raw/master/fonts-gitlab-ci.yml'
......@@ -6,32 +6,34 @@ feature=features/features.fea
PY=python2.7
buildscript=tools/build.py
version=7.0
default: compile
all: compile webfonts test
compile:
outdir=build
default: ttf
all: clean ttf webfonts test
.PHONY: ttf
ttf:
@for font in `echo ${fonts}`;do \
$(PY) $(buildscript) -t ttf -i $$font.sfd -f $(feature) -v $(version);\
$(PY) $(buildscript) -t ttf -i $$font.sfd -f $(feature) -v $(version) -o $(outdir);\
done;
webfonts:woff woff2
woff: compile
woff: ttf
@rm -rf *.woff
@for font in `echo ${fonts}`;do \
$(PY) $(buildscript) -t woff -i $$font.ttf;\
$(PY) $(buildscript) -t woff -i $(outdir)/$$font.ttf;\
done;
woff2: compile
woff2: ttf
@rm -rf *.woff2
@for font in `echo ${fonts}`;do \
$(PY) $(buildscript) -t woff2 -i $$font.ttf;\
$(PY) $(buildscript) -t woff2 -i $(outdir)/$$font.ttf;\
done;
install: compile
install: ttf
@for font in `echo ${fonts}`;do \
install -D -m 0644 $${font}.ttf ${DESTDIR}/${fontpath}/$${font}.ttf;\
install -D -m 0644 $(outdir)/$${font}.ttf ${DESTDIR}/${fontpath}/$${font}.ttf;\
done;
ifeq ($(shell ls -l *.ttf 2>/dev/null | wc -l),0)
test: compile run-test
ifeq ($(shell ls -l $(outdir)/*.ttf 2>/dev/null | wc -l),0)
test: ttf run-test
else
test: run-test
endif
......@@ -39,7 +41,7 @@ endif
run-test:
@for font in `echo ${fonts}`; do \
echo "Testing font $${font}";\
hb-view $${font}.ttf --font-size 14 --margin 100 --line-space 1.5 --foreground=333333 --text-file tests/tests.txt --output-file tests/$${font}.pdf;\
hb-view $(outdir)/$${font}.ttf --font-size 14 --margin 100 --line-space 1.5 --foreground=333333 --text-file tests/tests.txt --output-file tests/$${font}.pdf;\
done;
clean:
@rm -rf *.otf *.ttf *.woff *.woff2 *.sfd-* tests/*.pdf
@rm -rf *.otf *.ttf *.woff *.woff2 *.sfd-* tests/*.pdf $(outdir)
cp *.conf build
cd build
rm -rf ttf otf woff woff2 *.pdf
mkdir ttf woff woff2
cp *.ttf ttf
cp *.woff woff
cp *.woff2 woff2
tar cvf ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz *.conf ttf
sha256sum ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz > ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz.sha256
md5sum ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz > ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz.md5
zip -j ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.zip ttf/*
ln -s ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz ./${CI_PROJECT_NAME}_LATEST.tar.gz
ln -s ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz.sha256 ./${CI_PROJECT_NAME}_LATEST.tar.gz.sha256
ln -s ${CI_PROJECT_NAME}-${CI_COMMIT_TAG}.tar.gz.md5 ./${CI_PROJECT_NAME}_LATEST.tar.gz.md5
rm -rf ttf otf woff woff2 *.pdf
rm *.conf
......@@ -92,7 +92,7 @@ def fixXAvgCharWidth(font):
font['OS/2'].xAvgCharWidth = int(round(width_sum) / count)
def opentype(infont, type, feature, version):
def opentype(infont, outdir, type, feature, version):
font = fontforge.open(infont)
if args.type == 'otf':
outfont = infont.replace(".sfd", ".otf")
......@@ -100,6 +100,7 @@ def opentype(infont, type, feature, version):
else:
outfont = infont.replace(".sfd", ".ttf")
flags = ("opentype", "round", "omit-instructions", "dummy-dsig")
outfont = os.path.join(outdir, outfont)
print("Generating %s => %s" % (infont, outfont))
tmpfont = mkstemp(suffix=os.path.basename(outfont))[1]
......@@ -187,8 +188,11 @@ if __name__ == "__main__":
parser.add_argument('-v', '--version', help='Version')
parser.add_argument('-f', '--feature', help='Feature file')
parser.add_argument('-t', '--type', help='Output type', default='otf')
parser.add_argument('-o', '--outdir', help='Output directory', default='build')
args = parser.parse_args()
if not os.path.exists(args.outdir):
os.mkdir(args.outdir)
if args.type == 'otf' or args.type == 'ttf':
opentype(args.input, args.type, args.feature, args.version)
opentype(args.input, args.outdir, args.type, args.feature, args.version)
if args.type == 'woff' or args.type == 'woff2':
webfonts(args.input, args.type)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment