Browse Source

max snap size

dmuratshin 9 years ago
parent
commit
d57aed4a80
2 changed files with 9 additions and 1 deletions
  1. 7 0
      src/ResFontFT.cpp
  2. 2 1
      src/ResFontFT.h

+ 7 - 0
src/ResFontFT.cpp

@@ -14,6 +14,7 @@ FT_Library  _library = 0;
 
 
 
 
 static int FT_SNAP_SIZE = 1000;
 static int FT_SNAP_SIZE = 1000;
+static int FT_MAX_SNAP_SIZE = 200;
 
 
 #ifdef _MSC_VER
 #ifdef _MSC_VER
 typedef unsigned __int8  uint8_t;
 typedef unsigned __int8  uint8_t;
@@ -253,6 +254,11 @@ namespace oxygine
         FT_SNAP_SIZE = size;
         FT_SNAP_SIZE = size;
     }
     }
 
 
+    void ResFontFT::setMaxSnapSize(int size)
+    {
+        FT_MAX_SNAP_SIZE = size;
+    }
+
     ResFontFT::ResFontFT() : _atlas(CLOSURE(this, &ResFontFT::createTexture)), _face(0)
     ResFontFT::ResFontFT() : _atlas(CLOSURE(this, &ResFontFT::createTexture)), _face(0)
     {
     {
         _atlas.init();
         _atlas.init();
@@ -314,6 +320,7 @@ namespace oxygine
         {
         {
             int x = fontSize + FT_SNAP_SIZE - 1;
             int x = fontSize + FT_SNAP_SIZE - 1;
             fontSize = x - (x % FT_SNAP_SIZE);
             fontSize = x - (x % FT_SNAP_SIZE);
+            fontSize = std::min(fontSize, FT_MAX_SNAP_SIZE);
         }
         }
 
 
         resScale = (float)fontSize / styleFontSize;
         resScale = (float)fontSize / styleFontSize;

+ 2 - 1
src/ResFontFT.h

@@ -25,6 +25,7 @@ namespace oxygine
         static void freeLibrary();
         static void freeLibrary();
         static int  getSnapSize();
         static int  getSnapSize();
         static void setSnapSize(int size);
         static void setSnapSize(int size);
+        static void setMaxSnapSize(int size);
 
 
         struct postProcessData
         struct postProcessData
         {
         {
@@ -73,4 +74,4 @@ namespace oxygine
         fonts _fonts;
         fonts _fonts;
         file::buffer _fdata;
         file::buffer _fdata;
     };
     };
-}
+}