Browse Source

Don't generate SVGs that have no char defined

Andy Teijelo Pérez 5 years ago
parent
commit
873e6d273e
2 changed files with 7 additions and 7 deletions
  1. 6 6
      Makefile
  2. 1 1
      createfont.py

+ 6 - 6
Makefile

@@ -1,6 +1,6 @@
-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 = $(shell ./countchars.sh characters.png "pngs/%.0f.png")
+NARROWSVGS = $(shell ./msx2utf8.py -l | awk '{ print "narrow-svgs/" $$1 ".svg" }')
+WIDESVGS = $(shell ./msx2utf8.py -l | awk '{ print "wide-svgs/" $$1 ".svg" }')
 
 SCREEN0_OUTPUTS = msx-screen0.sfd msx-screen0.woff msx-screen0.ttf
 SCREEN1_OUTPUTS = msx-screen1.sfd msx-screen1.woff msx-screen1.ttf
@@ -11,7 +11,7 @@ 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/%d.png
 	
 narrow-svgs:
 	mkdir -p narrow-svgs
@@ -35,7 +35,7 @@ $(SCREEN0_OUTPUTS): $(NARROWSVGS) unicode2msx.txt createfont.py
 		--output-sfd msx-screen0.sfd \
 		--output-woff msx-screen0.woff \
 		--output-ttf msx-screen0.ttf \
-		--familyname 'MSX' \
+		--familyname 'MSX Screen 0' \
 		--fontname 'MSX-Screen0' \
 		--fullname 'MSX Screen 0' \
 		--width 768 \
@@ -46,7 +46,7 @@ $(SCREEN1_OUTPUTS): $(WIDESVGS) unicode2msx.txt createfont.py
 		--output-sfd msx-screen1.sfd \
 		--output-woff msx-screen1.woff \
 		--output-ttf msx-screen1.ttf \
-		--familyname 'MSX' \
+		--familyname 'MSX Screen 1' \
 		--fontname 'MSX-Screen1' \
 		--fullname 'MSX Screen 1' \
 		--width 1024 \

+ 1 - 1
createfont.py

@@ -33,7 +33,7 @@ for line in f:
     codepoint = int(codepoint)
     msxcode = int(msxcode)
     glyph = font.createChar(codepoint)
-    svgfile = "{:03d}.svg".format(msxcode)
+    svgfile = "{}.svg".format(msxcode)
     glyph.importOutlines(os.path.join(args.svgdir, svgfile))
     glyph.width = args.width
     glyph.simplify()