mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
fix A_left width calculation
This commit is contained in:
parent
38467b6eed
commit
e24e5c478c
@ -1208,14 +1208,13 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) {
|
|||||||
_lr[1] = ypos - 0.2f * line_height;
|
_lr[1] = ypos - 0.2f * line_height;
|
||||||
|
|
||||||
// Apply the requested horizontal alignment to the row.
|
// Apply the requested horizontal alignment to the row.
|
||||||
//[fabius] added a different concept of text alignement based upon a boxed region where his width is defined by the wordwrap size with the upper left corner starting from 0,0,0
|
//[fabius] added a different concept of text alignment based upon a boxed region where his width is defined by the wordwrap size with the upper left corner starting from 0,0,0
|
||||||
// if the wordwrap size is unspecified the alignement could eventually result wrong.
|
// if the wordwrap size is unspecified the alignment could eventually result wrong.
|
||||||
float xpos;
|
float xpos;
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case TextProperties::A_left:
|
case TextProperties::A_left:
|
||||||
case TextProperties::A_boxed_left:
|
|
||||||
xpos = 0.0f;
|
xpos = 0.0f;
|
||||||
_lr[0] = max(_lr[0], max(row_width, wordwrap));
|
_lr[0] = max(_lr[0], row_width);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TextProperties::A_right:
|
case TextProperties::A_right:
|
||||||
@ -1229,6 +1228,11 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) {
|
|||||||
_lr[0] = max(_lr[0], -xpos);
|
_lr[0] = max(_lr[0], -xpos);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TextProperties::A_boxed_left:
|
||||||
|
xpos = 0.0f;
|
||||||
|
_lr[0] = max(_lr[0], max(row_width, wordwrap));
|
||||||
|
break;
|
||||||
|
|
||||||
case TextProperties::A_boxed_right:
|
case TextProperties::A_boxed_right:
|
||||||
xpos = wordwrap - row_width;
|
xpos = wordwrap - row_width;
|
||||||
_ul[0] = min(_ul[0], xpos);
|
_ul[0] = min(_ul[0], xpos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user