Exemplo n.º 1
0
 public override void Initialize(BinaryReader reader)
 {
     _reader = reader;
     // space characters have no data in UniFont files.
     _characters[0] = new CharacterUnicode();
     // We load the first 96 characters to 'seed' the font with correct height values.
     for (var 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;
 }
Exemplo n.º 2
0
        CharacterUnicode loadCharacter(int index)
        {
            // get the lookup table - 0x10000 ints.
            _reader.BaseStream.Position = index * 4;
            var lookup = _reader.ReadInt32();

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

            return(character);
        }