Browse Source

Fix encoder build on Linux

seanpaultaylor 12 years ago
parent
commit
0c6be7a2c7
1 changed files with 29 additions and 28 deletions
  1. 29 28
      tools/encoder/src/TTFFontEncoder.cpp

+ 29 - 28
tools/encoder/src/TTFFontEncoder.cpp

@@ -107,6 +107,34 @@ unsigned char* createDistanceFields(unsigned char* img, unsigned int width, unsi
     return out;
     return out;
 }
 }
 
 
+// Stores a single genreated font size to be written into the GPB
+struct FontData
+{
+    // Array of glyphs for a font
+    TTFGlyph glyphArray[END_INDEX - START_INDEX];
+
+    // Stores final height of a row required to render all glyphs
+    int fontSize;
+
+    // Actual size of the underlying glyphs (may be different from fontSize)
+    int glyphSize;
+
+    // Font texture
+    unsigned char* imageBuffer;
+    unsigned int imageWidth;
+    unsigned int imageHeight;
+
+    FontData() : fontSize(0), glyphSize(0), imageBuffer(NULL), imageWidth(0), imageHeight(0)
+    {
+    }
+
+    ~FontData()
+    {
+        if (imageBuffer)
+            free(imageBuffer);
+    }
+};
+ 
 int writeFont(const char* inFilePath, const char* outFilePath, std::vector<unsigned int>& fontSizes, const char* id, bool fontpreview = false, Font::FontFormat fontFormat = Font::BITMAP)
 int writeFont(const char* inFilePath, const char* outFilePath, std::vector<unsigned int>& fontSizes, const char* id, bool fontpreview = false, Font::FontFormat fontFormat = Font::BITMAP)
 {
 {
     // Initialize freetype library.
     // Initialize freetype library.
@@ -127,34 +155,7 @@ int writeFont(const char* inFilePath, const char* outFilePath, std::vector<unsig
         return -1;
         return -1;
     }
     }
 
 
-    // Stores a single genreated font size to be written into the GPB
-    struct FontData
-    {
-        // Array of glyphs for a font
-        TTFGlyph glyphArray[END_INDEX - START_INDEX];
-
-        // Stores final height of a row required to render all glyphs
-        int fontSize;
-
-        // Actual size of the underlying glyphs (may be different from fontSize)
-        int glyphSize;
-
-        // Font texture
-        unsigned char* imageBuffer;
-        unsigned int imageWidth;
-        unsigned int imageHeight;
-
-        FontData() : fontSize(0), glyphSize(0), imageBuffer(NULL), imageWidth(0), imageHeight(0)
-        {
-        }
-
-        ~FontData()
-        {
-            if (imageBuffer)
-                free(imageBuffer);
-        }
-    };
-    std::vector<FontData*> fonts;
+   std::vector<FontData*> fonts;
 
 
     for (size_t fontIndex = 0, count = fontSizes.size(); fontIndex < count; ++fontIndex)
     for (size_t fontIndex = 0, count = fontSizes.size(); fontIndex < count; ++fontIndex)
     {
     {