コード例 #1
0
ファイル: FontASCII.cs プロジェクト: BclEx/object-assets
        public override void Initialize(BinaryReader reader)
        {
            var header = reader.ReadByte();

            // space characters have no data in AFont files.
            _characters[0] = new CharacterAscii();
            // We load all 224 characters; this seeds the font with correct height values.
            for (var i = 0; i < 224; i++)
            {
                var ch     = loadCharacter(reader);
                var height = ch.Height;
                if (i > 32 && i < 90 && height > Height)
                {
                    Height = height;
                }
                _characters[i] = ch;
            }
            for (var i = 0; i < 224; i++)
            {
                _characters[i].YOffset = Height - (_characters[i].Height + _characters[i].YOffset);
            }
            // ascii fonts are so tall! why?
            Height -= 2;
            // Determine the width of the space character - arbitrarily .333 the width of capital M (.333 em?).
            GetCharacter(' ').Width = GetCharacter('M').Width / 3;
        }
コード例 #2
0
ファイル: FontASCII.cs プロジェクト: BclEx/object-assets
        CharacterAscii loadCharacter(BinaryReader reader)
        {
            var character = new CharacterAscii(reader);

            return(character);
        }