mirror of
https://github.com/svofski/glasstty.git
synced 2025-12-09 23:37:05 +00:00
initial commit
This commit is contained in:
BIN
Glass_TTY_VT220.ttf
Normal file
BIN
Glass_TTY_VT220.ttf
Normal file
Binary file not shown.
28
VT200
Normal file
28
VT200
Normal file
@@ -0,0 +1,28 @@
|
||||
[62;0"p F
|
||||
P0;0;1;4;1;1{U
|
||||
???????/???????;???}???/???A???;?M??M??/???????;g}gg}g?/?B??B??;
|
||||
GSS}SS_/?@@B@@?;CIcOGcA/A@??@A@;kQQQk?_/@AAAA@A;??GEA??/???????;
|
||||
?wCA???/??@A???;???ACw?/???A@??;OSwOwSO/?@???@?;OOO{OOO/???@???;
|
||||
???????/?CB@???;OOOOOOO/???????;???????/??BB???;??_OGCA/A@?????;
|
||||
wCAAACw/?@AAA@?;?GC}???/?AABAA?;CaaQQQK/BAAAAAA;AAAQYUa/@AAAAA@;
|
||||
_ogca}_/?????B?;]IIIIIq/@AAAAA@;wcQQQQc/@AAAAA@;AAAaQIE/??B????;
|
||||
kQQQQQk/@AAAAA@;KQQQQQ{/?AAAAA@;??KK???/??BB???;??KK???/?CB@???;
|
||||
O?g?C?A/????@?A;ggggggg/???????;A?C?g?O/A?@????;CAAqIIC/???A???;
|
||||
|
||||
w_oGGGo/B?@AAA@;?ggggo?/@AAAA@A;_QUYYQa/@AAAAA@;w????w?/@AAA@@E;
|
||||
cQQQQQ{/@AAAAA@;ogggggo/@AAAAA?;_OOwOO_/?@@B@@?;?gggggO/@AAAAAA;
|
||||
G?O_O?G/A?@?@?A;w????w?/@AAA@BA;w??C?w?/@AAA@BA;w___OOG/B???@@A;
|
||||
??oGGGw/AA@???B;wO___Ow/B??@??B;w_____w/B?????B;oGGGGGo/@AAAAA@;
|
||||
wOGGGo?/B????BA;Ogggggw/AA@???B;wGGGGGo/F@@@@@?;oGGGGGO/@AAAAA@;
|
||||
GGGwGGG/???B???;w?????w/CDDDDDB;GO_w_OG/A@?B?@A;{QQYSO_/@AAAAA@;
|
||||
w_____?/BAAAAA@;w___??w/BAAA@?B;OGGgggO/@AAAAA@;w??w??w/BAABAAB;
|
||||
OGGgggo/@AAAAA@;w??w??w/BAABAAF;w_____w/??????B;GGw___?/??BAAA@;
|
||||
|
||||
}O{AAA{/B?@AAA@;ogcaaa}/B?????B;}QQQQQa/BAAAAA@;}????}?/BAAAABE;
|
||||
?{AAA}?/EBAAABE;}QQQQQQ/BAAAAAA;wCC}CCw/?@@B@@?;}AAAAAA/B??????;
|
||||
E?gOg?E/B?????B;}?_OGC}/B@????B;}?_RHC}/B@????B;}OOOggE/B?????B;
|
||||
oGCAAA}/B?????B;}CGoGC}/B?????B;}_____}/B?????B;{AAAAA{/@AAAAA@;
|
||||
}AAAAA}/B?????B;KQqQQQ}/A@????B;}aaaaa[/B??????;{AAAAAA/@AAAAAA;
|
||||
EAA}AAE/???B???;MOOOOO}/@AAAAA@;EgO}OgE/B??B??B;}QQQQ[_/BAAAAA@;
|
||||
}OOOOO_/BAAAAA@;}OOO_?}/BAAA@?B;CAAQQQk/@AAAAA@;}??}??}/BAABAAB;
|
||||
AAQQQQ{/AAAAAA@;}??}??}/BAABAAF;]OOOOO}/??????B/)U~
|
||||
BIN
vt220glyphs.png
Normal file
BIN
vt220glyphs.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
98
vtparse.py
Normal file
98
vtparse.py
Normal file
@@ -0,0 +1,98 @@
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import png
|
||||
|
||||
def tobin(x, count=8):
|
||||
"""
|
||||
Integer to binary
|
||||
Count is number of bits
|
||||
"""
|
||||
return "".join(map(lambda y:str((x>>y)&1), range(count-1, -1, -1)))
|
||||
|
||||
def chartosixel(c):
|
||||
return ord(c) - 077
|
||||
|
||||
# 7x10 char matrix
|
||||
class vtchar:
|
||||
m = []
|
||||
charcode = 0
|
||||
|
||||
def __init__(self, code):
|
||||
self.m = [' ' for x in range(7*10)]
|
||||
self.charcode = code
|
||||
|
||||
def sixel(self, nsixel, topbottom, c):
|
||||
bits = chartosixel(c)
|
||||
rang3 = range(6 - 2*topbottom)
|
||||
for b in rang3:
|
||||
bit = (bits>>b) & 001
|
||||
self.m[(topbottom*6+b)*7 + nsixel] = '01'[bit]
|
||||
|
||||
def sixelpack(self, spair):
|
||||
sp = spair.strip().split('/')
|
||||
for tb in [0,1]:
|
||||
for sc in range(7):
|
||||
self.sixel(sc,tb,sp[tb][sc])
|
||||
|
||||
def dump(self):
|
||||
i = 0
|
||||
for c in self.m:
|
||||
print c,
|
||||
i = i + 1
|
||||
if i % 7 == 0: print('\n')
|
||||
|
||||
def writepng(self):
|
||||
# pack
|
||||
s=[]
|
||||
i = 0
|
||||
b = 0
|
||||
for c in self.m:
|
||||
i = i + 1
|
||||
b = b | (int(c)<<(9-((i-1)%7)))
|
||||
if i % 7 == 0:
|
||||
b = b | (b>>1)
|
||||
s.append(tobin(~b,10))
|
||||
s.append(tobin(~0,10))
|
||||
b = 0
|
||||
s = map(lambda x: map(int, x), s)
|
||||
|
||||
f = open('u%04x.png'%self.charcode, 'wb')
|
||||
w = png.Writer(len(s[0]), len(s), greyscale=True, bitdepth=1)
|
||||
w.write(f, s)
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
print 'Opening file "VT200"...'
|
||||
try:
|
||||
text = open('VT200').read().replace('\n', ' ')
|
||||
except:
|
||||
print "error"
|
||||
sys.exit(1)
|
||||
|
||||
fontdef = re.compile('.*\033P([0-9]\;){5}[0-9]\{\s*[A-Za-z]+\s+(?P<sixels>[^\033]*)\033\/')
|
||||
try:
|
||||
sixels = fontdef.match(text).expand('\g<sixels>')
|
||||
except:
|
||||
print "VT200 doesn't seem to contain character definitions"
|
||||
sys.exit(2)
|
||||
|
||||
test=False
|
||||
if test:
|
||||
v = vtchar(0)
|
||||
#v.sixelpack('~~~~~~~/~~~~~~~')
|
||||
#v.dump()
|
||||
v.sixelpack('ogcacgo/B?????B')
|
||||
v.dump()
|
||||
v.writepng()
|
||||
sys.exit(0)
|
||||
|
||||
charcode = 1024
|
||||
for chardef in sixels.split(';'):
|
||||
v=vtchar(charcode)
|
||||
v.sixelpack(chardef)
|
||||
#v.dump()
|
||||
v.writepng()
|
||||
charcode = charcode + 1
|
||||
|
||||
Reference in New Issue
Block a user