From 5f32d56b85f0bfe4d22c7d9c97dc66ddfe1192de Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Sat, 25 Jun 2011 22:26:56 +0000 Subject: [PATCH] - added some common characters to be preloaded when fonts are loaded for better speed --- source/shared_lib/sources/graphics/gl/font_textFTGL.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp index c7fc63a47..7f2ef9b17 100644 --- a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp +++ b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp @@ -157,6 +157,11 @@ void TextFTGL::init(string fontName, int fontSize) { if(ftFont->Error()) { throw runtime_error("FTGL: error setting encoding"); } + + // Create a string containing common characters + // and preload the chars without rendering them. + string preloadText = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890-=!@#$%^&*()_+:\"{}[]/?.,<>\\';"; + ftFont->Advance(preloadText.c_str()); } void TextFTGL::SetFaceSize(int value) {