2 * Copyright © 2016 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
17 #include "ao_draw_int.h"
18 #include "ao_pong_text.h"
20 static const uint16_t numbers[] = {
21 #include "ao_pong_font.h"
24 #define GLYPH_WIDTH 16
25 #define GLYPH_SPACING 20
26 #define GLYPH_HEIGHT 24
27 #define GLYPH_ASCENT 24
29 const struct ao_font ao_pong_font = {
30 .width = GLYPH_SPACING,
31 .height = GLYPH_HEIGHT,
32 .ascent = GLYPH_ASCENT,
33 .descent = GLYPH_HEIGHT - GLYPH_ASCENT,
37 ao_pong_text(const struct ao_bitmap *dst,
42 static uint32_t src[GLYPH_HEIGHT];
46 struct ao_bitmap src_bitmap = {
50 .height = GLYPH_HEIGHT
55 while ((c = *string++)) {
57 ao_rect(dst, x, y, GLYPH_WIDTH, GLYPH_HEIGHT, 0, AO_COPY);
59 const uint16_t *n = &numbers[(c - '0') * GLYPH_HEIGHT];
61 for (h = 0; h < GLYPH_HEIGHT; h++)
65 x, y, GLYPH_WIDTH, GLYPH_HEIGHT,