diff -r e8d1f9ceddb6 source/gui/CGUI.cpp
a
|
b
|
|
810 | 810 | // if all characters processed, will actually be involved |
811 | 811 | // in that line. |
812 | 812 | float line_height=0.f; |
| 813 | float line_width=0.f; |
813 | 814 | for (int j=temp_from; j<=i; ++j) |
814 | 815 | { |
815 | 816 | // We don't want to use Feedback now, so we'll have to use |
… |
… |
|
832 | 833 | // Let line_height be the maximum m_Height we encounter. |
833 | 834 | line_height = std::max(line_height, Feedback2.m_Size.cy); |
834 | 835 | |
| 836 | line_width += Feedback2.m_Size.cx; |
| 837 | |
835 | 838 | if (WordWrapping && Feedback2.m_NewLine) |
836 | 839 | break; |
837 | 840 | } |
838 | 841 | |
| 842 | float dx = ((width_range[To] - width_range[From]) - line_width) / 2; |
839 | 843 | // Reset x once more |
840 | 844 | x = width_range[From]; |
841 | 845 | // Move down, because font drawing starts from the baseline |
… |
… |
|
862 | 866 | std::vector<SGUIText::STextCall>::iterator it; |
863 | 867 | for (it = Feedback2.m_TextCalls.begin(); it != Feedback2.m_TextCalls.end(); ++it) |
864 | 868 | { |
865 | | it->m_Pos = CPos(x + x_pointer, y); |
| 869 | it->m_Pos = CPos(dx + x + x_pointer, y); |
866 | 870 | |
867 | 871 | x_pointer += it->m_Size.cx; |
868 | 872 | |
diff -r e8d1f9ceddb6 source/gui/IGUITextOwner.cpp
a
|
b
|
|
106 | 106 | GUI<EAlign>::GetSetting(this, "text_align", align); |
107 | 107 | GUI<EVAlign>::GetSetting(this, "text_valign", valign); |
108 | 108 | |
109 | | switch (align) |
110 | | { |
111 | | case EAlign_Left: |
112 | | TextPos.x = ObjSize.left; |
113 | | break; |
114 | | case EAlign_Center: |
115 | | // Round to integer pixel values, else the fonts look awful |
116 | | TextPos.x = floorf(ObjSize.CenterPoint().x - Text.m_Size.cx/2.f); |
117 | | break; |
118 | | case EAlign_Right: |
119 | | TextPos.x = ObjSize.right - Text.m_Size.cx; |
120 | | break; |
121 | | default: |
122 | | debug_warn(L"Broken EAlign in CButton::SetupText()"); |
123 | | break; |
124 | | } |
| 109 | TextPos.x = ObjSize.left; |
125 | 110 | |
126 | 111 | switch (valign) |
127 | 112 | { |