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; } }
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; }