[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31851] trunk/blender/source/blender/ blenfont/intern/blf_font.c: bugfix [#23607] Render Stamp, incorrect apostrophe Y position.

Campbell Barton ideasman42 at gmail.com
Fri Sep 10 05:56:13 CEST 2010


Revision: 31851
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31851
Author:   campbellbarton
Date:     2010-09-10 05:56:11 +0200 (Fri, 10 Sep 2010)

Log Message:
-----------
bugfix [#23607] Render Stamp, incorrect apostrophe Y position.

Modified Paths:
--------------
    trunk/blender/source/blender/blenfont/intern/blf_font.c

Modified: trunk/blender/source/blender/blenfont/intern/blf_font.c
===================================================================
--- trunk/blender/source/blender/blenfont/intern/blf_font.c	2010-09-10 02:46:29 UTC (rev 31850)
+++ trunk/blender/source/blender/blenfont/intern/blf_font.c	2010-09-10 03:56:11 UTC (rev 31851)
@@ -155,7 +155,7 @@
 	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 @@
 	
 	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 @@
 	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 @@
 		if (!g)
 			continue;
 
+		pen_y= (int)font->pos[1];
+
 		if (has_kerning && g_prev) {
 			delta.x= 0;
 			delta.y= 0;
@@ -201,23 +203,15 @@
 
 		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 */





More information about the Bf-blender-cvs mailing list