public void Read(FileReader reader, FFNT header, List <CWDH> CharacterWidths) { long pos = reader.Position; reader.ReadSignature(4, "CWDH"); SectionSize = reader.ReadUInt32(); StartIndex = reader.ReadUInt16(); EndIndex = reader.ReadUInt16(); uint NextWidthSectionOffset = reader.ReadUInt32(); for (ushort i = StartIndex; i <= EndIndex; i++) { var entry = new CharacterWidthEntry(); entry.LeftWidth = reader.ReadSByte(); entry.GlyphWidth = reader.ReadByte(); entry.Width = reader.ReadByte(); WidthEntries.Add(entry); } if (NextWidthSectionOffset != 0) { reader.SeekBegin((int)NextWidthSectionOffset - 8); NextWidthSection = new CWDH(); NextWidthSection.Read(reader, header, CharacterWidths); CharacterWidths.Add(NextWidthSection); } else { reader.SeekBegin(pos + SectionSize); } }
private static YamlSequenceNode SaveCharacterWidth(CharacterWidthEntry table) { YamlSequenceNode node = new YamlSequenceNode(); node.Style = SharpYaml.YamlStyle.Flow; node.Add(NewMappingNode("CharWidth", table.CharWidth.ToString())); node.Add(NewMappingNode("GlyphWidth", table.GlyphWidth.ToString())); node.Add(NewMappingNode("Left", table.Left.ToString())); return(node); }