dmuratshin 9 years ago
parent
commit
afe46a8916

+ 1 - 1
oxygine/src/TextField.cpp

@@ -269,7 +269,7 @@ namespace oxygine
 
     const Rect& TextField::getTextRect() const
     {
-        const_cast<TextField*>(this)->getRootNode(1);
+        const_cast<TextField*>(this)->getRootNode(_rtscale);
         return _textRect;
     }
 

+ 22 - 2
oxygine/src/text_utils/Aligner.cpp

@@ -10,10 +10,27 @@ namespace oxygine
 
         Aligner::Aligner(const TextStyle& Style, float gscale): width(0), height(0), _x(0), _y(0), _lineWidth(0), bounds(0, 0, 0, 0), style(Style), _globalScale(gscale)
         {
+            _fontSize = style.fontSize;
+
 #ifdef GSCALE
-            style.fontSize = style.fontSize  * _globalScale;
+            float fs = _fontSize * _globalScale;
+            _fontSize = fs;
+            const int X = 20;
+            if (_fontSize > X)
+            {
+                int x = _fontSize % X;
+                if (x)
+                    _fontSize = _fontSize + (X - x);
+            }
+
+            _adjScale = fs / _fontSize;
+            _globalScale = (float)_fontSize / style.fontSize;
 #endif
-            _font = style.font->getFont(0, style.fontSize);
+
+
+            log::messageln("gscale %f, adjScale %f globscale %f, %d %f", gscale, _adjScale, _globalScale, _fontSize, fs);
+
+            _font = style.font->getFont(0, _fontSize);
             _line.reserve(50);
         }
 
@@ -73,6 +90,8 @@ namespace oxygine
             _scale = _font->getScale();
             if (st.fontSize)
                 _scale = _font->getSize() / float(st.fontSize);
+
+
 #ifdef GSCALE
             _scale =  _globalScale;
 #endif
@@ -82,6 +101,7 @@ namespace oxygine
 
             bounds = Rect(_alignX(0), _alignY(0), 0, 0);
             nextLine();
+
         }
 
         void Aligner::end()

+ 6 - 1
oxygine/src/text_utils/Aligner.h

@@ -46,11 +46,15 @@ namespace oxygine
             int width;
             int height;
 
+
+            const Font* _font;
+
+            float _adjScale;
+
         private:
             int getLineWidth()const;
             int getLineSkip()const;
 
-            const Font* _font;
 
             typedef std::vector<Symbol*> line;
 
@@ -64,6 +68,7 @@ namespace oxygine
             int _x, _y;
             line _line;
             int _lineWidth;
+            int _fontSize;
         };
     }
 }

+ 1 - 1
oxygine/src/text_utils/Node.cpp

@@ -167,7 +167,7 @@ namespace oxygine
             if (!_data.empty())
             {
                 int i = 0;
-                const Font* font = rd.getStyle().font->getFont(0, rd.getStyle().fontSize);
+                const Font* font = rd._font;
                 glyphOptions opt = rd.getStyle().options;
 
                 while (i != (int)_data.size())