[Bf-blender-cvs] [e5b8d84] master: Fix T40204: x-offset textbox failed with center/justify/flush

Campbell Barton noreply at git.blender.org
Thu May 15 09:46:31 CEST 2014


Commit: e5b8d84613f3aa808adf275ea3e0dbec2d484915
Author: Campbell Barton
Date:   Thu May 15 17:27:06 2014 +1000
https://developer.blender.org/rBe5b8d84613f3aa808adf275ea3e0dbec2d484915

Fix T40204: x-offset textbox failed with center/justify/flush

===================================================================

M	source/blender/blenkernel/intern/font.c

===================================================================

diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 35328a8..0b707b2 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -815,7 +815,7 @@ makebreak:
 			}
 		}
 		else if (cu->spacemode == CU_MIDDLE) {
-			for (i = 0; i < lnr; i++) linedata[i] = (linedata3[i] - linedata[i]) / 2;
+			for (i = 0; i < lnr; i++) linedata[i] = ((linedata3[i] - linedata[i]) + cu->xof) / 2;
 			for (i = 0; i <= slen; i++) {
 				ct->xof += linedata[ct->linenr];
 				ct++;
@@ -824,7 +824,7 @@ makebreak:
 		else if ((cu->spacemode == CU_FLUSH) && (cu->tb[0].w != 0.0f)) {
 			for (i = 0; i < lnr; i++)
 				if (linedata2[i] > 1)
-					linedata[i] = (linedata3[i] - linedata[i]) / (linedata2[i] - 1);
+					linedata[i] = ((linedata3[i] - linedata[i]) + cu->xof) / (linedata2[i] - 1);
 			for (i = 0; i <= slen; i++) {
 				for (j = i; (!ELEM3(mem[j], '\0', '\n', '\r')) && (chartransdata[j].dobreak == 0) && (j < slen); j++) {
 					/* do nothing */
@@ -849,7 +849,8 @@ makebreak:
 				if ((mem[j] != '\r') && (mem[j] != '\n') &&
 				    ((chartransdata[j].dobreak != 0)))
 				{
-					if (mem[i] == ' ') curofs += (linedata3[ct->linenr] - linedata[ct->linenr]) / linedata4[ct->linenr];
+					if (mem[i] == ' ')
+						curofs += ((linedata3[ct->linenr] - linedata[ct->linenr]) + cu->xof) / linedata4[ct->linenr];
 					ct->xof += curofs;
 				}
 				if (mem[i] == '\n' || mem[i] == '\r' || chartransdata[i].dobreak) curofs = 0;




More information about the Bf-blender-cvs mailing list