[smc-discuss] [Git][smc/fonts/dyuthi][master] 2 commits: Use build directory for storing ttf

Balasankar C gitlab at mg.gitlab.com
Sat Jun 23 10:51:47 PDT 2018


Balasankar C pushed to branch master at SMC / fonts / Dyuthi


Commits:
035e4b75 by Balasankar C at 2018-06-23T17:51:45Z
Use build directory for storing ttf

- - - - -
460c58f3 by Balasankar C at 2018-06-23T17:51:45Z
Merge branch 'build-dir' into 'master'

Use build directory for storing ttf

See merge request smc/fonts/dyuthi!3
- - - - -


5 changed files:

- .gitignore
- .gitlab-ci.yml
- Makefile
- + tools/artifacts.sh
- tools/build.py


Changes:

=====================================
.gitignore
=====================================
@@ -1,2 +1,5 @@
-
 features/tables.fea.backup
+build/*
+tests/*.pdf
+tests/*.html
+.directory


=====================================
.gitlab-ci.yml
=====================================
@@ -1,23 +1 @@
-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'


=====================================
Makefile
=====================================
@@ -2,38 +2,39 @@
 
 fontpath=/usr/share/fonts/truetype/malayalam
 fonts=Dyuthi-Regular
-features=features
+feature=features/Dyuthi-Regular.fea
 PY=python2.7
 version=2.0
 buildscript=tools/build.py
 version=3.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 \
-		echo "Generating $$font.ttf";\
-		$(PY) $(buildscript) -t ttf -i $$font.sfd -f $(features)/$$font.fea -v $(version);\
+		$(PY) $(buildscript) -t ttf -i $$font.sfd -f $(feature) -v $(version) -o $(outdir);\
 	done;
 
-webfonts: woff woff2
-woff:
+webfonts:woff woff2
+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: 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}.otf ${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
@@ -41,7 +42,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)


=====================================
tools/artifacts.sh
=====================================
@@ -0,0 +1,21 @@
+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


=====================================
tools/build.py
=====================================
@@ -86,7 +86,7 @@ def fixXAvgCharWidth(font):
         expected_value = int(round(width_sum) / count)
     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")
@@ -94,6 +94,7 @@ def opentype(infont, type, feature, version):
     else:
         outfont = infont.replace(".sfd", ".ttf")
         flags = ("opentype", "dummy-dsig", "round", "omit-instructions")
+    outfont = os.path.join(outdir, outfont)
     print("Generating %s => %s" % (infont, outfont))
     tmpfont = mkstemp(suffix=os.path.basename(outfont))[1]
 
@@ -180,8 +181,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)



View it on GitLab: https://gitlab.com/smc/fonts/dyuthi/compare/a48272e2b2a507af5787bb2fa086bcd83a539c29...460c58f307dcc48b70d47df422b7a449bc7f5796

-- 
View it on GitLab: https://gitlab.com/smc/fonts/dyuthi/compare/a48272e2b2a507af5787bb2fa086bcd83a539c29...460c58f307dcc48b70d47df422b7a449bc7f5796
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.smc.org.in/pipermail/discuss-smc.org.in/attachments/20180623/863fff9e/attachment-0001.html>


More information about the discuss mailing list