A bunch of stuff.

This commit is contained in:
Simon Forman 2023-03-03 07:30:55 -08:00
parent f87ddbfa9e
commit 5b6185209a
9 changed files with 4154 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,474 @@
# This script generates the top part of the monogram.c file
# (the rest of it was written after.)
'''
// Monogram 12x7 pixel font
'''
CREDITS = '\n'.join(
'// > ' + line
for line in '''\
# CREDITS
Monogram is a free and Creative Commons Zero pixel font,
made by Vinícius Menézio (@vmenezio).
https://datagoblin.itch.io/monogram
# SPECIAL THANKS
thanks to Ateş Göral (@atesgoral) for creating the bitmap font converter:
https://codepen.io/atesgoral/details/RwGOvPZ
thanks to Éric Araujo (@merwok_) for the inital port of monogram to PICO-8:
https://itch.io/post/2625522
'''.splitlines()
)
print(__doc__)
print(CREDITS)
monogram = {
"0": [0, 0, 0, 14, 17, 25, 21, 19, 17, 14, 0, 0],
"1": [0, 0, 0, 4, 6, 4, 4, 4, 4, 31, 0, 0],
"2": [0, 0, 0, 14, 17, 16, 8, 4, 2, 31, 0, 0],
"3": [0, 0, 0, 14, 17, 16, 12, 16, 17, 14, 0, 0],
"4": [0, 0, 0, 18, 18, 17, 31, 16, 16, 16, 0, 0],
"5": [0, 0, 0, 31, 1, 15, 16, 16, 17, 14, 0, 0],
"6": [0, 0, 0, 14, 1, 1, 15, 17, 17, 14, 0, 0],
"7": [0, 0, 0, 31, 16, 16, 8, 4, 4, 4, 0, 0],
"8": [0, 0, 0, 14, 17, 17, 14, 17, 17, 14, 0, 0],
"9": [0, 0, 0, 14, 17, 17, 30, 16, 17, 14, 0, 0],
"!": [0, 0, 0, 4, 4, 4, 4, 4, 0, 4, 0, 0],
"\"": [0, 0, 0, 10, 10, 10, 0, 0, 0, 0, 0, 0],
"#": [0, 0, 0, 0, 10, 31, 10, 10, 31, 10, 0, 0],
"$": [0, 0, 0, 4, 30, 5, 14, 20, 15, 4, 0, 0],
"%": [0, 0, 0, 17, 17, 8, 4, 2, 17, 17, 0, 0],
"&": [0, 0, 0, 6, 9, 9, 30, 9, 9, 22, 0, 0],
"'": [0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 0],
"(": [0, 0, 0, 8, 4, 4, 4, 4, 4, 8, 0, 0],
")": [0, 0, 0, 2, 4, 4, 4, 4, 4, 2, 0, 0],
"*": [0, 0, 0, 0, 4, 21, 14, 21, 4, 0, 0, 0],
"+": [0, 0, 0, 0, 4, 4, 31, 4, 4, 0, 0, 0],
",": [0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 2, 0],
"-": [0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0],
".": [0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0],
"/": [0, 0, 0, 16, 16, 8, 4, 2, 1, 1, 0, 0],
":": [0, 0, 0, 0, 4, 4, 0, 0, 4, 4, 0, 0],
";": [0, 0, 0, 0, 4, 4, 0, 0, 4, 4, 2, 0],
"<": [0, 0, 0, 0, 24, 6, 1, 6, 24, 0, 0, 0],
"=": [0, 0, 0, 0, 0, 31, 0, 31, 0, 0, 0, 0],
">": [0, 0, 0, 0, 3, 12, 16, 12, 3, 0, 0, 0],
"?": [0, 0, 0, 14, 17, 16, 8, 4, 0, 4, 0, 0],
"@": [0, 0, 0, 14, 25, 21, 21, 25, 1, 14, 0, 0],
"A": [0, 0, 0, 14, 17, 17, 17, 31, 17, 17, 0, 0],
"B": [0, 0, 0, 15, 17, 17, 15, 17, 17, 15, 0, 0],
"C": [0, 0, 0, 14, 17, 1, 1, 1, 17, 14, 0, 0],
"D": [0, 0, 0, 15, 17, 17, 17, 17, 17, 15, 0, 0],
"E": [0, 0, 0, 31, 1, 1, 15, 1, 1, 31, 0, 0],
"F": [0, 0, 0, 31, 1, 1, 15, 1, 1, 1, 0, 0],
"G": [0, 0, 0, 14, 17, 1, 29, 17, 17, 14, 0, 0],
"H": [0, 0, 0, 17, 17, 17, 31, 17, 17, 17, 0, 0],
"I": [0, 0, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"J": [0, 0, 0, 16, 16, 16, 16, 17, 17, 14, 0, 0],
"K": [0, 0, 0, 17, 9, 5, 3, 5, 9, 17, 0, 0],
"L": [0, 0, 0, 1, 1, 1, 1, 1, 1, 31, 0, 0],
"M": [0, 0, 0, 17, 27, 21, 17, 17, 17, 17, 0, 0],
"N": [0, 0, 0, 17, 17, 19, 21, 25, 17, 17, 0, 0],
"O": [0, 0, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"P": [0, 0, 0, 15, 17, 17, 15, 1, 1, 1, 0, 0],
"Q": [0, 0, 0, 14, 17, 17, 17, 17, 17, 14, 24, 0],
"R": [0, 0, 0, 15, 17, 17, 15, 17, 17, 17, 0, 0],
"S": [0, 0, 0, 14, 17, 1, 14, 16, 17, 14, 0, 0],
"T": [0, 0, 0, 31, 4, 4, 4, 4, 4, 4, 0, 0],
"U": [0, 0, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"V": [0, 0, 0, 17, 17, 17, 17, 10, 10, 4, 0, 0],
"W": [0, 0, 0, 17, 17, 17, 17, 21, 27, 17, 0, 0],
"X": [0, 0, 0, 17, 17, 10, 4, 10, 17, 17, 0, 0],
"Y": [0, 0, 0, 17, 17, 10, 4, 4, 4, 4, 0, 0],
"Z": [0, 0, 0, 31, 16, 8, 4, 2, 1, 31, 0, 0],
"[": [0, 0, 0, 12, 4, 4, 4, 4, 4, 12, 0, 0],
"\\": [0, 0, 0, 1, 1, 2, 4, 8, 16, 16, 0, 0],
"]": [0, 0, 0, 6, 4, 4, 4, 4, 4, 6, 0, 0],
"^": [0, 0, 0, 4, 10, 17, 0, 0, 0, 0, 0, 0],
"_": [0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0],
"`": [0, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0],
"a": [0, 0, 0, 0, 0, 30, 17, 17, 17, 30, 0, 0],
"b": [0, 0, 0, 1, 1, 15, 17, 17, 17, 15, 0, 0],
"c": [0, 0, 0, 0, 0, 14, 17, 1, 17, 14, 0, 0],
"d": [0, 0, 0, 16, 16, 30, 17, 17, 17, 30, 0, 0],
"e": [0, 0, 0, 0, 0, 14, 17, 31, 1, 14, 0, 0],
"f": [0, 0, 0, 12, 18, 2, 15, 2, 2, 2, 0, 0],
"g": [0, 0, 0, 0, 0, 30, 17, 17, 17, 30, 16, 14],
"h": [0, 0, 0, 1, 1, 15, 17, 17, 17, 17, 0, 0],
"i": [0, 0, 0, 4, 0, 6, 4, 4, 4, 31, 0, 0],
"j": [0, 0, 0, 16, 0, 24, 16, 16, 16, 16, 17, 14],
"k": [0, 0, 0, 1, 1, 17, 9, 7, 9, 17, 0, 0],
"l": [0, 0, 0, 3, 2, 2, 2, 2, 2, 28, 0, 0],
"m": [0, 0, 0, 0, 0, 15, 21, 21, 21, 21, 0, 0],
"n": [0, 0, 0, 0, 0, 15, 17, 17, 17, 17, 0, 0],
"o": [0, 0, 0, 0, 0, 14, 17, 17, 17, 14, 0, 0],
"p": [0, 0, 0, 0, 0, 15, 17, 17, 17, 15, 1, 1],
"q": [0, 0, 0, 0, 0, 30, 17, 17, 17, 30, 16, 16],
"r": [0, 0, 0, 0, 0, 13, 19, 1, 1, 1, 0, 0],
"s": [0, 0, 0, 0, 0, 30, 1, 14, 16, 15, 0, 0],
"t": [0, 0, 0, 2, 2, 15, 2, 2, 2, 28, 0, 0],
"u": [0, 0, 0, 0, 0, 17, 17, 17, 17, 30, 0, 0],
"v": [0, 0, 0, 0, 0, 17, 17, 17, 10, 4, 0, 0],
"w": [0, 0, 0, 0, 0, 17, 17, 21, 21, 10, 0, 0],
"x": [0, 0, 0, 0, 0, 17, 10, 4, 10, 17, 0, 0],
"y": [0, 0, 0, 0, 0, 17, 17, 17, 17, 30, 16, 14],
"z": [0, 0, 0, 0, 0, 31, 8, 4, 2, 31, 0, 0],
"{": [0, 0, 0, 8, 4, 4, 2, 4, 4, 8, 0, 0],
"|": [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0, 0],
"}": [0, 0, 0, 2, 4, 4, 8, 4, 4, 2, 0, 0],
"~": [0, 0, 0, 0, 0, 18, 13, 0, 0, 0, 0, 0],
"¡": [0, 0, 0, 4, 0, 4, 4, 4, 4, 4, 0, 0],
"¢": [0, 0, 0, 4, 14, 21, 5, 21, 14, 4, 0, 0],
"£": [0, 0, 0, 12, 18, 2, 15, 2, 2, 31, 0, 0],
"¤": [0, 0, 0, 0, 17, 14, 10, 14, 17, 0, 0, 0],
"¥": [0, 0, 0, 17, 10, 4, 31, 4, 31, 4, 0, 0],
"¦": [0, 0, 0, 4, 4, 4, 0, 4, 4, 4, 0, 0],
"§": [0, 0, 0, 30, 1, 14, 17, 14, 16, 15, 0, 0],
"¨": [0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 0],
"©": [0, 0, 0, 14, 27, 21, 29, 21, 27, 14, 0, 0],
"ª": [0, 0, 0, 14, 9, 9, 9, 14, 0, 0, 0, 0],
"«": [0, 0, 0, 0, 0, 18, 9, 18, 0, 0, 0, 0],
"¬": [0, 0, 0, 0, 0, 0, 31, 16, 0, 0, 0, 0],
"®": [0, 0, 0, 14, 25, 21, 21, 25, 21, 14, 0, 0],
"¯": [0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0],
"°": [0, 0, 0, 6, 9, 9, 6, 0, 0, 0, 0, 0],
"±": [0, 0, 0, 4, 4, 31, 4, 4, 0, 31, 0, 0],
"²": [0, 0, 0, 3, 4, 2, 1, 7, 0, 0, 0, 0],
"³": [0, 0, 0, 3, 4, 2, 4, 3, 0, 0, 0, 0],
"´": [0, 0, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0],
"µ": [0, 0, 0, 0, 0, 17, 17, 17, 17, 15, 1, 1],
"": [0, 0, 0, 30, 23, 23, 23, 22, 20, 20, 0, 0],
"·": [0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0],
"¸": [0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 6],
"¹": [0, 0, 0, 2, 3, 2, 2, 7, 0, 0, 0, 0],
"º": [0, 0, 0, 6, 9, 9, 9, 6, 0, 0, 0, 0],
"»": [0, 0, 0, 0, 0, 9, 18, 9, 0, 0, 0, 0],
"¼": [0, 0, 0, 1, 9, 5, 2, 21, 28, 16, 0, 0],
"½": [0, 0, 0, 1, 9, 5, 14, 17, 8, 28, 0, 0],
"¾": [0, 0, 0, 7, 22, 15, 4, 22, 29, 16, 0, 0],
"¿": [0, 0, 0, 4, 0, 4, 2, 1, 17, 14, 0, 0],
"À": [2, 4, 0, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"Á": [8, 4, 0, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"Â": [4, 10, 0, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"Ã": [22, 9, 0, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"Ä": [0, 10, 0, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"Å": [4, 10, 4, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"Æ": [0, 0, 0, 30, 5, 5, 31, 5, 5, 29, 0, 0],
"Ç": [0, 0, 0, 14, 17, 1, 1, 1, 17, 14, 8, 6],
"È": [2, 4, 0, 31, 1, 1, 15, 1, 1, 31, 0, 0],
"É": [8, 4, 0, 31, 1, 1, 15, 1, 1, 31, 0, 0],
"Ê": [4, 10, 0, 31, 1, 1, 15, 1, 1, 31, 0, 0],
"Ë": [0, 10, 0, 31, 1, 1, 15, 1, 1, 31, 0, 0],
"Ì": [2, 4, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"Í": [8, 4, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"Î": [4, 10, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"Ï": [0, 10, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"Ð": [0, 0, 0, 15, 17, 17, 19, 17, 17, 15, 0, 0],
"Ñ": [22, 9, 0, 17, 17, 19, 21, 25, 17, 17, 0, 0],
"Ò": [2, 4, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"Ó": [8, 4, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"Ô": [4, 10, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"Õ": [22, 9, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"Ö": [0, 10, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"×": [0, 0, 0, 0, 0, 0, 10, 4, 10, 0, 0, 0],
"Ø": [0, 0, 0, 22, 9, 25, 21, 19, 18, 13, 0, 0],
"Ù": [2, 4, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"Ú": [8, 4, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"Û": [4, 10, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"Ü": [0, 10, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"Ý": [8, 4, 0, 17, 17, 10, 4, 4, 4, 4, 0, 0],
"Þ": [0, 0, 0, 1, 15, 17, 17, 17, 15, 1, 0, 0],
"ß": [0, 0, 0, 6, 9, 9, 13, 17, 17, 13, 0, 0],
"à": [0, 0, 2, 4, 0, 30, 17, 17, 17, 30, 0, 0],
"á": [0, 0, 8, 4, 0, 30, 17, 17, 17, 30, 0, 0],
"â": [0, 0, 4, 10, 0, 30, 17, 17, 17, 30, 0, 0],
"ã": [0, 0, 22, 9, 0, 30, 17, 17, 17, 30, 0, 0],
"ä": [0, 0, 0, 10, 0, 30, 17, 17, 17, 30, 0, 0],
"å": [0, 4, 10, 4, 0, 30, 17, 17, 17, 30, 0, 0],
"æ": [0, 0, 0, 0, 0, 14, 21, 29, 5, 30, 0, 0],
"ç": [0, 0, 0, 0, 0, 14, 17, 1, 17, 14, 8, 6],
"è": [0, 0, 2, 4, 0, 14, 17, 31, 1, 14, 0, 0],
"é": [0, 0, 8, 4, 0, 14, 17, 31, 1, 14, 0, 0],
"ê": [0, 0, 4, 10, 0, 14, 17, 31, 1, 14, 0, 0],
"ë": [0, 0, 0, 10, 0, 14, 17, 31, 1, 14, 0, 0],
"ì": [0, 0, 2, 4, 0, 6, 4, 4, 4, 31, 0, 0],
"í": [0, 0, 8, 4, 0, 6, 4, 4, 4, 31, 0, 0],
"î": [0, 0, 4, 10, 0, 6, 4, 4, 4, 31, 0, 0],
"ï": [0, 0, 0, 10, 0, 6, 4, 4, 4, 31, 0, 0],
"ð": [0, 0, 14, 48, 24, 30, 17, 17, 17, 14, 0, 0],
"ñ": [0, 0, 22, 9, 0, 15, 17, 17, 17, 17, 0, 0],
"ò": [0, 0, 2, 4, 0, 14, 17, 17, 17, 14, 0, 0],
"ó": [0, 0, 8, 4, 0, 14, 17, 17, 17, 14, 0, 0],
"ô": [0, 0, 4, 10, 0, 14, 17, 17, 17, 14, 0, 0],
"õ": [0, 0, 22, 9, 0, 14, 17, 17, 17, 14, 0, 0],
"ö": [0, 0, 0, 10, 0, 14, 17, 17, 17, 14, 0, 0],
"÷": [0, 0, 0, 0, 0, 4, 0, 31, 0, 4, 0, 0],
"ø": [0, 0, 0, 0, 0, 22, 9, 21, 18, 13, 0, 0],
"ù": [0, 0, 2, 4, 0, 17, 17, 17, 17, 30, 0, 0],
"ú": [0, 0, 8, 4, 0, 17, 17, 17, 17, 30, 0, 0],
"û": [0, 0, 4, 10, 0, 17, 17, 17, 17, 30, 0, 0],
"ü": [0, 0, 0, 10, 0, 17, 17, 17, 17, 30, 0, 0],
"ý": [0, 0, 8, 4, 0, 17, 17, 17, 17, 30, 16, 14],
"þ": [0, 0, 0, 1, 1, 15, 17, 17, 17, 15, 1, 1],
"ÿ": [0, 0, 0, 10, 0, 17, 17, 17, 17, 30, 16, 14],
"Ā": [0, 14, 0, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"ā": [0, 0, 0, 14, 0, 30, 17, 17, 17, 30, 0, 0],
"Ă": [10, 4, 0, 14, 17, 17, 31, 17, 17, 17, 0, 0],
"ă": [0, 0, 10, 4, 0, 30, 17, 17, 17, 30, 0, 0],
"Ą": [0, 0, 0, 14, 17, 17, 31, 17, 17, 17, 8, 16],
"ą": [0, 0, 0, 0, 0, 30, 17, 17, 17, 30, 4, 24],
"Ć": [8, 4, 0, 14, 17, 1, 1, 1, 17, 14, 0, 0],
"ć": [0, 0, 8, 4, 0, 14, 17, 1, 17, 14, 0, 0],
"Ĉ": [4, 10, 0, 14, 17, 1, 1, 1, 17, 14, 0, 0],
"ĉ": [0, 0, 4, 10, 0, 14, 17, 1, 17, 14, 0, 0],
"Ċ": [0, 4, 0, 14, 17, 1, 1, 1, 17, 14, 0, 0],
"ċ": [0, 0, 0, 4, 0, 14, 17, 1, 17, 14, 0, 0],
"Č": [10, 4, 0, 14, 17, 1, 1, 1, 17, 14, 0, 0],
"č": [0, 0, 10, 4, 0, 14, 17, 1, 17, 14, 0, 0],
"Ď": [10, 4, 0, 15, 17, 17, 17, 17, 17, 15, 0, 0],
"ď": [0, 0, 80, 80, 16, 30, 17, 17, 17, 30, 0, 0],
"Đ": [0, 0, 0, 15, 17, 17, 19, 17, 17, 15, 0, 0],
"đ": [0, 0, 16, 60, 16, 30, 17, 17, 17, 30, 0, 0],
"Ē": [0, 14, 0, 31, 1, 1, 7, 1, 1, 31, 0, 0],
"ē": [0, 0, 0, 14, 0, 14, 17, 31, 1, 14, 0, 0],
"Ĕ": [10, 4, 0, 31, 1, 1, 7, 1, 1, 31, 0, 0],
"ĕ": [0, 0, 10, 4, 0, 14, 17, 31, 1, 14, 0, 0],
"Ė": [0, 4, 0, 31, 1, 1, 7, 1, 1, 31, 0, 0],
"ė": [0, 0, 0, 4, 0, 14, 17, 31, 1, 14, 0, 0],
"Ę": [0, 0, 0, 31, 1, 1, 7, 1, 1, 31, 4, 24],
"ę": [0, 0, 0, 0, 0, 14, 17, 31, 1, 30, 4, 24],
"Ě": [0, 14, 0, 31, 1, 1, 7, 1, 1, 31, 0, 0],
"ě": [0, 0, 0, 10, 0, 14, 17, 31, 1, 14, 0, 0],
"Ĝ": [4, 10, 0, 14, 17, 1, 29, 17, 17, 14, 0, 0],
"ĝ": [0, 0, 4, 10, 0, 30, 17, 17, 17, 30, 16, 14],
"Ğ": [10, 4, 0, 14, 17, 1, 29, 17, 17, 14, 0, 0],
"ğ": [0, 0, 10, 4, 0, 30, 17, 17, 17, 30, 16, 14],
"Ġ": [0, 4, 0, 14, 17, 1, 29, 17, 17, 14, 0, 0],
"ġ": [0, 0, 0, 4, 0, 30, 17, 17, 17, 30, 16, 14],
"Ģ": [0, 0, 0, 14, 17, 1, 29, 17, 17, 14, 8, 6],
"ģ": [0, 0, 8, 4, 0, 30, 17, 17, 17, 30, 16, 14],
"Ĥ": [4, 10, 0, 17, 17, 17, 31, 17, 17, 17, 0, 0],
"ĥ": [0, 0, 8, 21, 1, 15, 17, 17, 17, 17, 0, 0],
"Ħ": [0, 0, 0, 17, 63, 17, 31, 17, 17, 17, 0, 0],
"ħ": [0, 0, 0, 1, 3, 1, 15, 17, 17, 17, 0, 0],
"Ĩ": [22, 9, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"ĩ": [0, 0, 22, 9, 0, 6, 4, 4, 4, 31, 0, 0],
"Ī": [0, 14, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"ī": [0, 0, 0, 14, 0, 6, 4, 4, 4, 31, 0, 0],
"Ĭ": [10, 4, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"ĭ": [0, 0, 10, 4, 0, 6, 4, 4, 4, 31, 0, 0],
"Į": [0, 0, 0, 31, 4, 4, 4, 4, 4, 31, 4, 24],
"į": [0, 0, 0, 4, 0, 6, 4, 4, 4, 31, 4, 24],
"İ": [22, 9, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"ı": [0, 0, 0, 0, 0, 6, 4, 4, 4, 31, 0, 0],
"IJ": [0, 0, 0, 23, 18, 18, 18, 18, 18, 15, 0, 0],
"ij": [0, 0, 0, 18, 0, 27, 18, 18, 18, 31, 16, 14],
"Ĵ": [4, 10, 0, 16, 16, 16, 16, 17, 17, 14, 0, 0],
"ĵ": [0, 0, 16, 40, 0, 24, 16, 16, 16, 16, 17, 14],
"Ķ": [0, 0, 0, 17, 9, 5, 3, 5, 9, 17, 4, 4],
"ķ": [0, 0, 0, 1, 1, 17, 9, 7, 9, 17, 4, 4],
"ĸ": [0, 0, 0, 0, 0, 17, 9, 7, 9, 17, 0, 0],
"Ĺ": [8, 4, 0, 1, 1, 1, 1, 1, 1, 31, 0, 0],
"ĺ": [8, 4, 0, 31, 4, 4, 4, 4, 4, 31, 0, 0],
"Ļ": [0, 0, 0, 1, 1, 1, 1, 1, 1, 31, 8, 6],
"ļ": [0, 0, 0, 31, 4, 4, 4, 4, 4, 31, 8, 6],
"Ľ": [0, 0, 0, 17, 17, 9, 1, 1, 1, 31, 0, 0],
"ľ": [0, 0, 0, 19, 18, 10, 2, 2, 2, 28, 0, 0],
"Ŀ": [0, 0, 0, 1, 1, 1, 9, 1, 1, 31, 0, 0],
"ŀ": [0, 0, 0, 3, 2, 2, 10, 2, 2, 28, 0, 0],
"Ł": [0, 0, 0, 1, 1, 1, 3, 1, 1, 31, 0, 0],
"ł": [0, 0, 0, 3, 2, 2, 6, 3, 2, 28, 0, 0],
"Ń": [8, 4, 0, 17, 17, 19, 21, 25, 17, 17, 0, 0],
"ń": [0, 0, 8, 4, 0, 15, 17, 17, 17, 17, 0, 0],
"Ņ": [0, 0, 0, 17, 17, 19, 21, 25, 17, 17, 4, 3],
"ņ": [0, 0, 0, 0, 0, 15, 17, 17, 17, 17, 4, 3],
"Ň": [10, 4, 0, 17, 17, 19, 21, 25, 17, 17, 0, 0],
"ň": [0, 0, 10, 4, 0, 15, 17, 17, 17, 17, 0, 0],
"ʼn": [0, 0, 0, 0, 0, 15, 17, 17, 17, 17, 0, 0],
"Ŋ": [0, 0, 0, 17, 17, 19, 21, 25, 17, 17, 16, 12],
"ŋ": [0, 0, 0, 0, 0, 15, 17, 17, 17, 17, 16, 12],
"Ō": [0, 14, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"ō": [0, 0, 0, 14, 0, 14, 17, 17, 17, 14, 0, 0],
"Ŏ": [10, 4, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"ŏ": [0, 0, 10, 4, 0, 14, 17, 17, 17, 14, 0, 0],
"Ő": [20, 10, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"ő": [0, 0, 20, 10, 0, 14, 17, 17, 17, 14, 0, 0],
"Œ": [0, 0, 0, 30, 5, 5, 29, 5, 5, 30, 0, 0],
"œ": [0, 0, 0, 0, 0, 14, 21, 29, 5, 14, 0, 0],
"Ŕ": [8, 4, 0, 15, 17, 17, 15, 17, 17, 17, 0, 0],
"ŕ": [0, 0, 8, 4, 0, 13, 19, 1, 1, 1, 0, 0],
"Ŗ": [0, 0, 0, 15, 17, 17, 15, 17, 17, 17, 4, 3],
"ŗ": [0, 0, 0, 0, 0, 13, 19, 1, 1, 1, 4, 3],
"Ř": [10, 4, 0, 15, 17, 17, 15, 17, 17, 17, 0, 0],
"ř": [0, 0, 10, 4, 0, 13, 19, 1, 1, 1, 0, 0],
"Ś": [8, 4, 0, 14, 17, 1, 14, 16, 17, 14, 0, 0],
"ś": [0, 0, 8, 4, 0, 30, 1, 14, 16, 15, 0, 0],
"Ŝ": [4, 10, 0, 14, 17, 1, 14, 16, 17, 14, 0, 0],
"ŝ": [0, 0, 4, 10, 0, 30, 1, 14, 16, 15, 0, 0],
"Ş": [0, 0, 0, 14, 17, 1, 14, 16, 17, 14, 4, 3],
"ş": [0, 0, 0, 0, 0, 30, 1, 14, 16, 15, 4, 3],
"Š": [10, 4, 0, 14, 17, 1, 14, 16, 17, 14, 0, 0],
"š": [0, 0, 10, 4, 0, 30, 1, 14, 16, 15, 0, 0],
"Ţ": [0, 0, 0, 31, 4, 4, 4, 4, 4, 4, 4, 3],
"ţ": [0, 0, 0, 2, 2, 15, 2, 2, 2, 28, 8, 6],
"Ť": [10, 4, 0, 31, 4, 4, 4, 4, 4, 4, 0, 0],
"ť": [0, 0, 8, 10, 2, 15, 2, 2, 2, 28, 0, 0],
"Ŧ": [0, 0, 0, 31, 4, 14, 4, 4, 4, 4, 0, 0],
"ŧ": [0, 0, 0, 2, 15, 2, 15, 2, 2, 28, 0, 0],
"Ũ": [22, 9, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"ũ": [0, 0, 22, 9, 0, 17, 17, 17, 17, 30, 0, 0],
"Ū": [0, 14, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"ū": [0, 0, 0, 14, 0, 17, 17, 17, 17, 30, 0, 0],
"Ŭ": [10, 4, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"ŭ": [0, 0, 10, 4, 0, 17, 17, 17, 17, 30, 0, 0],
"Ů": [10, 4, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"ů": [0, 4, 10, 4, 0, 17, 17, 17, 17, 30, 0, 0],
"Ű": [20, 10, 0, 17, 17, 17, 17, 17, 17, 14, 0, 0],
"ű": [0, 0, 20, 10, 0, 17, 17, 17, 17, 30, 0, 0],
"Ų": [0, 0, 0, 17, 17, 17, 17, 17, 17, 14, 4, 24],
"ų": [0, 0, 0, 0, 0, 17, 17, 17, 17, 30, 4, 24],
"Ŵ": [4, 10, 0, 17, 17, 17, 17, 21, 27, 17, 0, 0],
"ŵ": [0, 0, 4, 10, 0, 17, 17, 21, 21, 10, 0, 0],
"Ŷ": [4, 10, 0, 17, 17, 10, 4, 4, 4, 4, 0, 0],
"ŷ": [0, 0, 4, 10, 0, 17, 17, 17, 17, 30, 16, 14],
"Ÿ": [0, 10, 0, 17, 17, 10, 4, 4, 4, 4, 0, 0],
"Ź": [8, 4, 0, 31, 16, 8, 4, 2, 1, 31, 0, 0],
"ź": [0, 0, 8, 4, 0, 31, 8, 4, 2, 31, 0, 0],
"Ż": [0, 4, 0, 31, 16, 8, 4, 2, 1, 31, 0, 0],
"ż": [0, 0, 0, 4, 0, 31, 8, 4, 2, 31, 0, 0],
"Ž": [10, 4, 0, 31, 16, 8, 4, 2, 1, 31, 0, 0],
"ž": [0, 0, 10, 4, 0, 31, 8, 4, 2, 31, 0, 0],
"Ё": [0, 10, 0, 31, 1, 1, 15, 1, 1, 31, 0, 0],
"А": [0, 0, 0, 14, 17, 17, 17, 31, 17, 17, 0, 0],
"Б": [0, 0, 0, 31, 1, 1, 15, 17, 17, 15, 0, 0],
"В": [0, 0, 0, 15, 17, 17, 15, 17, 17, 15, 0, 0],
"Г": [0, 0, 0, 31, 1, 1, 1, 1, 1, 1, 0, 0],
"Д": [0, 0, 0, 12, 10, 10, 10, 10, 10, 31, 17, 0],
"Е": [0, 0, 0, 31, 1, 1, 15, 1, 1, 31, 0, 0],
"Ж": [0, 0, 0, 21, 21, 21, 14, 21, 21, 21, 0, 0],
"З": [0, 0, 0, 14, 17, 16, 14, 16, 17, 14, 0, 0],
"И": [0, 0, 0, 17, 17, 25, 21, 19, 17, 17, 0, 0],
"Й": [0, 10, 4, 17, 17, 25, 21, 19, 17, 17, 0, 0],
"К": [0, 0, 0, 25, 5, 5, 3, 5, 9, 17, 0, 0],
"Л": [0, 0, 0, 30, 18, 18, 18, 18, 18, 17, 0, 0],
"М": [0, 0, 0, 17, 27, 21, 17, 17, 17, 17, 0, 0],
"Н": [0, 0, 0, 17, 17, 17, 31, 17, 17, 17, 0, 0],
"О": [0, 0, 0, 14, 17, 17, 17, 17, 17, 14, 0, 0],
"П": [0, 0, 0, 31, 17, 17, 17, 17, 17, 17, 0, 0],
"Р": [0, 0, 0, 15, 17, 17, 15, 1, 1, 1, 0, 0],
"С": [0, 0, 0, 14, 17, 1, 1, 1, 17, 14, 0, 0],
"Т": [0, 0, 0, 31, 4, 4, 4, 4, 4, 4, 0, 0],
"У": [0, 0, 0, 17, 17, 17, 17, 30, 16, 14, 0, 0],
"Ф": [0, 0, 0, 4, 14, 21, 21, 21, 14, 4, 0, 0],
"Х": [0, 0, 0, 17, 17, 10, 4, 10, 17, 17, 0, 0],
"Ц": [0, 0, 0, 0, 9, 9, 9, 9, 9, 31, 16, 0],
"Ч": [0, 0, 0, 17, 17, 17, 30, 16, 16, 16, 0, 0],
"Ш": [0, 0, 0, 21, 21, 21, 21, 21, 21, 31, 0, 0],
"Щ": [0, 0, 0, 21, 21, 21, 21, 21, 21, 31, 16, 0],
"Ъ": [0, 0, 0, 0, 3, 2, 14, 18, 18, 14, 0, 0],
"Ы": [0, 0, 0, 0, 17, 17, 19, 21, 21, 19, 0, 0],
"Ь": [0, 0, 0, 0, 1, 1, 15, 17, 17, 15, 0, 0],
"Э": [0, 0, 0, 14, 17, 16, 28, 16, 17, 14, 0, 0],
"Ю": [0, 0, 0, 9, 21, 21, 23, 21, 21, 9, 0, 0],
"Я": [0, 0, 0, 0, 30, 17, 17, 30, 17, 17, 0, 0],
"а": [0, 0, 0, 0, 0, 14, 16, 30, 17, 30, 0, 0],
"б": [0, 0, 0, 30, 1, 13, 19, 17, 17, 14, 0, 0],
"в": [0, 0, 0, 0, 0, 15, 17, 15, 17, 15, 0, 0],
"г": [0, 0, 0, 0, 0, 31, 1, 1, 1, 1, 0, 0],
"д": [0, 0, 0, 0, 0, 12, 10, 10, 10, 31, 17, 0],
"е": [0, 0, 0, 0, 0, 14, 17, 31, 1, 14, 0, 0],
"ж": [0, 0, 0, 0, 0, 21, 14, 4, 14, 21, 0, 0],
"з": [0, 0, 0, 0, 0, 6, 9, 4, 9, 6, 0, 0],
"и": [0, 0, 0, 0, 0, 17, 25, 21, 19, 17, 0, 0],
"й": [0, 0, 0, 10, 4, 17, 25, 21, 19, 17, 0, 0],
"к": [0, 0, 0, 0, 0, 17, 9, 7, 9, 17, 0, 0],
"л": [0, 0, 0, 0, 0, 30, 18, 18, 18, 17, 0, 0],
"м": [0, 0, 0, 0, 0, 17, 27, 21, 17, 17, 0, 0],
"н": [0, 0, 0, 0, 0, 17, 17, 31, 17, 17, 0, 0],
"о": [0, 0, 0, 0, 0, 14, 17, 17, 17, 14, 0, 0],
"п": [0, 0, 0, 0, 0, 31, 17, 17, 17, 17, 0, 0],
"р": [0, 0, 0, 0, 0, 13, 19, 17, 17, 15, 1, 1],
"с": [0, 0, 0, 0, 0, 14, 17, 1, 17, 14, 0, 0],
"т": [0, 0, 0, 0, 0, 31, 4, 4, 4, 4, 0, 0],
"у": [0, 0, 0, 0, 0, 17, 17, 17, 17, 30, 16, 14],
"ф": [0, 0, 0, 4, 4, 14, 21, 21, 21, 14, 4, 4],
"х": [0, 0, 0, 0, 0, 17, 10, 4, 10, 17, 0, 0],
"ц": [0, 0, 0, 0, 0, 9, 9, 9, 9, 31, 16, 0],
"ч": [0, 0, 0, 0, 0, 17, 17, 17, 30, 16, 0, 0],
"ш": [0, 0, 0, 0, 0, 21, 21, 21, 21, 31, 0, 0],
"щ": [0, 0, 0, 0, 0, 21, 21, 21, 21, 31, 16, 0],
"ъ": [0, 0, 0, 0, 0, 3, 2, 14, 18, 14, 0, 0],
"ы": [0, 0, 0, 0, 0, 17, 17, 19, 21, 19, 0, 0],
"ь": [0, 0, 0, 0, 0, 1, 1, 15, 17, 15, 0, 0],
"э": [0, 0, 0, 0, 0, 14, 17, 28, 17, 14, 0, 0],
"ю": [0, 0, 0, 0, 0, 9, 21, 23, 21, 9, 0, 0],
"я": [0, 0, 0, 0, 0, 30, 17, 17, 30, 17, 0, 0],
"ё": [0, 0, 0, 10, 0, 14, 17, 31, 1, 14, 0, 0],
"": [0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 0, 0],
"": [0, 0, 0, 8, 4, 0, 0, 0, 0, 0, 0, 0],
"": [0, 0, 0, 0, 0, 0, 0, 0, 21, 21, 0, 0],
"": [0, 0, 0, 12, 18, 7, 2, 7, 18, 12, 0, 0],
"": [0, 0, 0, 0, 0, 4, 30, 31, 30, 4, 0, 0],
"": [0, 0, 0, 0, 0, 4, 14, 31, 14, 14, 0, 0],
"": [0, 0, 0, 0, 0, 4, 15, 31, 15, 4, 0, 0],
"": [0, 0, 0, 0, 0, 14, 14, 31, 14, 4, 0, 0],
" ": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
}
def make_bytes(ch):
rows = monogram[ch]
index = list(monogram).index(ch) # ordered dict comes in handy
print('\t//', repr(ch))
for i, byte in enumerate(rows):
if not byte: continue
a = f'{byte:07b}' # convert byte to zero-left-padded str
print(f'\tfont_monogram_data[{index}][{i:2}] = 0b{a};');
NUM_CHARS = len(monogram)
MAX_ORD = max(map(ord, monogram))
print(f'''\
#define FONT_MONOGRAM_NUMBER_OF_CHARACTERS {NUM_CHARS}
#define FONT_MONOGRAM_HEIGHT 12
#define FONT_MONOGRAM_WIDTH 7
// This is 12 bytes of data per char, as in 12 rows, and each byte
// represents the pixels in that row.
u8 font_monogram_data[{NUM_CHARS}][12];
// Map from ord(ch) to index of ch's data in font_monogram_data.
// This is for when you know the character that you want to draw but not
// its index in the font_monogram_data array.
u16 font_monogram_chars[{MAX_ORD}];
void
init_monogram_font_data()
{{
\tmemset(font_monogram_data, 0, sizeof(font_monogram_data));
\t// Empty slots initialized to -1.
\tmemset(font_monogram_chars, 0xFF, sizeof(font_monogram_chars));
''')
for i, ch in enumerate(monogram):
make_bytes(ch)
print(f'\tfont_monogram_chars[{hex(ord(ch))}] = {i};')
print('}')

View File

@ -144,6 +144,7 @@ carefree_wu_line(u32* dest, size_t dest_stride, u64 x, u64 y, u64 w, u64 h, u32
// > We translate the point (x0, y0) to the origin, // > We translate the point (x0, y0) to the origin,
// so y = kx where k = h/w with k <= 1 // so y = kx where k = h/w with k <= 1
// (actually k < 1 because 45° lines are special-cased.)
u16 k = 0xFFFF * h / w; u16 k = 0xFFFF * h / w;
u16 d = k >> 1; u16 d = k >> 1;
while (w) { while (w) {

View File

@ -0,0 +1,82 @@
// In the Thun dialect of Joy we have four types of values:
// Integers, Booleans, Symbols, and Lists.
// We don't have Unions, Enums, or Typedefs.
// So how do we represent Joy types?
// In SICP they use a pair of arrays of pointers, one for heads and one
// for tails.
// > A pointer to a pair is an index into the two vectors.
#define HEAP_SIZE 1024
u32 heads[HEAP_SIZE];
u32 tails[HEAP_SIZE];
u32 free = 0;
// > We also need a representation for objects other than pairs (such as
// numbers and symbols) and a way to distinguish one kind of data from
// another. There are many methods of accomplishing this, but they all
// reduce to using typed pointers, that is, to extending the notion of
// ``pointer'' to include information on data type.
#define TYPE_OF(pointer) (pointer >> 30)
#define VALUE_OF(pointer) (pointer & 0x3fffffff)
#define MAKE_POINTER(type, value) ((type & 3) << 30) | (value & 0x3fffffff)
#define joyInt (0)
#define joyList (1)
#define joySymbol (2)
#define joyBool (3)
u32 empty_list = 0xffffffff;
u32
cons(u32 head, u32 tail)
{
if (free >= HEAP_SIZE) {
//panic
return;
}
heads[free] = head;
tails[free] = tail;
u32 cell = MAKE_POINTER(joyList, free);
++free;
return cell;
}
u32
head(u32 list)
{
return heads[VALUE_OF(list)];
}
u32
tail(u32 list)
{
return tails[VALUE_OF(list)];
}
void
main()
{
u32 stack = empty_list;
stack = cons(23, stack);
stack = cons(42, stack);
stack = cons(273, stack);
print_i64(head(stack));print_str(",");
stack = tail(stack);
print_i64(head(stack));print_str(",");
stack = tail(stack);
print_i64(head(stack));print_str(",");
stack = tail(stack);
print_i64(head(stack));print_str(",");
print_endl();
}

View File

@ -1,22 +1,22 @@
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
LIMIT = 0xffff
def draw_wu_line(draw, x, y, w, h): def draw_wu_line(draw, x, y, w, h):
# Without loss of generality only lines in the first oc # Without loss of generality only lines in the first oc
assert(w > 0 and h > 0 and w > h) assert(w > 0 and h > 0 and w > h)
k = 0xffff * h // w k = LIMIT * (h-1) // w
print(bin(k), hex(k), k)
x1 = x + w - 1 x1 = x + w - 1
y1 = y + h - 1 y1 = y + h - 1
print(x1, y1)
d = 0 d = 0
while x1 > x: while x1 > x:
draw.point([(x, y), (x1, y1)], fill=(0, 0, 0, 0xff - (d >> 8))) draw.point([(x, y), (x1, y1)], fill=(0, 0, 0, 0xff - (d >> 8)))
draw.point([(x, y + 1), (x1, y1 - 1)], fill=(0, 0, 0, d >> 8)) draw.point([(x, y + 1), (x1, y1 - 1)], fill=(0, 0, 0, d >> 8))
x += 1 x += 1
x1 -= 1 x1 -= 1
if d + k >= 0xFFFF: if d + k >= LIMIT:
d = k - (0xFFFF - d) d = k - (LIMIT - d)
y += 1 y += 1
y1 -= 1 y1 -= 1
else: else:
@ -30,14 +30,14 @@ def draw_wu_line(draw, x, y, w, h):
alpha = 0x7f alpha = 0x7f
draw.point(points, fill=(0, 0, 0, alpha)) draw.point(points, fill=(0, 0, 0, alpha))
size = 100, 50 size = 100, 33
im = Image.new('RGBA', size) im = Image.new('RGBA', size)
d = ImageDraw.Draw(im, 'RGBA') d = ImageDraw.Draw(im, 'RGBA')
#draw_wu_line(d, 0, 0, *size) draw_wu_line(d, 0, 0, *size)
for w in range(51, 100): ##for w in range(51, 100):
draw_wu_line(d, 0, 0, w, 50) ## draw_wu_line(d, 0, 0, w, 50)
base = Image.new('RGBA', size, (0xff, 0xff, 0xff, 0xff)) base = Image.new('RGBA', size, (0xff, 0xff, 0xff, 0xff))
base.alpha_composite(im) base.alpha_composite(im)

View File

@ -0,0 +1,38 @@
FRAME_WIDTH = 100
color = 1
line_color_buffer = [0] * FRAME_WIDTH
line_color_buffer[0] = color;
offset = 1
while ((offset << 1) < FRAME_WIDTH):
color += 1
print(f't: {offset} color: {color}')
line_color_buffer[offset:offset << 1] = [color] * offset
offset = offset << 1
print(f't: {offset} color: {color}')
remainder = FRAME_WIDTH - offset
line_color_buffer[offset:] = line_color_buffer[:remainder]
print(line_color_buffer)
##for i, n in enumerate(line_color_buffer):
## print((i), n)
## if not n:
## break
[
1, 1,
2, 2,
3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
1, 1,
2, 2,
3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6
]

View File

@ -0,0 +1,43 @@
utf8d = [
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,# // 00..1f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,# // 20..3f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,# // 40..5f
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,# // 60..7f
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,# // 80..9f
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,# // a0..bf
8,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,# // c0..df
0xa,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x3,0x4,0x3,0x3,# // e0..ef
0xb,0x6,0x6,0x6,0x5,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,0x8,# // f0..ff
0x0,0x1,0x2,0x3,0x5,0x8,0x7,0x1,0x1,0x1,0x4,0x6,0x1,0x1,0x1,0x1,# // s0..s0
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,0,1,0,1,1,1,1,1,1,# // s1..s2
1,2,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,# // s3..s4
1,2,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,3,1,3,1,1,1,1,1,1,# // s5..s6
1,3,1,1,1,1,1,3,1,3,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,# // s7..s8
]
for i, byte in enumerate(utf8d):
print(f'utf8d[{i:3}] = 0x{byte:x};', end=' ' if (i + 1) % 4 else '\n')
##utf8d[ 0] = 0; utf8d[ 1] = 0; utf8d[ 2] = 0; utf8d[ 3] = 0;
##utf8d[ 4] = 0; utf8d[ 5] = 0; utf8d[ 6] = 0; utf8d[ 7] = 0;
##utf8d[ 8] = 0; utf8d[ 9] = 0; utf8d[ 10] = 0; utf8d[ 11] = 0;
##
99
32
226
134
144
0b01100011;
0b00100000;
0b1110
0010;
0b10
000110;
0b10
010000;
0b0010_000110_010000
0b10_000110_010000

Binary file not shown.

Before

Width:  |  Height:  |  Size: 916 B

After

Width:  |  Height:  |  Size: 452 B

View File

@ -2,6 +2,7 @@
#include <uvm/syscalls.h> #include <uvm/syscalls.h>
#include <uvm/utils.h> #include <uvm/utils.h>
#include "/home/sforman/src/Joypy/implementations/uvm-ncc/font/font.h" #include "/home/sforman/src/Joypy/implementations/uvm-ncc/font/font.h"
#include "/home/sforman/src/Joypy/implementations/uvm-ncc/font/monogram.h"
#include "/home/sforman/src/Joypy/implementations/uvm-ncc/graphics.h" #include "/home/sforman/src/Joypy/implementations/uvm-ncc/graphics.h"
#define font_data font_PublicPixel_22_data #define font_data font_PublicPixel_22_data
@ -42,6 +43,31 @@ draw_char(u8 ch, u64 dest_x, u64 dest_y)
} }
void
draw_monogram_char(u8 ch, u64 dest_x, u64 dest_y, u32 color)
{
// Check the inputs.
if (ch < 0 || dest_x < 0 || dest_y < 0
|| ch > font_monogram_number_of_characters
|| dest_x >= (FRAME_WIDTH - font_monogram_width)
|| dest_y >= (FRAME_HEIGHT - font_monogram_height))
// No error message or anything, just decline to draw.
return;
u32* d = frame_buffer + FRAME_WIDTH * dest_y + dest_x;
for (u64 y = 0; y < font_monogram_height; ++y) {
u8 pixel_bits = font_monogram_data[ch][y];
for (u64 x = 0; x < font_monogram_width; ++x) {
if (!pixel_bits) break;
if (pixel_bits & 1) {
*(d+x) = color;
}
pixel_bits = pixel_bits >> 1;
}
d = d + FRAME_WIDTH;
}
}
void void
keydown(u64 window_id, u16 keycode) keydown(u64 window_id, u16 keycode)
{ {
@ -98,17 +124,27 @@ void
main() main()
{ {
init_font_data(); init_font_data();
init_monogram_font_data();
wid = window_create(FRAME_WIDTH, FRAME_HEIGHT, "Xerblin", 0); wid = window_create(FRAME_WIDTH, FRAME_HEIGHT, "Xerblin", 0);
draw_background(frame_buffer, FRAME_WIDTH, FRAME_HEIGHT); draw_background(frame_buffer, FRAME_WIDTH, FRAME_HEIGHT);
for (size_t ch = 0; ch < font_numchars; ++ch) { for (size_t ch = 0; ch < font_monogram_number_of_characters; ++ch) {
draw_char( draw_monogram_char(
ch, ch,
128 + (ch % 26) * font_width, 129 + (ch % 26) * font_monogram_width,
128 + (ch / 26) * font_height 129 + (ch / 26) * font_monogram_height,
0x00000000
); );
} }
u64 w = 3 + 26 * font_width; for (size_t ch = 0; ch < font_monogram_number_of_characters; ++ch) {
u64 h = 4 + 4 * font_height; draw_monogram_char(
ch,
128 + (ch % 26) * font_monogram_width,
128 + (ch / 26) * font_monogram_height,
0x00FFFFFF
);
}
u64 w = 3 + 26 * font_monogram_width;
u64 h = 4 + font_monogram_number_of_characters / 26 * font_monogram_height;
carefree_draw_box(frame_buffer, FRAME_WIDTH, 126, 126, w, h, WHITE); carefree_draw_box(frame_buffer, FRAME_WIDTH, 126, 126, w, h, WHITE);
w = 200; w = 200;
carefree_wu_line(frame_buffer, FRAME_WIDTH, 0, 0, FRAME_WIDTH, FRAME_HEIGHT-1, WHITE); carefree_wu_line(frame_buffer, FRAME_WIDTH, 0, 0, FRAME_WIDTH, FRAME_HEIGHT-1, WHITE);