From e24e5c478cd1e8182cca78d7d15698a9452bfa9c Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 18 Dec 2008 20:00:20 +0000 Subject: [PATCH] fix A_left width calculation --- panda/src/text/textAssembler.cxx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/panda/src/text/textAssembler.cxx b/panda/src/text/textAssembler.cxx index 65d2ce3289..85282d1c8e 100644 --- a/panda/src/text/textAssembler.cxx +++ b/panda/src/text/textAssembler.cxx @@ -1208,14 +1208,13 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { _lr[1] = ypos - 0.2f * line_height; // 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 - // if the wordwrap size is unspecified the alignement could eventually result wrong. + //[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 alignment could eventually result wrong. float xpos; switch (align) { case TextProperties::A_left: - case TextProperties::A_boxed_left: xpos = 0.0f; - _lr[0] = max(_lr[0], max(row_width, wordwrap)); + _lr[0] = max(_lr[0], row_width); break; case TextProperties::A_right: @@ -1229,6 +1228,11 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { _lr[0] = max(_lr[0], -xpos); break; + case TextProperties::A_boxed_left: + xpos = 0.0f; + _lr[0] = max(_lr[0], max(row_width, wordwrap)); + break; + case TextProperties::A_boxed_right: xpos = wordwrap - row_width; _ul[0] = min(_ul[0], xpos);