private void ReadCodeMaps(BinaryReader reader, IBCFNT_ContinueBlock block) { var codeMapBlock = (BCFNT_FontCodeMapBlock)block; { switch (codeMapBlock.MappingMethod) { case BCFNT_FontMapMethod.Direct: var directMappingOffset = reader.ReadUInt16(); for (int i = codeMapBlock.CCodeBegin; i <= codeMapBlock.CCodeEnd; i++) { CodeMap.Add((ushort)i, (ushort)((i - codeMapBlock.CCodeBegin) + directMappingOffset)); } break; case BCFNT_FontMapMethod.Table: for (int i = codeMapBlock.CCodeBegin; i <= codeMapBlock.CCodeEnd; i++) { CodeMap.Add((ushort)i, reader.ReadUInt16()); } break; case BCFNT_FontMapMethod.Scan: var numEntries = reader.ReadUInt16(); for (int i = 0; i < numEntries; i++) { CodeMap.Add(reader.ReadUInt16(), reader.ReadUInt16()); } break; } } }
private void ReadCharacterWidths(BinaryReader reader, IBCFNT_ContinueBlock block) { var charWidthBlock = (BCFNT_FontCharacterWidthBlock)block; for (ushort index = charWidthBlock.IndexBegin; index <= charWidthBlock.IndexEnd; index++) { CharacterWidths.Add(index, reader.ReadStruct <BCFNT_CharWidth>()); } }