1
0
Fork 0

Add simple 6x13 pixel font

This commit is contained in:
Aaron Lindsay 2012-09-09 01:52:23 -04:00
parent 332b86f520
commit c96a4e2a57
3 changed files with 31 additions and 0 deletions

14
include/font.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef FONT_H
#define FONT_H
struct font {
char *data; //should be num_chars*bytes_per_char long, with pixels organized row-major
unsigned int width, height; //height and width of the actual characters, in pixels/bits
unsigned int num_chars;
unsigned int bytes_per_char;
int ascii_offset; //If the first element in *data is for the 32nd ASCII character, this would be 32
};
struct font* font_get();
#endif /* FONT_H */

View File

@ -1,5 +1,6 @@
KERNEL_PREFIX = kernel
KOBJS += $(KERNEL_PREFIX)/font.o
KOBJS += $(KERNEL_PREFIX)/framebuffer.o
KOBJS += $(KERNEL_PREFIX)/print.o
KOBJS += $(KERNEL_PREFIX)/start_kernel.o

16
kernel/font.c Normal file
View File

@ -0,0 +1,16 @@
#include <font.h>
char font_data_6x13[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 16, 4, 65, 16, 4, 64, 0, 0, 0, 160, 40, 10, 0, 0, 0, 0, 0, 0, 0, 0, 40, 202, 167, 124, 138, 2, 0, 0, 0, 64, 120, 69, 225, 80, 212, 67, 0, 0, 0, 32, 85, 10, 66, 8, 74, 149, 0, 0, 0, 0, 8, 69, 33, 20, 89, 98, 1, 0, 0, 64, 16, 4, 0, 0, 0, 0, 0, 0, 0, 66, 16, 130, 32, 8, 2, 65, 32, 0, 128, 64, 16, 8, 130, 32, 8, 65, 8, 0, 0, 64, 84, 78, 69, 0, 0, 0, 0, 0, 0, 0, 0, 4, 241, 17, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 8, 0, 0, 0, 0, 0, 240, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225, 16, 0, 0, 0, 65, 8, 66, 8, 66, 16, 0, 0, 0, 64, 40, 81, 20, 69, 145, 66, 0, 0, 0, 64, 24, 5, 65, 16, 4, 241, 1, 0, 0, 224, 68, 17, 132, 16, 66, 240, 1, 0, 0, 240, 65, 8, 225, 64, 80, 228, 0, 0, 0, 128, 32, 140, 162, 36, 31, 130, 0, 0, 0, 240, 5, 65, 51, 65, 80, 228, 0, 0, 0, 224, 68, 65, 240, 68, 81, 228, 0, 0, 0, 240, 65, 8, 66, 16, 130, 32, 0, 0, 0, 224, 68, 81, 228, 68, 81, 228, 0, 0, 0, 224, 68, 81, 228, 65, 80, 228, 0, 0, 0, 0, 0, 132, 67, 0, 0, 225, 16, 0, 0, 0, 0, 132, 67, 0, 0, 67, 8, 0, 0, 0, 33, 132, 16, 8, 4, 2, 1, 0, 0, 0, 0, 192, 7, 0, 31, 0, 0, 0, 0, 16, 8, 4, 2, 33, 132, 16, 0, 0, 0, 224, 68, 17, 132, 16, 4, 64, 0, 0, 0, 224, 68, 81, 86, 85, 77, 224, 1, 0, 0, 64, 40, 81, 20, 125, 81, 20, 1, 0, 0, 240, 72, 146, 228, 72, 146, 244, 0, 0, 0, 224, 68, 65, 16, 4, 65, 228, 0, 0, 0, 240, 72, 146, 36, 73, 146, 244, 0, 0, 0, 240, 5, 65, 240, 4, 65, 240, 1, 0, 0, 240, 5, 65, 240, 4, 65, 16, 0, 0, 0, 224, 68, 65, 16, 100, 81, 228, 0, 0, 0, 16, 69, 81, 244, 69, 81, 20, 1, 0, 0, 224, 16, 4, 65, 16, 4, 225, 0, 0, 0, 192, 33, 8, 130, 32, 72, 98, 0, 0, 0, 16, 69, 73, 49, 20, 73, 20, 1, 0, 0, 16, 4, 65, 16, 4, 65, 240, 1, 0, 0, 16, 69, 91, 85, 69, 81, 20, 1, 0, 0, 16, 77, 83, 85, 101, 89, 20, 1, 0, 0, 224, 68, 81, 20, 69, 81, 228, 0, 0, 0, 240, 68, 81, 244, 4, 65, 16, 0, 0, 0, 224, 68, 81, 20, 69, 81, 229, 64, 0, 0, 240, 68, 81, 244, 20, 73, 20, 1, 0, 0, 224, 68, 65, 224, 64, 80, 228, 0, 0, 0, 240, 17, 4, 65, 16, 4, 65, 0, 0, 0, 16, 69, 81, 20, 69, 81, 228, 0, 0, 0, 16, 69, 81, 164, 40, 10, 65, 0, 0, 0, 16, 69, 81, 84, 85, 85, 165, 0, 0, 0, 16, 69, 138, 66, 40, 74, 20, 1, 0, 0, 16, 69, 138, 66, 16, 4, 65, 0, 0, 0, 240, 65, 8, 66, 8, 66, 240, 1, 0, 128, 35, 8, 130, 32, 8, 130, 32, 56, 0, 0, 16, 4, 130, 64, 32, 8, 4, 1, 0, 128, 131, 32, 8, 130, 32, 8, 130, 56, 0, 0, 64, 40, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 3, 121, 81, 102, 1, 0, 0, 16, 4, 193, 19, 69, 81, 244, 0, 0, 0, 0, 0, 128, 19, 5, 65, 228, 0, 0, 0, 0, 65, 144, 23, 69, 81, 228, 1, 0, 0, 0, 0, 128, 19, 125, 65, 228, 0, 0, 0, 192, 72, 130, 240, 8, 130, 32, 0, 0, 0, 0, 0, 128, 19, 69, 145, 7, 69, 14, 0, 16, 4, 65, 51, 69, 81, 20, 1, 0, 0, 0, 16, 128, 65, 16, 4, 225, 0, 0, 0, 0, 32, 0, 131, 32, 8, 146, 36, 6, 0, 16, 4, 65, 82, 12, 69, 18, 1, 0, 0, 96, 16, 4, 65, 16, 4, 225, 0, 0, 0, 0, 0, 192, 82, 85, 85, 21, 1, 0, 0, 0, 0, 64, 51, 69, 81, 20, 1, 0, 0, 0, 0, 128, 19, 69, 81, 228, 0, 0, 0, 0, 0, 192, 19, 69, 209, 19, 4, 1, 0, 0, 0, 128, 23, 69, 145, 7, 65, 16, 0, 0, 0, 64, 51, 5, 65, 16, 0, 0, 0, 0, 0, 128, 19, 25, 72, 228, 0, 0, 0, 0, 8, 194, 35, 8, 130, 196, 0, 0, 0, 0, 0, 64, 20, 69, 81, 102, 1, 0, 0, 0, 0, 64, 20, 69, 138, 66, 0, 0, 0, 0, 0, 64, 20, 85, 85, 165, 0, 0, 0, 0, 0, 64, 164, 16, 132, 18, 1, 0, 0, 0, 0, 64, 20, 69, 153, 5, 69, 14, 0, 0, 0, 192, 135, 16, 66, 240, 1, 0, 0, 70, 16, 4, 49, 16, 4, 65, 96, 0, 0, 64, 16, 4, 65, 16, 4, 65, 0, 0, 192, 64, 16, 4, 129, 17, 4, 65, 12, 0, 0, 32, 85, 9, 0, 0, 0, 0, 0, 0};
struct font font_6x13 = {
.data = font_data_6x13,
.width = 6,
.height = 13,
.num_chars = 95,
.bytes_per_char = 10,
.ascii_offset = 32
};
struct font* font_get() {
return &font_6x13;
};