Browse Source

Add more glyphs to the default font

rexim 3 years ago
parent
commit
9e7ad386e6
2 changed files with 108 additions and 1 deletions
  1. 108 1
      olive.c
  2. BIN
      test/hello_world_text_rendering_expected.png

+ 108 - 1
olive.c

@@ -24,6 +24,7 @@ typedef struct {
 
 
 #define DEFAULT_FONT_HEIGHT 6
 #define DEFAULT_FONT_HEIGHT 6
 #define DEFAULT_FONT_WIDTH 6
 #define DEFAULT_FONT_WIDTH 6
+// TODO: allocate proper descender and acender areas for the default font
 static char default_font_glyphs[128][DEFAULT_FONT_HEIGHT][DEFAULT_FONT_WIDTH] = {
 static char default_font_glyphs[128][DEFAULT_FONT_HEIGHT][DEFAULT_FONT_WIDTH] = {
     ['a'] = {
     ['a'] = {
         {0, 0, 0, 0, 0},
         {0, 0, 0, 0, 0},
@@ -163,7 +164,113 @@ static char default_font_glyphs[128][DEFAULT_FONT_HEIGHT][DEFAULT_FONT_WIDTH] =
     ['Y'] = {},
     ['Y'] = {},
     ['Z'] = {},
     ['Z'] = {},
 
 
-    [','] = {}
+    ['0'] = {
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {0, 1, 1, 0, 0},
+    },
+    ['1'] = {
+        {0, 0, 1, 0, 0},
+        {0, 1, 1, 0, 0},
+        {0, 0, 1, 0, 0},
+        {0, 0, 1, 0, 0},
+        {0, 0, 1, 0, 0},
+        {0, 1, 1, 1, 0},
+    },
+    ['2'] = {
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 1, 0},
+        {0, 0, 0, 1, 0},
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 0, 0},
+        {1, 1, 1, 1, 0},
+    },
+    ['3'] = {
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 1, 0},
+        {0, 0, 1, 0, 0},
+        {0, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {0, 1, 1, 0, 0},
+    },
+    ['4'] = {
+        {0, 0, 1, 1, 0},
+        {0, 1, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {1, 1, 1, 1, 1},
+        {0, 0, 0, 1, 0},
+        {0, 0, 0, 1, 0},
+    },
+    ['5'] = {
+        {1, 1, 1, 0, 0},
+        {1, 0, 0, 0, 0},
+        {1, 1, 1, 0, 0},
+        {0, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {0, 1, 1, 0, 0},
+    },
+    ['6'] = {
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 0, 0},
+        {1, 1, 1, 0, 0},
+        {1, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {0, 1, 1, 0, 0},
+    },
+    ['7'] = {
+        {1, 1, 1, 1, 0},
+        {0, 0, 0, 1, 0},
+        {0, 0, 1, 0, 0},
+        {0, 1, 0, 0, 0},
+        {0, 1, 0, 0, 0},
+        {0, 1, 0, 0, 0},
+    },
+    ['8'] = {
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 1, 0},
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {0, 1, 1, 0, 0},
+
+    },
+    ['9'] = {
+        {0, 1, 1, 0, 0},
+        {1, 0, 0, 1, 0},
+        {1, 0, 0, 1, 0},
+        {0, 1, 1, 1, 0},
+        {0, 0, 0, 1, 0},
+        {0, 1, 1, 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, 1, 0},
+        {0, 0, 1, 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, 1, 0, 0},
+    },
+    ['-'] = {
+        {0, 0, 0, 0, 0},
+        {0, 0, 0, 0, 0},
+        {0, 0, 0, 0, 0},
+        {1, 1, 1, 1, 0},
+        {0, 0, 0, 0, 0},
+        {0, 0, 0, 0, 0},
+    },
 };
 };
 
 
 static Olivec_Font default_font = {
 static Olivec_Font default_font = {

BIN
test/hello_world_text_rendering_expected.png