Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/font.c
| Show First 20 Lines • Show All 1,274 Lines • ▼ Show 20 Lines | if (cu->textoncurve->runtime.curve_cache != NULL && | ||||
| if (maxy < ct->yof) { | if (maxy < ct->yof) { | ||||
| maxy = ct->yof; | maxy = ct->yof; | ||||
| } | } | ||||
| } | } | ||||
| /* we put the x-coordinaat exact at the curve, the y is rotated */ | /* we put the x-coordinaat exact at the curve, the y is rotated */ | ||||
| /* length correction */ | /* length correction */ | ||||
| distfac = sizefac * cu->textoncurve->runtime.curve_cache->path->totdist / (maxx - minx); | float dxof = maxx - minx; | ||||
| /* Can become 0 for an empty string, avoid division by zero later. */ | |||||
| CLAMP_MIN(dxof, FLT_EPSILON); | |||||
| distfac = sizefac * cu->textoncurve->runtime.curve_cache->path->totdist / dxof; | |||||
| timeofs = 0.0f; | timeofs = 0.0f; | ||||
| if (distfac > 1.0f) { | if (distfac > 1.0f) { | ||||
| /* path longer than text: spacemode involves */ | /* path longer than text: spacemode involves */ | ||||
| distfac = 1.0f / distfac; | distfac = 1.0f / distfac; | ||||
| if (cu->spacemode == CU_ALIGN_X_RIGHT) { | if (cu->spacemode == CU_ALIGN_X_RIGHT) { | ||||
| timeofs = 1.0f - distfac; | timeofs = 1.0f - distfac; | ||||
| } | } | ||||
| else if (cu->spacemode == CU_ALIGN_X_MIDDLE) { | else if (cu->spacemode == CU_ALIGN_X_MIDDLE) { | ||||
| timeofs = (1.0f - distfac) / 2.0f; | timeofs = (1.0f - distfac) / 2.0f; | ||||
| } | } | ||||
| else if (cu->spacemode == CU_ALIGN_X_FLUSH) { | else if (cu->spacemode == CU_ALIGN_X_FLUSH) { | ||||
| distfac = 1.0f; | distfac = 1.0f; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| distfac = 1.0; | distfac = 1.0f; | ||||
| } | } | ||||
| distfac /= (maxx - minx); | distfac /= dxof; | ||||
| timeofs += distfac * cu->xof; /* not cyclic */ | timeofs += distfac * cu->xof; /* not cyclic */ | ||||
| ct = chartransdata; | ct = chartransdata; | ||||
| for (i = 0; i <= slen; i++, ct++) { | for (i = 0; i <= slen; i++, ct++) { | ||||
| float ctime, dtime, vec[4], tvec[4], rotvec[3]; | float ctime, dtime, vec[4], tvec[4], rotvec[3]; | ||||
| float si, co; | float si, co; | ||||
| ▲ Show 20 Lines • Show All 448 Lines • Show Last 20 Lines | |||||