private static void LoadCharsBlock(byte[] buffer, int block_size, FontData font_data) { const int char_line_block_size = 20; int char_count = block_size / char_line_block_size; font_data.Chars = new char[char_count]; font_data.GlyphOffsets = new SVec2[char_count]; font_data.GlyphRects = new SRect[char_count]; font_data.GlyphXAdvances = new float[char_count]; for (int i = 0; i < char_count; ++i) { int start = i * char_line_block_size; int char_index = MemWordHelpers.MakeDWordLittleEndian(buffer, start); font_data.Chars[i] = char_index >= 0 ? (char)char_index : '\0'; font_data.GlyphRects[i] = new SRect( MemWordHelpers.MakeWordLittleEndian(buffer, start + 4), MemWordHelpers.MakeWordLittleEndian(buffer, start + 6), MemWordHelpers.MakeWordLittleEndian(buffer, start + 8), MemWordHelpers.MakeWordLittleEndian(buffer, start + 10) ); font_data.GlyphOffsets[i] = new SVec2( MemWordHelpers.MakeWordLittleEndian(buffer, start + 12), MemWordHelpers.MakeWordLittleEndian(buffer, start + 14) ); font_data.GlyphXAdvances[i] = MemWordHelpers.MakeWordLittleEndian(buffer, start + 16); } }
private static void LoadCommonBlock(byte[] buffer, FontData font_data) { font_data.LineHeight = MemWordHelpers.MakeWordLittleEndian(buffer, 0); }
private static void LoadInfoBlock(byte[] buffer, FontData font_data) { font_data.Size = Calc.Abs(MemWordHelpers.MakeWordLittleEndian(buffer, 0)); }