[Bf-blender-cvs] [7ff7a9c8fdc] master: Cleanup: remove redundant Y bounds calculation for text on path

Campbell Barton noreply at git.blender.org
Thu Sep 3 05:35:07 CEST 2020


Commit: 7ff7a9c8fdc09f8baeebfcb63de144c7b8d88b3f
Author: Campbell Barton
Date:   Thu Sep 3 12:26:46 2020 +1000
Branches: master
https://developer.blender.org/rB7ff7a9c8fdc09f8baeebfcb63de144c7b8d88b3f

Cleanup: remove redundant Y bounds calculation for text on path

Also correct some comments.

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

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

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

diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index dfbb8202093..bb1bf8a98c5 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -1244,7 +1244,7 @@ static bool vfont_to_curve(Object *ob,
     if (cu->textoncurve->runtime.curve_cache != NULL &&
         cu->textoncurve->runtime.curve_cache->path != NULL) {
       float distfac, imat[4][4], imat3[3][3], cmat[3][3];
-      float minx, maxx, miny, maxy;
+      float minx, maxx;
       float timeofs, sizefac;
 
       if (ob != NULL) {
@@ -1259,32 +1259,25 @@ static bool vfont_to_curve(Object *ob,
       mul_m3_m3m3(cmat, cmat, imat3);
       sizefac = normalize_v3(cmat[0]) / font_size;
 
-      minx = miny = 1.0e20f;
-      maxx = maxy = -1.0e20f;
       ct = chartransdata;
-      for (i = 0; i <= slen; i++, ct++) {
+      minx = maxx = ct->xof;
+      for (i = 1; i <= slen; i++, ct++) {
         if (minx > ct->xof) {
           minx = ct->xof;
         }
         if (maxx < ct->xof) {
           maxx = ct->xof;
         }
-        if (miny > ct->yof) {
-          miny = ct->yof;
-        }
-        if (maxy < ct->yof) {
-          maxy = ct->yof;
-        }
       }
 
-      /* we put the x-coordinaat exact at the curve, the y is rotated */
+      /* We put the x-coordinate exact at the curve, the y is rotated. */
 
       /* length correction */
       distfac = sizefac * cu->textoncurve->runtime.curve_cache->path->totdist / (maxx - minx);
       timeofs = 0.0f;
 
       if (distfac > 1.0f) {
-        /* path longer than text: spacemode involves */
+        /* Path longer than text: space-mode is involved. */
         distfac = 1.0f / distfac;
 
         if (cu->spacemode == CU_ALIGN_X_RIGHT) {
@@ -1310,7 +1303,7 @@ static bool vfont_to_curve(Object *ob,
         float ctime, dtime, vec[4], tvec[4], rotvec[3];
         float si, co;
 
-        /* rotate around center character */
+        /* Rotate around center character. */
         info = &custrinfo[i];
         ascii = mem[i];
         if (info->flag & CU_CHINFO_SMALLCAPS_CHECK) {



More information about the Bf-blender-cvs mailing list