Beispiel #1
0
        public static FontFile Load(Stream stream)
        {
            XmlSerializer deserializer = new XmlSerializer(typeof(FontFile));
            FontFile      file         = (FontFile)deserializer.Deserialize(stream);

            return(file);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        //private TextureRef _texture;

        public GLFont(ushort id, FontFile fontFile, GLMaterial material)
        {
            this.id = id;

            _fontFile = fontFile;
            _material = material;
            //_material = Root.instance.resources.createMaterialFromTexture(fontTexture, fontTexture);
            //_material.SetBlendState( BlendState.NonPremultiplied);
            //_material.textureName = fontTexture;

            //_texture = Root.instance.resources.findTexture(fontTexture);

            _characterMap = new Dictionary <char, FontChar>();

            foreach (var fontCharacter in _fontFile.Chars)
            {
                char c = (char)fontCharacter.ID;
                _characterMap.Add(c, fontCharacter);
                if (fontCharacter.Height + fontCharacter.YOffset > MaxLineHeight)
                {
                    MaxLineHeight = fontCharacter.Height + fontCharacter.YOffset;
                }
            }
        }