dmuratshin 9 년 전
부모
커밋
afe46a8916
4개의 변경된 파일30개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 1
      oxygine/src/TextField.cpp
  2. 22 2
      oxygine/src/text_utils/Aligner.cpp
  3. 6 1
      oxygine/src/text_utils/Aligner.h
  4. 1 1
      oxygine/src/text_utils/Node.cpp

+ 1 - 1
oxygine/src/TextField.cpp

@@ -269,7 +269,7 @@ namespace oxygine
 
 
     const Rect& TextField::getTextRect() const
     const Rect& TextField::getTextRect() const
     {
     {
-        const_cast<TextField*>(this)->getRootNode(1);
+        const_cast<TextField*>(this)->getRootNode(_rtscale);
         return _textRect;
         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)
         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
 #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
 #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);
             _line.reserve(50);
         }
         }
 
 
@@ -73,6 +90,8 @@ namespace oxygine
             _scale = _font->getScale();
             _scale = _font->getScale();
             if (st.fontSize)
             if (st.fontSize)
                 _scale = _font->getSize() / float(st.fontSize);
                 _scale = _font->getSize() / float(st.fontSize);
+
+
 #ifdef GSCALE
 #ifdef GSCALE
             _scale =  _globalScale;
             _scale =  _globalScale;
 #endif
 #endif
@@ -82,6 +101,7 @@ namespace oxygine
 
 
             bounds = Rect(_alignX(0), _alignY(0), 0, 0);
             bounds = Rect(_alignX(0), _alignY(0), 0, 0);
             nextLine();
             nextLine();
+
         }
         }
 
 
         void Aligner::end()
         void Aligner::end()

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

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

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

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