Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
svofski committed Aug 7, 2018
0 parents commit 8d5bcaf
Show file tree
Hide file tree
Showing 99 changed files with 126 additions and 0 deletions.
Binary file added Glass_TTY_VT220.ttf
Binary file not shown.
28 changes: 28 additions & 0 deletions VT200
Original file line number Diff line number Diff line change
@@ -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~
Binary file added u0400.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0401.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0402.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0403.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0405.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0406.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0407.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0408.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0409.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u040a.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u040b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u040c.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u040d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u040e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u040f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0410.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0411.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0412.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0413.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0414.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0415.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0416.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0417.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0418.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added u0419.png
Binary file added u041a.png
Binary file added u041b.png
Binary file added u041c.png
Binary file added u041d.png
Binary file added u041e.png
Binary file added u041f.png
Binary file added u0420.png
Binary file added u0421.png
Binary file added u0422.png
Binary file added u0423.png
Binary file added u0424.png
Binary file added u0425.png
Binary file added u0426.png
Binary file added u0427.png
Binary file added u0428.png
Binary file added u0429.png
Binary file added u042a.png
Binary file added u042b.png
Binary file added u042c.png
Binary file added u042d.png
Binary file added u042e.png
Binary file added u042f.png
Binary file added u0430.png
Binary file added u0431.png
Binary file added u0432.png
Binary file added u0433.png
Binary file added u0434.png
Binary file added u0435.png
Binary file added u0436.png
Binary file added u0437.png
Binary file added u0438.png
Binary file added u0439.png
Binary file added u043a.png
Binary file added u043b.png
Binary file added u043c.png
Binary file added u043d.png
Binary file added u043e.png
Binary file added u043f.png
Binary file added u0440.png
Binary file added u0441.png
Binary file added u0442.png
Binary file added u0443.png
Binary file added u0444.png
Binary file added u0445.png
Binary file added u0446.png
Binary file added u0447.png
Binary file added u0448.png
Binary file added u0449.png
Binary file added u044a.png
Binary file added u044b.png
Binary file added u044c.png
Binary file added u044d.png
Binary file added u044e.png
Binary file added u044f.png
Binary file added u0450.png
Binary file added u0451.png
Binary file added u0452.png
Binary file added u0453.png
Binary file added u0454.png
Binary file added u0455.png
Binary file added u0456.png
Binary file added u0457.png
Binary file added u0458.png
Binary file added u0459.png
Binary file added u045a.png
Binary file added u045b.png
Binary file added u045c.png
Binary file added u045d.png
Binary file added u045e.png
Binary file added vt220glyphs.png
98 changes: 98 additions & 0 deletions vtparse.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 8d5bcaf

Please sign in to comment.