1 /*
2  * Copyright (c) 2008-2010 Travis Geiselbrecht
3  *
4  * Use of this source code is governed by a MIT-style
5  * license that can be found in the LICENSE file or at
6  * https://opensource.org/licenses/MIT
7  */
8 
9 /**
10  * @file
11  * @brief  Font display
12  *
13  * This file contains functions to render fonts onto the graphics drawing
14  * surface.
15  *
16  * @ingroup graphics
17  */
18 
19 #include <lk/debug.h>
20 #include <lib/gfx.h>
21 #include <lib/font.h>
22 
23 #include "font.h"
24 
25 /**
26  * @brief Draw one character from the built-in font
27  *
28  * @ingroup graphics
29  */
font_draw_char(gfx_surface * surface,unsigned char c,int x,int y,uint32_t color)30 void font_draw_char(gfx_surface *surface, unsigned char c, int x, int y, uint32_t color) {
31     uint i,j;
32     uint line;
33 
34     // draw this char into a buffer
35     for (i = 0; i < FONT_Y; i++) {
36         line = FONT[c * FONT_Y + i];
37         for (j = 0; j < FONT_X; j++) {
38             if (line & 0x1)
39                 gfx_putpixel(surface, x + j, y + i, color);
40             line = line >> 1;
41         }
42     }
43     gfx_flush_rows(surface, y, y + FONT_Y);
44 }
45 
46 
47