Fix T66614: Text objects: Truncate overflow for non-top aligned text

This commit is contained in:
Dalai Felinto 2020-09-21 17:49:15 +10:00 committed by Campbell Barton
parent 701c3e499f
commit 213445e389
Notes: blender-bot 2023-02-14 06:17:14 +01:00
Referenced by issue #66614, Text objects: 'Truncate' overflow handling of text frames is broken when using non-top alignement.
1 changed files with 8 additions and 0 deletions

View File

@ -1188,6 +1188,14 @@ static bool vfont_to_curve(Object *ob,
ct_last = chartransdata + (is_last_filled_textbox ? slen : i_textbox_next - 1);
lines = ct_last->linenr - ct_first->linenr + 1;
if (cu->overflow == CU_OVERFLOW_TRUNCATE) {
/* Ensure overflow doesn't truncate text, before centering vertically
* giving odd/buggy results, see: T66614. */
if ((tb_index == cu->totbox - 1) && (last_line != -1)) {
lines = last_line - ct_first->linenr;
}
}
textbox_scale(&tb_scale, &cu->tb[tb_index], 1.0f / font_size);
/* The initial Y origin of the textbox is hardcoded to 1.0f * text scale. */
const float textbox_y_origin = 1.0f;