Skip to content

Instantly share code, notes, and snippets.

@formatc1702
Created July 23, 2020 15:34
Show Gist options
  • Save formatc1702/f5a25a353361c513a9edb775800f5a75 to your computer and use it in GitHub Desktop.
Save formatc1702/f5a25a353361c513a9edb775800f5a75 to your computer and use it in GitHub Desktop.
Schraubenkiste cheat sheet
# Generate a quick HTML page to view the characters generated by the Schraubenkiste.ttf font
# Font source: http://www.peter-wiegel.de/Schraubenkiste.html
screw_shapes = [
('ZY', 'E010'),
('FL', 'E012'),
('LK', 'E013'),
('HR', 'E014'),
('SE', 'E015'),
('RS', 'E016')
]
head_shapes = [
('SL', 'E007'),
('PH', 'E000'),
('PZ', 'E001'),
('TX', 'E002'),
('TS', 'E00B'),
('ATX', 'E003'),
('IN', 'E004'),
('IS', 'E00C'),
('SP', 'E00A'),
('TW', 'E008'),
('TQ', 'E009'),
('RO', 'E00D'),
('SK', 'E005'),
('VZ', 'E006'),
('TP', 'E030'),
# ('TPS', 'E031'), # not working?
('STR', 'E032'),
('PTL', 'E033'),
('QL', 'E034'),
('TTL', 'E035'),
('CL', 'E036')
]
def make_table(inp):
out = '<table>'
out = f'{out}<table style="text-align: center; cellborder: 1px solid black">'
out = f'{out}<tr>'
codes = [x[0] for x in inp]
chars = [x[1] for x in inp]
for char in chars:
out = f'{out}{make_cell("&#x" + char + ";", font = "Schraubenkiste", size = 40)}'
out = f'{out}</tr><tr>'
for char in chars:
out = f'{out}{make_cell("&#x" + char + ";", font = "Schraubenkiste2", size = 40)}'
out = f'{out}</tr><tr>'
for char in chars:
out = f'{out}{make_cell("U+" + char, size = 8)}'
out = f'{out}</tr><tr>'
for code in codes:
out = f'{out}{make_cell(code)}'
out = f'{out}</tr>'
out = f'{out}</table>'
return out
def make_cell(inp, font = 'Arial', size = 12):
return f'<td style="text-align: center; border: 1px solid black"><div style="font-family: {font}; font-size: {size}pt">{inp}</div></td>'
with open('schraubenkiste.html','w') as file:
file.write('<html><body>')
file.write(make_table(screw_shapes))
file.write('<br />')
file.write(make_table(head_shapes))
file.write('</body></html>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment