diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-09-03 05:26:46 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-09-03 05:28:22 +0300 |
commit | 7ff7a9c8fdc09f8baeebfcb63de144c7b8d88b3f (patch) | |
tree | 2c89f92c4da2c03744b9011b6ad4be9715ec54d4 /source/blender | |
parent | 99c3ac17f2011f8c554a98ed8f9010a7befc884c (diff) |
Cleanup: remove redundant Y bounds calculation for text on path
Also correct some comments.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/font.c | 19 |
1 files changed, 6 insertions, 13 deletions
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) { |