예제 #1
0
 public static PostTable Deserialize(BinaryReader reader, long startOffset)
 {
     reader.BaseStream.Position = startOffset;
     return(new PostTable
     {
         Version = DataTypeConverter.ReadFixed(reader),
         ItalicAngle = DataTypeConverter.ReadFixed(reader),
         UnderlinePosition = DataTypeConverter.ReadShort(reader),
         UnderlineThickness = DataTypeConverter.ReadShort(reader),
         IsFixedPitch = DataTypeConverter.ReadULong(reader),
         MinMemType42 = DataTypeConverter.ReadULong(reader),
         MaxMemType42 = DataTypeConverter.ReadULong(reader),
         MinMemType1 = DataTypeConverter.ReadULong(reader),
         MaxMemType1 = DataTypeConverter.ReadULong(reader)
     });
 }
예제 #2
0
        public static MaxpTable Deserialize(BinaryReader reader, long startOffset)
        {
            reader.BaseStream.Position = startOffset;
            var version = DataTypeConverter.ReadFixed(reader);

            switch (version)
            {
            case "0.5000":
                return(Version05MaxpTable.Deserialize(reader, startOffset));

            case "1.0000":
                return(Version10MaxpTable.Deserialize(reader, startOffset));

            default:
                throw new NotImplementedException();
            }
        }
예제 #3
0
        public static HheaTable Deserialize(BinaryReader reader, long startOffset)
        {
            var table = new HheaTable();

            reader.BaseStream.Position = startOffset;

            table.Version               = DataTypeConverter.ReadFixed(reader);
            table.Ascender              = DataTypeConverter.ReadFword(reader);
            table.Descender             = DataTypeConverter.ReadFword(reader);
            table.LineGap               = DataTypeConverter.ReadFword(reader);
            table.AdvanceWidthMax       = DataTypeConverter.ReadUFword(reader);
            table.MinLeftSideBearing    = DataTypeConverter.ReadFword(reader);
            table.MinRightSideBearing   = DataTypeConverter.ReadFword(reader);
            table.XMaxExtent            = DataTypeConverter.ReadFword(reader);
            table.CaretSlopeRise        = DataTypeConverter.ReadShort(reader);
            table.CaretSlopeRun         = DataTypeConverter.ReadShort(reader);
            table.CaretOffset           = DataTypeConverter.ReadShort(reader);
            reader.BaseStream.Position += DataTypeLength.Short * 4;
            table.MetricDataFormat      = DataTypeConverter.ReadShort(reader);
            table.NumberOfHMetrics      = DataTypeConverter.ReadUShort(reader);

            return(table);
        }
예제 #4
0
        public static HeadTable Deserialize(BinaryReader reader, long startOffset)
        {
            var table = new HeadTable();

            reader.BaseStream.Position = startOffset;

            table.Version               = DataTypeConverter.ReadFixed(reader);
            table.FontRevision          = DataTypeConverter.ReadFixed(reader);
            reader.BaseStream.Position += 2 * DataTypeLength.ULong;
            table.Flags                 = DataTypeConverter.ReadUShort(reader);
            table.UnitsPerEm            = DataTypeConverter.ReadUShort(reader);
            table.CreateTime            = DataTypeConverter.ReadLongDateTime(reader);
            table.ModifyTime            = DataTypeConverter.ReadLongDateTime(reader);
            table.XMin                  = DataTypeConverter.ReadShort(reader);
            table.YMin                  = DataTypeConverter.ReadShort(reader);
            table.XMax                  = DataTypeConverter.ReadShort(reader);
            table.YMax                  = DataTypeConverter.ReadShort(reader);
            table.MacStyle              = DataTypeConverter.ReadUShort(reader);
            table.LowestRecPpem         = DataTypeConverter.ReadUShort(reader);
            reader.BaseStream.Position += DataTypeLength.Short;
            table.LocaTableVersion      = (LocaTableVersion)DataTypeConverter.ReadShort(reader);

            return(table);
        }