Exemplo n.º 1
0
        public static Strike Read(BinaryReaderFont reader, uint numGlyphs)
        {
            Strike value = new Strike();

            value.position         = reader.Position;
            value.numGlyphs        = numGlyphs;
            value.filePath         = reader.FilePath;
            value.ppem             = reader.ReadUInt16();
            value.ppi              = reader.ReadUInt16();
            value.glyphDataOffsets = reader.ReadUInt32Array((int)numGlyphs + 1);

            /*
             * value.glyphData = new GlyphData[numGlyphs];
             * uint[] glyphDataOffsets = value.glyphDataOffsets;
             * int length = value.glyphDataOffsets.Length - 1;
             * for (int i = 0; i < length; i++) {
             *      uint offset = glyphDataOffsets[i];
             *      uint glyphLength = glyphDataOffsets[i + 1] - offset;
             *      reader.Position = position + offset;
             *      GlyphData glyphData = GlyphData.Read(reader, glyphLength);
             *      value.glyphData[i] = glyphData;
             * }
             */
            return(value);
        }
Exemplo n.º 2
0
        public static SbixTable Read(BinaryReaderFont reader, MaxpTable maxp)
        {
            long      position = reader.Position;
            SbixTable value    = new SbixTable {
                version    = reader.ReadUInt16(),
                flags      = reader.ReadUInt16(),
                numStrikes = reader.ReadUInt32(),
            };
            uint numGlyphs  = maxp.numGlyphs;
            uint numStrikes = value.numStrikes;

            value.strikeOffsets = reader.ReadUInt32Array((int)numStrikes);
            value.strikes       = new Strike[numStrikes];
            for (int i = 0; i < numStrikes; i++)
            {
                uint strikeOffset = value.strikeOffsets[i];
                reader.Position  = position + strikeOffset;
                value.strikes[i] = Strike.Read(reader, numGlyphs);
            }
            return(value);
        }
Exemplo n.º 3
0
        public static TTCHeader Read(BinaryReaderFont reader)
        {
            TTCHeader value = new TTCHeader();

            value.ttcTag = reader.ReadTag();
            if (value.ttcTag != Tag)
            {
                throw new System.Exception(
                          string.Format("Parse error: ttcTag is not valid. {0}", value.ttcTag)
                          );
            }
            value.majorVersion = reader.ReadUInt16();
            value.minorVersion = reader.ReadUInt16();
            value.numFonts     = reader.ReadUInt32();
            value.offsetTable  = reader.ReadUInt32Array((int)value.numFonts);
            if (value.majorVersion >= 2)
            {
                value.dsigTag    = reader.ReadUInt32();
                value.dsigLength = reader.ReadUInt32();
                value.dsigOffset = reader.ReadUInt32();
            }
            return(value);
        }