public static FontProperties FontProperties(MetafileReader reader) { var properties = new List <FontProperty>(); while (reader.HasMoreData()) { int propertyIndicator = reader.ReadIndex(); int priority = reader.ReadInteger(); // The SDR for each of the standardized properties contains only one member (typed sequence) [ISO/IEC 8632-1 7.3.21] var record = ApplicationStructureDescriptorReader.ParseStructuredDataRecord(reader.ReadString()); properties.Add(new FontProperty(propertyIndicator, priority, record.Elements.First())); } return(new FontProperties(properties.ToArray())); }
public static StructuredDataRecord ParseStructuredDataRecord(string sdr) { var elements = new List <StructuredDataElement>(); var reader = new ApplicationStructureDescriptorReader(sdr); while (true) { var element = reader.ReadElement(); if (element == null) { break; } elements.Add(element); } return(new StructuredDataRecord(elements)); }
public static EscapeCommand Escape(MetafileReader reader) { int identifier = reader.ReadInteger(); string dataRecordString = reader.ReadString(); // attempt to parse the data record as structured record, in case it is a known one // otherwise it is probably application specific and cannot be assumed to be a structured record StructuredDataRecord dataRecord; if (EscapeCommand.KnownEscapeTypes.ContainsKey(identifier)) { dataRecord = ApplicationStructureDescriptorReader.ParseStructuredDataRecord(dataRecordString); } else { dataRecord = new StructuredDataRecord(new[] { new StructuredDataElement(DataTypeIndex.String, new object[] { dataRecordString }), }); } return(new EscapeCommand(identifier, dataRecord)); }