Browse Source

fix A_left width calculation

David Rose 17 years ago
parent
commit
e24e5c478c
1 changed files with 8 additions and 4 deletions
  1. 8 4
      panda/src/text/textAssembler.cxx

+ 8 - 4
panda/src/text/textAssembler.cxx

@@ -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
-    // 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;
     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);