private static Dictionary<char, BitmapFontRegion> BuildCharacterMap(Texture2D[] textures, BitmapFontFile fontFile)
        {
            var characterMap = new Dictionary<char, BitmapFontRegion>();

            foreach (var fontChar in fontFile.Chars)
            {
                var pageIndex = fontChar.Page;
                var character = (char)fontChar.ID;
                var texture = textures[pageIndex];
                var region = new TextureRegion2D(texture, fontChar.X, fontChar.Y, fontChar.Width, fontChar.Height);
                var fontRegion = new BitmapFontRegion(region, fontChar);
                characterMap.Add(character, fontRegion);
            }

            return characterMap;
        }
 public BitmapFont(Texture2D[] textures, BitmapFontFile fontFile)
 {
     _fontFile = fontFile;
     _characterMap = BuildCharacterMap(textures, _fontFile);
 }
 public BitmapFont(Texture2D texture, BitmapFontFile fontFile)
 {
     _fontFile = fontFile;
     _characterMap = BuildCharacterMap(new [] { texture }, _fontFile);
 }
Exemple #4
0
 public BitmapFontProcessorResult(BitmapFontFile fontFile)
 {
     FontFile      = fontFile;
     TextureAssets = new List <string>();
 }