Ejemplo n.º 1
0
        /// <summary>
        ///     Reads the contents of the "post" table from the supplied stream
        ///     at the current position.
        /// </summary>
        /// <param name="reader"></param>
        protected internal override void Read(FontFileReader reader)
        {
            FontFileStream stream = reader.Stream;

            version = stream.ReadFixed();

            // The italic angle is stored in the stupid fixed field format.
            italicAngle = (float)stream.ReadFixed() / 65536.0f;

            underlinePosition  = stream.ReadFWord();
            underlineThickness = stream.ReadFWord();
            fixedPitch         = stream.ReadULong();
            minMemType42       = stream.ReadULong();
            maxMemType42       = stream.ReadULong();
            minMemType1        = stream.ReadULong();
            maxMemType1        = stream.ReadULong();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Reads the contents of the "kern" table from the current position
        ///     in the supplied stream.
        /// </summary>
        /// <param name="reader"></param>
        protected internal override void Read(FontFileReader reader)
        {
            FontFileStream stream = reader.Stream;

            // Skip version field
            stream.Skip(PrimitiveSizes.UShort);

            // Number of subtables
            int numTables = stream.ReadUShort();

            for (int i = 0; i < numTables; i++)
            {
                // Another pesky version field
                stream.Skip(PrimitiveSizes.UShort);

                // Length of the subtable, in bytes (including header).
                ushort length = stream.ReadUShort();

                // Type of information is contained in this table.
                ushort coverage = stream.ReadUShort();

                // Only interested in horiztonal kerning values in format 0
                if ((coverage & HoriztonalMask) == 1 &&
                    (coverage & MinimumMask) == 0 &&
                    ((coverage >> 8) == 0))
                {
                    // The number of kerning pairs in the table.
                    int numPairs = stream.ReadUShort();

                    hasKerningInfo = true;
                    pairs          = new KerningPairs(numPairs);

                    // Skip pointless shit
                    stream.Skip(3 * PrimitiveSizes.UShort);

                    for (int j = 0; j < numPairs; j++)
                    {
                        pairs.Add(
                            stream.ReadUShort(), // Left glyph index
                            stream.ReadUShort(), // Right glyph index
                            stream.ReadFWord()); // Kerning amount
                    }
                }
                else
                {
                    stream.Skip(length - 3 * PrimitiveSizes.UShort);
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Reads the contents of the "hhea" table from the current position
        ///     in the supplied stream.
        /// </summary>
        /// <param name="reader"></param>
        protected internal override void Read(FontFileReader reader)
        {
            FontFileStream stream = reader.Stream;

            versionNo           = stream.ReadFixed();
            ascender            = stream.ReadFWord();
            decender            = stream.ReadFWord();
            lineGap             = stream.ReadFWord();
            advanceWidthMax     = stream.ReadUFWord();
            minLeftSideBearing  = stream.ReadFWord();
            minRightSideBearing = stream.ReadFWord();
            xMaxExtent          = stream.ReadFWord();
            caretSlopeRise      = stream.ReadShort();
            caretSlopeRun       = stream.ReadShort();
            caretOffset         = stream.ReadShort();
            stream.ReadShort();
            stream.ReadShort();
            stream.ReadShort();
            stream.ReadShort();
            metricDataFormat = stream.ReadShort();
            numberOfHMetrics = stream.ReadUShort();
        }