VFont: Corrections to Cursor When on Curve #107307

Merged
Harley Acheson merged 2 commits from Harley/blender:CurveCursor into main 2023-04-27 22:07:08 +02:00
1 changed files with 6 additions and 6 deletions
Showing only changes of commit 52d4738c9b - Show all commits

View File

@ -1539,8 +1539,8 @@ static bool vfont_to_curve(Object *ob,
ct = &chartransdata[ef->pos];
const float cursor_width = 0.04f;
Harley marked this conversation as resolved Outdated

These can be made const.

These can be made `const`.
const float cursor_half = 0.02f;
const float xof = ct->xof;
const float yof = ct->yof;
const float xoffset = ct->xof;
const float yoffset = ct->yof;
/* By default the cursor is exactly between the characters
Harley marked this conversation as resolved Outdated

Use term cursor instead of caret.

There should be an explanation why the nudge is needed, it also seems only to apply to the X axis, so cursor_offset_x with a description for why the small amount of X offset is needed (what does it solve?).

Use term `cursor` instead of `caret`. There should be an explanation why the nudge is needed, it also seems only to apply to the X axis, so `cursor_offset_x` with a description for why the small amount of X offset is needed (what does it solve?).
* and matches the rotation of the character to the right. */
@ -1581,13 +1581,13 @@ static bool vfont_to_curve(Object *ob,
ef->textcurs[2][0] = cursor_left + cursor_width;
ef->textcurs[2][1] = 1.0f;
for (int i = 0; i < 4; i++) {
for (int vert = 0; vert < 4; vert++) {
float temp_fl[2];
/* Rotate around the cursor's bottom-left corner. */
rotate_v2_v2fl(temp_fl, &ef->textcurs[i][0], -rotation);
ef->textcurs[i][0] = font_size * (xof + temp_fl[0]);
rotate_v2_v2fl(temp_fl, &ef->textcurs[vert][0], -rotation);
ef->textcurs[vert][0] = font_size * (xoffset + temp_fl[0]);
/* Shift down vertically so we are 25% below and 75% above baseline. */
ef->textcurs[i][1] = font_size * (yof + temp_fl[1] - 0.25f);
ef->textcurs[vert][1] = font_size * (yoffset + temp_fl[1] - 0.25f);
}
}