From 5bf97d7786424a06f912bf90822fd7ec4ebda6ba Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 10 Sep 2010 03:56:11 +0000 Subject: bugfix [#23607] Render Stamp, incorrect apostrophe Y position. --- source/blender/blenfont/intern/blf_font.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) (limited to 'source/blender/blenfont') diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index a932682b027..f5de632db47 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -155,7 +155,7 @@ void blf_font_buffer(FontBLF *font, char *str) FT_Vector delta; FT_UInt glyph_index; float a, *fbuf; - int pen_x, pen_y, y, x, yb, diff; + int pen_x, y, x, yb, diff; int i, has_kerning, st, chx, chy; if (!font->glyph_cache || (!font->b_fbuf && !font->b_cbuf)) @@ -163,7 +163,6 @@ void blf_font_buffer(FontBLF *font, char *str) i= 0; pen_x= (int)font->pos[0]; - pen_y= (int)font->pos[1]; has_kerning= FT_HAS_KERNING(font->face); g_prev= NULL; @@ -172,6 +171,7 @@ void blf_font_buffer(FontBLF *font, char *str) b_col_char[2]= font->b_col[2] * 255; while (str[i]) { + int pen_y; c= blf_utf8_next((unsigned char *)str, &i); if (c == 0) break; @@ -186,6 +186,8 @@ void blf_font_buffer(FontBLF *font, char *str) if (!g) continue; + pen_y= (int)font->pos[1]; + if (has_kerning && g_prev) { delta.x= 0; delta.y= 0; @@ -201,23 +203,15 @@ void blf_font_buffer(FontBLF *font, char *str) chx= pen_x + ((int)g->pos_x); diff= g->height - ((int)g->pos_y); - if (diff > 0) { - if (g->pitch < 0) - pen_y += diff; - else - pen_y -= diff; - } - else if (diff < 0) { - if (g->pitch < 0) - pen_y -= diff; - else - pen_y += diff; - } - if (g->pitch < 0) + if (g->pitch < 0) { + pen_y += diff; chy= pen_y - ((int)g->pos_y); - else + } + else { + pen_y -= diff; chy= pen_y + ((int)g->pos_y); + } if ((chx + g->width) >= 0 && chx < font->bw && (pen_y + g->height) >= 0 && pen_y < font->bh) { /* dont draw beyond the buffer bounds */ -- cgit v1.2.3