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 1bac6fdd5618b074d38c9f7d4da6e867b302ba16 (commit) via af6a9007db86d114595f630d6a6be24519a2b0df (commit) from 0c39d1adbaeb40591a13cbf965d773374fb8194b (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/1bac6fdd5618b074d38c9f7d4da6e867b302b...
commit 1bac6fdd5618b074d38c9f7d4da6e867b302ba16 Author: Cyril Hrubis metan@ucw.cz Date: Sun Jan 1 21:26:09 2012 +0100
Text: Fix some overflows.
And that should be last bug that was lurking in there, I promise.
diff --git a/include/text/GP_Font.h b/include/text/GP_Font.h index 4975ed2..0bce212 100644 --- a/include/text/GP_Font.h +++ b/include/text/GP_Font.h @@ -147,7 +147,7 @@ typedef struct GP_FontFace { * offsets for all characters in glyphs. Otherwise the * glyph_offset[0] defines step in the glyph table. */ - uint16_t glyph_offsets[]; + uint32_t glyph_offsets[]; } GP_FontFace;
/* diff --git a/libs/text/GP_Font.c b/libs/text/GP_Font.c index f153edc..633e45d 100644 --- a/libs/text/GP_Font.c +++ b/libs/text/GP_Font.c @@ -51,7 +51,7 @@ GP_GlyphBitmap *GP_GetGlyphBitmap(const GP_FontFace *font, int c) return NULL; }
- uint16_t offset; + uint32_t offset;
if (font->glyph_offsets[0] == 0) offset = font->glyph_offsets[i]; diff --git a/libs/text/GP_FreeType.c b/libs/text/GP_FreeType.c index a66999a..b454d89 100644 --- a/libs/text/GP_FreeType.c +++ b/libs/text/GP_FreeType.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, * * Boston, MA 02110-1301 USA * * * - * Copyright (C) 2009-2011 Cyril Hrubis metan@ucw.cz * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * * * *****************************************************************************/
@@ -66,7 +66,7 @@ GP_FontFace *GP_FontFaceLoad(const char *path, uint32_t width, uint32_t height) unsigned int font_face_size;
font_face_size = sizeof(GP_FontFace) + - sizeof(uint16_t) * GP_GetGlyphCount(GP_CHARSET_7BIT); + sizeof(uint32_t) * GP_GetGlyphCount(GP_CHARSET_7BIT); GP_FontFace *font = malloc(font_face_size); @@ -183,7 +183,7 @@ GP_FontFace *GP_FontFaceLoad(const char *path, uint32_t width, uint32_t height) for (y = 0; y < glyph_bitmap->height; y++) { for (x = 0; x < glyph_bitmap->width; x++) { - uint8_t addr = glyph_bitmap->width * y + x; + unsigned int addr = glyph_bitmap->width * y + x;
glyph_bitmap->bitmap[addr] = glyph->bitmap.buffer[y * glyph->bitmap.pitch + x]; }
http://repo.or.cz/w/gfxprim.git/commit/af6a9007db86d114595f630d6a6be24519a2b...
commit af6a9007db86d114595f630d6a6be24519a2b0df Author: Cyril Hrubis metan@ucw.cz Date: Sun Jan 1 20:32:52 2012 +0100
Text: Fonttext can now change font size.
diff --git a/tests/SDL/fonttest.c b/tests/SDL/fonttest.c index 6bbc913..ec9f93a 100644 --- a/tests/SDL/fonttest.c +++ b/tests/SDL/fonttest.c @@ -33,6 +33,9 @@ SDL_Surface *display = NULL; GP_Context context;
+static const char *font_path = NULL; +static unsigned int font_h = 16; + static GP_Pixel white_pixel, gray_pixel, dark_gray_pixel, black_pixel, red_pixel, blue_pixel;
@@ -200,6 +203,24 @@ void event_loop(void) redraw_screen(); SDL_Flip(display); break; + case SDLK_b: + font_h++; + if (font_path) { + GP_FontFaceFree(font); + font = GP_FontFaceLoad(font_path, 0, font_h); + redraw_screen(); + SDL_Flip(display); + } + break; + case SDLK_s: + font_h--; + if (font_path) { + GP_FontFaceFree(font); + font = GP_FontFaceLoad(font_path, 0, font_h); + redraw_screen(); + SDL_Flip(display); + } + break; case SDLK_ESCAPE: return; default: @@ -219,6 +240,7 @@ void print_instructions(void) printf(" Esc ................. exitn"); printf(" Space ............... change fontn"); printf(" up/down ............. increase/decrease trackingn"); + printf(" b/s ................. change font size (freetype only)n"); }
int main(int argc, char *argv[]) @@ -228,8 +250,9 @@ int main(int argc, char *argv[]) GP_SetDebugLevel(10);
if (argc > 1) { + font_path = argv[1]; fprintf(stderr, "nLoading font '%s'n", argv[1]); - font = GP_FontFaceLoad(argv[1], 0, 16); + font = GP_FontFaceLoad(argv[1], 0, font_h); }
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) {
-----------------------------------------------------------------------
Summary of changes: include/text/GP_Font.h | 2 +- libs/text/GP_Font.c | 2 +- libs/text/GP_FreeType.c | 6 +++--- tests/SDL/fonttest.c | 25 ++++++++++++++++++++++++- 4 files changed, 29 insertions(+), 6 deletions(-)
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.