---
Notes:
Removal of font-loading was a regression
that made this app unusable for me: The default font is
butt-ugly (IMO) and it's not easy to modify the built-in font as is.
Ideally, we would include the font as some data at compile time
(rather than hard-code it into the source code).
Until then, this patch allows for fonts to be loaded in.
(it's also available at https://git.sr.ht/~earboxer/left/tree/fixLoadFont)
This patch does not include support for colors or non-printing characters,
like https://git.sr.ht/~earboxer/left/tree/zach001 has.
left.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/left.c b/left.c
index 32cabcb..93d9c13 100644
--- a/left.c
+++ b/left.c
@@ -60,7 +60,7 @@ Uint8 icons[][8] = {
{0x00, 0x38, 0x44, 0x92, 0x28, 0x10, 0x00, 0x00} /* eye closed */
};
-Uint8 font[][8] = {
+Uint8 font[][16] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* space */
{0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08},
{0x00, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00},
@@ -626,6 +626,18 @@ selectoption(int option)
}
}
+void
+loadchr(FILE *f)
+{
+ if(f) {
+ /* Read nonprinting characters. */
+ fread(font, 32, 16, f);
+ fread(font, sizeof(font), 1, f);
+ puts("Loaded font!");
+ fclose(f);
+ }
+}
+
void
makedoc(Document *d, char *name)
{
@@ -863,6 +875,7 @@ main(int argc, char *argv[])
int ticknext = 0;
if(!init())
return error("Init", "Failure");
+ loadchr(fopen("type.chr", "r"));
if(argc < 2 || !opendoc(&doc, argv[1]))
makedoc(&doc, "untitled.txt");
while(1) {
--
2.29.2