Пример #1
0
        public static FontFile Load(String filename)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(FontFile));
            TextReader    textReader   = new StreamReader(filename);
            FontFile      file         = (FontFile)deserializer.Deserialize(textReader);

            textReader.Close();
            return(file);
        }
Пример #2
0
        public FontRenderer(FontFile fontFile, Texture2D fontTexture, SpriteBatch spriteBatch)
        {
            _fontFile     = fontFile;
            _texture      = fontTexture;
            _spriteBatch  = spriteBatch;
            _characterMap = new Dictionary <char, FontChar>();

            foreach (var fontCharacter in _fontFile.Chars)
            {
                char c = (char)fontCharacter.ID;
                _characterMap.Add(c, fontCharacter);
            }
        }