From fa909b1f68b54f21fa0e271f1b3e7e3f43ebfc37 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 29 May 2003 00:12:18 +0000 Subject: [PATCH] fix a seg, fix the loop for rendering a string --- glft/font.c | 2 +- glft/render.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/glft/font.c b/glft/font.c index db748ba2..3c1b33af 100644 --- a/glft/font.c +++ b/glft/font.c @@ -255,7 +255,7 @@ struct GlftGlyph *GlftFontGlyph(struct GlftFont *font, const char *c) } g->height = -(font->face->glyph->metrics.height >> 6); - g_hash_table_insert(font->glyph_map, &g->w, &g); + g_hash_table_insert(font->glyph_map, &g->w, g); } return g; diff --git a/glft/render.c b/glft/render.c index 2da342c5..5bb2711e 100644 --- a/glft/render.c +++ b/glft/render.c @@ -93,7 +93,7 @@ void GlftRenderString(struct GlftFont *font, const char *str, int bytes, glPushMatrix(); c = str; - while (c) { + while (c - str < bytes) { g = GlftFontGlyph(font, c); if (g) { glCallList(g->dlist); @@ -101,7 +101,6 @@ void GlftRenderString(struct GlftFont *font, const char *str, int bytes, } else glTranslatef(font->max_advance_width, 0.0, 0.0); c = g_utf8_next_char(c); - if (c - str >= bytes) break; } glPopMatrix(); -- 2.34.1