コード例 #1
0
ファイル: FontUnicode.cs プロジェクト: msx752/UltimaXNA
 public override void Initialize(BinaryReader reader)
 {
     m_reader = reader;
     // space characters have no data in UniFont files.
     m_characters[0] = new CharacterUnicode();
     // We load the first 96 characters to 'seed' the font with correct height values.
     for (int i = 33; i < 128; i++)
     {
         GetCharacter((char)i);
     }
     // Determine the width of the space character - arbitrarily .333 the width of capital M (.333 em?).
     GetCharacter(' ').Width = GetCharacter('M').Width / 3;
 }
コード例 #2
0
 public override void Initialize(BinaryReader reader)
 {
     m_reader = reader;
     // space characters have no data in UniFont files.
     m_characters[0] = new CharacterUnicode();
     // We load the first 96 characters to 'seed' the font with correct height values.
     for (int i = 33; i < 128; i++)
     {
         GetCharacter((char)i);
     }
     // Determine the width of the space character - arbitrarily .333 the width of capital M (.333 em?).
     GetCharacter(' ').Width = GetCharacter('M').Width / 3;
 }
コード例 #3
0
        CharacterUnicode loadCharacter(int index)
        {
            // get the lookup table - 0x10000 ints.
            m_reader.BaseStream.Position = index * 4;
            int lookup = m_reader.ReadInt32();

            if (lookup == 0)
            {
                // no character - so we just return null
                return(NullCharacter);
            }
            m_reader.BaseStream.Position = lookup;
            CharacterUnicode character = new CharacterUnicode(m_reader);

            return(character);
        }
コード例 #4
0
ファイル: FontUnicode.cs プロジェクト: msx752/UltimaXNA
        CharacterUnicode loadCharacter(int index)
        {
            // get the lookup table - 0x10000 ints.
            m_reader.BaseStream.Position = index * 4;
            int lookup = m_reader.ReadInt32();

            if (lookup == 0)
            {
                // no character - so we just return null
                return NullCharacter;
            }
            else
            {
                m_reader.BaseStream.Position = lookup;
                CharacterUnicode character = new CharacterUnicode(m_reader);
                return character;
            }
        }
コード例 #5
0
        public override ICharacter GetCharacter(char character)
        {
            int index = ((int)character & 0xFFFFF) - 0x20;

            if (index < 0)
            {
                return(NullCharacter);
            }
            if (m_characters[index] == null)
            {
                CharacterUnicode ch = loadCharacter(index + 0x20);
                int height          = ch.Height + ch.YOffset;
                if (index < 128 && height > Height)
                {
                    Height = height;
                }
                m_characters[index] = ch;
            }
            return(m_characters[index]);
        }