Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new font
 /// </summary>
 /// <param name="path">Path to the font</param>
 public DrawableFont(string path)
 {
     Font = IhnLib.Font.Load(path);
     Img  = path.Substring(0, path.Length - 4);
     //Images sometimes have _1 at the end, increase the graphic size in this case
     Img += "_0.png";
     fr   = new FontRenderer(Font, Rsc.Load <Texture2D>(Img));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads font
        /// </summary>
        public static FontFile Load(string path)
        {
            var           stream       = new FileStream(path, FileMode.Open);
            XmlSerializer deserializer = new XmlSerializer(typeof(FontFile));
            FontFile      file         = (FontFile)deserializer.Deserialize(stream);

            return(file);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Extern
        /// </summary>
        /// <param name="fontFile"></param>
        /// <param name="fontTexture"></param>
        public FontRenderer(FontFile fontFile, Texture2D fontTexture)
        {
            _fontFile     = fontFile;
            _texture      = fontTexture;
            _characterMap = new Dictionary <char, FontChar>();

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