Writing the Makefile...

This commit is contained in:
Andy Teijelo Pérez 2016-09-15 10:57:58 -04:00
parent e9378a0e1e
commit e618ef401f
2 changed files with 81 additions and 0 deletions

25
Makefile Normal file
View file

@ -0,0 +1,25 @@
all: MSX-Screen0.woff MSX-Screen0.ttf MSX-Screen1.woff MSX-Screen1.ttf
pngs: characters.png
mkdir -p pngs
gm convert -crop 8x8 characters.png +adjoin pngs/%03d.png
touch pngs
narrow-svgs: pngs
mkdir -p narrow-svgs
for i in pngs/???.png ;\
do \
f=$$(basename "$$i") ;\
gm convert "$$i" -crop 6x8 -filter Point -resize 48x64 -black-threshold 50%% "$$f.bmp" ;\
potrace "$$f.bmp" -o narrow-svgs/"$${f%%.png}.svg" -i -a 1.01 -s -z black ;\
rm -f "$$f.bmp" ;\
done
touch narrow-svgs
MSX-Screen0.woff: msx-screen0.sfd
MSX-Screen0.ttf: msx-screen0.sfd
MSX-Screen1.woff: msx-screen1.sfd
MSX-Screen1.ttf: msx-screen1.sfd

56
msx2utf8.py Executable file
View file

@ -0,0 +1,56 @@
#!/usr/bin/env python3
# -*- coding: utf8 -*-
import sys
from unicodedata import name
chars = (r""" !"#$%&'()*+,-./0123456789:;<=>?""" +
r"""@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_""" +
r"""`abcdefghijklmnopqrstuvwxyz{|}~ """ +
r"""ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒ""" +
r"""áíóúñѪº¿⌐¬½¼¡«»ÃãĨĩÕõŨũIJij¾∽◇‰¶§""" +
r"""▂▚▆▔◾▇▎▞▊▕▉▨▧▼▲▶◀⧗⧓▘▗▝▖▒Δǂω█▄▌▐▀""" +
r"""αβΓπΣσμτΦθΩδ∞φ∈∩≡±≥≤⌠⌡÷≈°∙‐√ⁿ²◾■""" +
r""" ☺☻♥♦♣♠·◘○◙♂♀♪♬☼╂┻┳┫┣╋┃━┏┓┗┛╳╱╲┿""")
def msxchars():
"""
yields tuples in the form (msx code, unicode character)
"""
for i in range(32):
yield (i, chr(i))
for i in range(32,256):
if i == 127:
yield (i, chr(i))
else:
yield (i, chars[i - 32])
for i in range(65,96):
yield (256 + i, chars[160 + i])
charmap = {}
for m,c in msxchars():
charmap[m] = c
if len(sys.argv) < 2:
while True:
b = sys.stdin.buffer.read(1)
if len(b) == 0:
break
code = b[0]
if code == 1:
c = sys.stdin.buffer.read(1)
if len(b) == 0:
sys.stdout.write('\x01')
break
code = 256 + c[0]
char = charmap[code]
sys.stdout.write(char)
if sys.argv[1] == '-l':
for m,c in msxchars():
try:
n = name(c)
except ValueError:
n = ""
print(m,ord(c),c,n)