This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via a111300cad036b48205c7be7dd5430e6fb853bf0 (commit) from 7a68442b6e9b1172544f0e709ce50a2be6e376f7 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/a111300cad036b48205c7be7dd5430e6fb853...
commit a111300cad036b48205c7be7dd5430e6fb853bf0 Author: Cyril Hrubis metan@ucw.cz Date: Wed Feb 13 01:01:09 2013 +0100
text: Add Tiny Mono font.
diff --git a/demos/c_simple/fileview.c b/demos/c_simple/fileview.c index f1f3169..175e4c2 100644 --- a/demos/c_simple/fileview.c +++ b/demos/c_simple/fileview.c @@ -27,7 +27,7 @@ #include <stdlib.h> #include <string.h>
-#include "GP.h" +#include <GP.h>
static GP_Context *win; static GP_Backend *backend; @@ -38,6 +38,9 @@ static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel, static int font_flag = 0; static int tracking = 0;
+static int mul = 1; +static int space = 0; + static GP_FontFace *font;
struct FileLine { @@ -63,14 +66,17 @@ void redraw_screen(void) style.font = &GP_DefaultProportionalFont; break; case 2: + style.font = GP_FontTinyMono; + break; + case 3: style.font = font; break; }
- style.pixel_xmul = 1; - style.pixel_ymul = 1; - style.pixel_xspace = 0; - style.pixel_yspace = 0; + style.pixel_xmul = mul; + style.pixel_ymul = mul; + style.pixel_xspace = space; + style.pixel_yspace = space; style.char_xspace = tracking;
/* Text alignment (we are always drawing to the right @@ -122,9 +128,9 @@ void event_loop(void) switch (ev.val.key.key) { case GP_KEY_SPACE: if (font) - font_flag = (font_flag + 1) % 3; + font_flag = (font_flag + 1) % 4; else - font_flag = (font_flag + 1) % 2; + font_flag = (font_flag + 1) % 3; redraw_screen(); GP_BackendFlip(backend); @@ -145,6 +151,27 @@ void event_loop(void) case GP_KEY_DOWN: warp_down(1); break; + case GP_KEY_DOT: + space++; + redraw_screen(); + GP_BackendFlip(backend); + break; + case GP_KEY_COMMA: + space--; + redraw_screen(); + GP_BackendFlip(backend); + break; + case GP_KEY_RIGHT_BRACE: + mul++; + redraw_screen(); + GP_BackendFlip(backend); + break; + case GP_KEY_LEFT_BRACE: + if (mul > 0) + mul--; + redraw_screen(); + GP_BackendFlip(backend); + break; case GP_KEY_PAGE_UP: warp_up(30); break; diff --git a/demos/c_simple/fonttest.c b/demos/c_simple/fonttest.c index 4c41423..1cd3349 100644 --- a/demos/c_simple/fonttest.c +++ b/demos/c_simple/fonttest.c @@ -113,6 +113,9 @@ void redraw_screen(void) style.font = &GP_DefaultConsoleFont; break; case 2: + style.font = GP_FontTinyMono; + break; + case 3: style.font = font; break; } @@ -163,9 +166,18 @@ void redraw_screen(void)
style.pixel_xmul = 4; style.pixel_ymul = 2; + style.pixel_xspace = 1; style.pixel_yspace = 1; - + + if (font_flag == 2) { + style.pixel_xmul = 2; + style.pixel_ymul = 5; + + style.pixel_xspace = 2; + style.pixel_yspace = 2; + } + GP_Text(win->context, &style, 64, SPACING*i + 88, align, dark_gray_pixel, black_pixel, test_string); } @@ -184,9 +196,9 @@ void event_loop(void) switch (ev.val.key.key) { case GP_KEY_SPACE: if (font) - font_flag = (font_flag + 1) % 3; + font_flag = (font_flag + 1) % 4; else - font_flag = (font_flag + 1) % 2; + font_flag = (font_flag + 1) % 3; redraw_screen(); GP_BackendFlip(win); diff --git a/include/text/GP_Fonts.h b/include/text/GP_Fonts.h new file mode 100644 index 0000000..40ac8c6 --- /dev/null +++ b/include/text/GP_Fonts.h @@ -0,0 +1,37 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#ifndef TEXT_GP_FONTS_H +#define TEXT_GP_FONTS_H + +#include "GP_Font.h" + +/* + * Monospace 7x6 font + * + * Ascend: 5 + * Descent: 2 + * Width: 5 + 1 + */ +extern const GP_FontFace *GP_FontTinyMono; + +#endif /* TEXT_GP_FONTS_H */ diff --git a/include/text/GP_Text.h b/include/text/GP_Text.h index 3111e73..6ee567f 100644 --- a/include/text/GP_Text.h +++ b/include/text/GP_Text.h @@ -19,7 +19,7 @@ * Copyright (C) 2009-2011 Jiri "BlueBear" Dluhos * * jiri.bluebear.dluhos@gmail.com * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -28,9 +28,10 @@
#include "core/GP_Context.h"
-#include "GP_TextStyle.h" -#include "GP_TextMetric.h" -#include "GP_DefaultFont.h" +#include "text/GP_TextStyle.h" +#include "text/GP_TextMetric.h" +#include "text/GP_DefaultFont.h" +#include "text/GP_Fonts.h"
/* How the rendered text should be aligned. * For GP_Text(), the alignment is relative to the specified point: diff --git a/libs/text/GP_FontTinyMono.c b/libs/text/GP_FontTinyMono.c new file mode 100644 index 0000000..cd02341 --- /dev/null +++ b/libs/text/GP_FontTinyMono.c @@ -0,0 +1,231 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +#include "GP_Font.h" + +static int8_t tiny_mono_glyphs[] = { + /* ' ' */ 5, 5, 0, 5, 6, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '!' */ 5, 5, 0, 5, 6, + 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x00, + /* '"' */ 5, 5, 0, 5, 6, + 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '#' */ 5, 5, 0, 5, 6, + 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x00, 0x00, + /* '$' */ 5, 5, 0, 5, 6, + 0x10, 0x7c, 0x92, 0x90, 0x7c, 0x00, 0x00, + /* '%' */ 5, 5, 0, 5, 6, + 0xd0, 0x90, 0x20, 0x48, 0x58, 0x00, 0x00, + /* '&' */ 5, 5, 0, 5, 6, + 0x60, 0x90, 0x40, 0xa0, 0xd0, 0x00, 0x00, + /* ''' */ 5, 5, 0, 5, 6, + 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '(' */ 5, 5, 0, 5, 6, + 0x20, 0x40, 0x40, 0x40, 0x20, 0x00, 0x00, + /* ')' */ 5, 5, 0, 5, 6, + 0x20, 0x10, 0x10, 0x10, 0x20, 0x00, 0x00, + /* '*' */ 5, 5, 0, 5, 6, + 0x00, 0x50, 0x20, 0x50, 0x00, 0x00, 0x00, + /* '+' */ 5, 5, 0, 5, 6, + 0x00, 0x20, 0x70, 0x20, 0x00, 0x00, 0x00, + /* ',' */ 5, 6, 0, 5, 6, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x00, + /* '-' */ 5, 5, 0, 5, 6, + 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, + /* '.' */ 5, 5, 0, 5, 6, + 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, + /* '/' */ 5, 5, 0, 5, 6, + 0x10, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, + /* '0' */ 5, 5, 0, 5, 6, + 0x60, 0xb0, 0x90, 0xd0, 0x60, 0x00, 0x00, + /* '1' */ 5, 5, 0, 5, 6, + 0x60, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, + /* '2' */ 5, 5, 0, 5, 6, + 0xe0, 0x10, 0x60, 0x80, 0xf0, 0x00, 0x00, + /* '3' */ 5, 5, 0, 5, 6, + 0xe0, 0x10, 0x60, 0x10, 0xe0, 0x00, 0x00, + /* '4' */ 5, 5, 0, 5, 6, + 0x20, 0x60, 0xa0, 0xf0, 0x20, 0x00, 0x00, + /* '5' */ 5, 5, 0, 5, 6, + 0xf0, 0x80, 0xe0, 0x10, 0xe0, 0x00, 0x00, + /* '6' */ 5, 5, 0, 5, 6, + 0x60, 0x80, 0xe0, 0x90, 0x60, 0x00, 0x00, + /* '7' */ 5, 5, 0, 5, 6, + 0xf0, 0x10, 0x20, 0x40, 0x40, 0x00, 0x00, + /* '8' */ 5, 5, 0, 5, 6, + 0x60, 0x90, 0x60, 0x90, 0x60, 0x00, 0x00, + /* '9' */ 5, 5, 0, 5, 6, + 0x60, 0x90, 0x70, 0x10, 0x60, 0x00, 0x00, + /* ':' */ 5, 5, 0, 5, 6, + 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, + /* ';' */ 5, 5, 0, 5, 6, + 0x00, 0x20, 0x00, 0x20, 0x20, 0x00, 0x00, + /* '<' */ 5, 5, 0, 5, 6, + 0x10, 0x20, 0x40, 0x20, 0x10, 0x00, 0x00, + /* '=' */ 5, 5, 0, 5, 6, + 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, + /* '>' */ 5, 5, 0, 5, 6, + 0x40, 0x20, 0x10, 0x20, 0x40, 0x00, 0x00, + /* '?' */ 5, 5, 0, 5, 6, + 0x60, 0x10, 0x20, 0x00, 0x20, 0x00, 0x00, + /* '@' */ 5, 5, 0, 5, 6, + 0x70, 0x88, 0xb0, 0x80, 0x70, 0x00, 0x00, + /* 'A' */ 5, 5, 0, 5, 6, + 0x60, 0x90, 0xf0, 0x90, 0x90, 0x00, 0x00, + /* 'B' */ 5, 5, 0, 5, 6, + 0xe0, 0x90, 0xe0, 0x90, 0xe0, 0x00, 0x00, + /* 'C' */ 5, 5, 0, 5, 6, + 0x70, 0x80, 0x80, 0x80, 0x70, 0x00, 0x00, + /* 'D' */ 5, 5, 0, 5, 6, + 0xe0, 0x90, 0x90, 0x90, 0xe0, 0x00, 0x00, + /* 'E' */ 5, 5, 0, 5, 6, + 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x00, 0x00, + /* 'F' */ 5, 5, 0, 5, 6, + 0xf0, 0x80, 0xe0, 0x80, 0x80, 0x00, 0x00, + /* 'G' */ 5, 5, 0, 5, 6, + 0x70, 0x80, 0x98, 0x88, 0x70, 0x00, 0x00, + /* 'H' */ 5, 5, 0, 5, 6, + 0x90, 0x90, 0xf0, 0x90, 0x90, 0x00, 0x00, + /* 'I' */ 5, 5, 0, 5, 6, + 0x70, 0x20, 0x20, 0x20, 0x70, 0x00, 0x00, + /* 'J' */ 5, 5, 0, 5, 6, + 0xf0, 0x10, 0x10, 0x90, 0x60, 0x00, 0x00, + /* 'K' */ 5, 5, 0, 5, 6, + 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x00, 0x00, + /* 'L' */ 5, 5, 0, 5, 6, + 0x80, 0x80, 0x80, 0x80, 0xf0, 0x00, 0x00, + /* 'M' */ 5, 5, 0, 5, 6, + 0x88, 0xd8, 0xa8, 0x88, 0x88, 0x00, 0x00, + /* 'N' */ 5, 5, 0, 5, 6, + 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x00, 0x00, + /* 'O' */ 5, 5, 0, 5, 6, + 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, + /* 'P' */ 5, 5, 0, 5, 6, + 0xe0, 0x90, 0xe0, 0x80, 0x80, 0x00, 0x00, + /* 'Q' */ 5, 5, 0, 5, 6, + 0x60, 0x90, 0x90, 0xa0, 0x50, 0x00, 0x00, + /* 'R' */ 5, 5, 0, 5, 6, + 0xe0, 0x90, 0xe0, 0x90, 0x90, 0x00, 0x00, + /* 'S' */ 5, 5, 0, 5, 6, + 0x70, 0x80, 0x60, 0x10, 0xe0, 0x00, 0x00, + /* 'T' */ 5, 5, 0, 5, 6, + 0xf8, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* 'U' */ 5, 5, 0, 5, 6, + 0x90, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, + /* 'V' */ 5, 5, 0, 5, 6, + 0x88, 0x88, 0x50, 0x50, 0x20, 0x00, 0x00, + /* 'W' */ 5, 5, 0, 5, 6, + 0x88, 0x88, 0x88, 0xa8, 0x50, 0x00, 0x00, + /* 'X' */ 5, 5, 0, 5, 6, + 0x90, 0x90, 0x60, 0x90, 0x90, 0x00, 0x00, + /* 'Y' */ 5, 5, 0, 5, 6, + 0x90, 0x90, 0x70, 0x10, 0x60, 0x00, 0x00, + /* 'Z' */ 5, 5, 0, 5, 6, + 0xf0, 0x10, 0x20, 0xc0, 0xf0, 0x00, 0x00, + /* '[' */ 5, 5, 0, 5, 6, + 0x60, 0x40, 0x40, 0x40, 0x60, 0x00, 0x00, + /* '' */ 5, 5, 0, 5, 6, + 0x40, 0x40, 0x20, 0x10, 0x10, 0x00, 0x00, + /* ']' */ 5, 5, 0, 5, 6, + 0x30, 0x10, 0x10, 0x10, 0x30, 0x00, 0x00, + /* '^' */ 5, 5, 0, 5, 6, + 0x20, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, + /* '_' */ 5, 5, 0, 5, 6, + 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, + /* '`' */ 5, 5, 0, 5, 6, + 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + /* 'a' */ 5, 5, 0, 5, 6, + 0x00, 0x60, 0x90, 0x90, 0x70, 0x00, 0x00, + /* 'b' */ 5, 5, 0, 5, 6, + 0x80, 0xe0, 0x90, 0x90, 0xe0, 0x00, 0x00, + /* 'c' */ 5, 5, 0, 5, 6, + 0x00, 0x70, 0x80, 0x80, 0x70, 0x00, 0x00, + /* 'd' */ 5, 5, 0, 5, 6, + 0x10, 0x70, 0x90, 0x90, 0x70, 0x00, 0x00, + /* 'e' */ 5, 5, 0, 5, 6, + 0x00, 0x60, 0xf0, 0x80, 0x70, 0x00, 0x00, + /* 'f' */ 5, 7, 0, 5, 6, + 0x00, 0x70, 0x80, 0xc0, 0x80, 0x80, 0x80, + /* 'g' */ 5, 7, 0, 5, 6, + 0x00, 0x60, 0x90, 0x90, 0x70, 0x10, 0x60, + /* 'h' */ 5, 5, 0, 5, 6, + 0x80, 0xe0, 0x90, 0x90, 0x90, 0x00, 0x00, + /* 'i' */ 5, 5, 0, 5, 6, + 0x20, 0x00, 0x20, 0x20, 0x70, 0x00, 0x00, + /* 'j' */ 5, 5, 0, 5, 6, + 0x00, 0x10, 0x10, 0x90, 0x60, 0x00, 0x00, + /* 'k' */ 5, 5, 0, 5, 6, + 0x80, 0xb0, 0xc0, 0xa0, 0x90, 0x00, 0x00, + /* 'l' */ 5, 5, 0, 5, 6, + 0x40, 0x40, 0x40, 0x40, 0x38, 0x00, 0x00, + /* 'm' */ 5, 5, 0, 5, 6, + 0x00, 0xd0, 0xa8, 0xa8, 0xa8, 0x00, 0x00, + /* 'n' */ 5, 5, 0, 5, 6, + 0x00, 0xe0, 0x90, 0x90, 0x90, 0x00, 0x00, + /* 'o' */ 5, 5, 0, 5, 6, + 0x00, 0x60, 0x90, 0x90, 0x60, 0x00, 0x00, + /* 'p' */ 5, 7, 0, 5, 6, + 0x00, 0xe0, 0x90, 0x90, 0xe0, 0x80, 0x80, + /* 'q' */ 5, 7, 0, 5, 6, + 0x00, 0x70, 0x90, 0x90, 0x70, 0x10, 0x10, + /* 'r' */ 5, 5, 0, 5, 6, + 0x00, 0x70, 0x80, 0x80, 0x80, 0x00, 0x00, + /* 's' */ 5, 5, 0, 5, 6, + 0x00, 0x70, 0xc0, 0x30, 0xe0, 0x00, 0x00, + /* 't' */ 5, 5, 0, 5, 6, + 0x40, 0xf0, 0x40, 0x40, 0x30, 0x00, 0x00, + /* 'u' */ 5, 5, 0, 5, 6, + 0x00, 0x90, 0x90, 0x90, 0x70, 0x00, 0x00, + /* 'v' */ 5, 5, 0, 5, 6, + 0x00, 0x90, 0x90, 0x90, 0x60, 0x00, 0x00, + /* 'w' */ 5, 5, 0, 5, 6, + 0x00, 0x88, 0xa8, 0xa8, 0x50, 0x00, 0x00, + /* 'x' */ 5, 5, 0, 5, 6, + 0x00, 0x90, 0x60, 0x60, 0x90, 0x00, 0x00, + /* 'y' */ 5, 7, 0, 5, 6, + 0x00, 0x90, 0x90, 0x90, 0x70, 0x10, 0x60, + /* 'z' */ 5, 5, 0, 5, 6, + 0x00, 0xf0, 0x20, 0x40, 0xf0, 0x00, 0x00, + /* '{' */ 5, 5, 0, 5, 6, + 0x30, 0x40, 0x20, 0x40, 0x30, 0x00, 0x00, + /* '|' */ 5, 5, 0, 5, 6, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, + /* '}' */ 5, 5, 0, 5, 6, + 0x60, 0x10, 0x20, 0x10, 0x60, 0x00, 0x00, + /* '~' */ 5, 5, 0, 5, 6, + 0x00, 0x50, 0xa0, 0x00, 0x00, 0x00, 0x00, +}; + +static struct GP_FontFace tiny_mono = { + .family_name = "Tiny", + .style_name = "Mono", + .charset = GP_CHARSET_7BIT, + .ascend = 5, + .descend = 3, + .max_glyph_width = 5, + .max_glyph_advance = 6, + .glyph_bitmap_format = GP_FONT_BITMAP_1BPP, + .glyphs = tiny_mono_glyphs, + .glyph_offsets = {12}, +}; + +struct GP_FontFace *GP_FontTinyMono = &tiny_mono;
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/fileview.c | 41 +++- demos/c_simple/fonttest.c | 18 ++- .../bogoman_loader.h => include/text/GP_Fonts.h | 17 +- include/text/GP_Text.h | 9 +- libs/text/GP_FontTinyMono.c | 231 ++++++++++++++++++++ 5 files changed, 297 insertions(+), 19 deletions(-) copy demos/bogoman/bogoman_loader.h => include/text/GP_Fonts.h (88%) create mode 100644 libs/text/GP_FontTinyMono.c
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.