diff --git a/cocos2d/label_nodes/CCLabel.cs b/cocos2d/label_nodes/CCLabel.cs index d91f77e7..470090f1 100644 --- a/cocos2d/label_nodes/CCLabel.cs +++ b/cocos2d/label_nodes/CCLabel.cs @@ -31,6 +31,8 @@ private struct KerningInfo } public static CCTexture2D m_pTexture; + private static CCSize m_pAtlasTextureSize = new CCSize(0, 0); + protected static bool m_bTextureDirty = true; protected string m_FontName; @@ -93,6 +95,14 @@ public override string Text } } + public static void SetTTFAtlasTextureSize(float width, float height) + { + if (width > 0 && height > 0) + { + m_pAtlasTextureSize = new CCSize(width, height); + } + } + public static void InitializeTTFAtlas(int width, int height) { m_nWidth = width; @@ -177,7 +187,11 @@ private CCBMFontConfiguration InitializeFont(string fontName, float fontSize, st if (m_pData == null || s_pConfigurations.Count == 0) { - if (fontSize >= 105) + if (m_pAtlasTextureSize.Width > 0 && m_pAtlasTextureSize.Height > 0) + { + InitializeTTFAtlas((int)m_pAtlasTextureSize.Width, (int)m_pAtlasTextureSize.Height); + } + else if (fontSize >= 105) { InitializeTTFAtlas(2048, 2048); }