示例#1
0
 public void Read(TTFReader r, int n)
 {
     this.values = new List <short>();
     for (int i = 0; i < n; ++i)
     {
         this.values.Add(r.ReadInt16());
     }
 }
示例#2
0
            public List <uint>   idRangeOffsets; // Offsets into glyphIdArray or 0

            //public List<ushort> glyphIdArray;   // Glyph index array (arbitrary length)

            public void Read(TTFReader r, bool readformat = false)
            {
                if (readformat == true)
                {
                    r.ReadInt(out this.format);
                }
                else
                {
                    this.format = 4;
                }

                r.ReadInt(out this.length);
                r.ReadInt(out this.language);
                r.ReadInt(out this.segCountX2);
                r.ReadInt(out this.searchRange);
                r.ReadInt(out this.entrySelector);
                r.ReadInt(out this.rangeShift);

                uint segCt = (uint)this.segCountX2 / 2;

                this.endCode = new List <ushort>();
                for (int i = 0; i < segCt; ++i)
                {
                    this.endCode.Add(r.ReadUInt16());
                }

                r.ReadInt(out this.reservePad);

                this.startCode = new List <ushort>();
                for (int i = 0; i < segCt; ++i)
                {
                    this.startCode.Add(r.ReadUInt16());
                }

                this.idDelta = new List <short>();
                for (int i = 0; i < segCt; ++i)
                {
                    this.idDelta.Add(r.ReadInt16());
                }

                this.idRangeOffsets = new List <uint>();
                for (int i = 0; i < segCt; ++i)
                {
                    uint ro = r.ReadUInt16();

                    if (ro != 0)
                    {
                        // glyphId = *(idRangeOffset[i] / 2
                        //              + (c - startCode[i])
                        //              + &idRangeOffset[i])
                        uint addr = (uint)r.GetPosition() - 2;
                        ro = addr + ro;
                    }
                    this.idRangeOffsets.Add(ro);
                }
            }
示例#3
0
        public ushort       numOfLongMetrics;     // Number of advance heights in the vertical metrics table.

        public void Read(TTFReader r)
        {
            r.ReadInt(out this.majorVersion);
            r.ReadInt(out this.minorVersion);
            r.ReadInt(out this.ascent);
            r.ReadInt(out this.descent);
            r.ReadInt(out this.lineGap);
            r.ReadInt(out this.advanceHeightMax);
            r.ReadInt(out this.minTopSideBearing);
            r.ReadInt(out this.minBottomSideBearing);
            r.ReadInt(out this.yMaxExtent);
            r.ReadInt(out this.caretSlopeRise);
            r.ReadInt(out this.caretSlopeRun);
            r.ReadInt(out this.caredOffset);

            r.ReadInt16();
            r.ReadInt16();
            r.ReadInt16();
            r.ReadInt16();

            r.ReadInt(out this.metricDataFormat);
            r.ReadInt(out this.numOfLongMetrics);
        }
示例#4
0
        public ushort       numberOfHMetrics; // Number of hMetric entries in 'hmtx' table

        public void Read(TTFReader r)
        {
            r.ReadInt(out this.majorVersion);
            r.ReadInt(out this.minorVersion);
            r.ReadInt(out this.ascender);
            r.ReadInt(out this.descender);
            r.ReadInt(out this.lineGap);
            r.ReadInt(out this.advanceWidthMax);
            r.ReadInt(out this.minLeftSideBearing);
            r.ReadInt(out this.minRightSideBearing);
            r.ReadInt(out this.xMaxExtent);
            r.ReadInt(out this.caretSlopeRise);
            r.ReadInt(out this.caretSlopeRun);
            r.ReadInt(out this.caredOffset);

            // Eat up for reserved
            r.ReadInt16();
            r.ReadInt16();
            r.ReadInt16();
            r.ReadInt16();

            r.ReadInt(out this.metricDataFormat);
            r.ReadInt(out this.numberOfHMetrics);
        }
示例#5
0
        public List <short>         topSideBearings; // The top sidebearing of the glyph. Signed integer in FUnits.

        public void Read(TTFReader r, int numberofVMetrics, int numGlyphs)
        {
            this.vMetrics = new List <longVerMetric>();
            for (int i = 0; i < numberofVMetrics; ++i)
            {
                longVerMetric lvm = new longVerMetric();
                r.ReadInt(out lvm.advanceHeight);
                r.ReadInt(out lvm.topSideBearing);
                this.vMetrics.Add(lvm);
            }

            this.topSideBearings = new List <short>();
            // We could have them pass in the numGlyphs-numberOfHMetrics instead of
            // calculating this ourselves, but I think this helps add rigor.
            for (int i = 0; i < numGlyphs - numberofVMetrics; ++i)
            {
                this.topSideBearings.Add(r.ReadInt16());
            }
        }
示例#6
0
        public List <short>         leftSideBearings; // Left side bearings for glyph IDs greater than or equal to numberOfHMetrics.

        public void Read(TTFReader r, int numberOfHMetrics, int numGlyphs)
        {
            this.hMetrics = new List <longHorMetric>();
            for (int i = 0; i < numberOfHMetrics; ++i)
            {
                longHorMetric lhm = new longHorMetric();
                r.ReadInt(out lhm.advanceWidth);
                r.ReadInt(out lhm.lsb);
                this.hMetrics.Add(lhm);
            }

            this.leftSideBearings = new List <short>();
            // We could have them pass in the numGlyphs-numberOfHMetrics instead of
            // calculating this ourselves, but I think this helps add rigor.
            for (int i = 0; i < numGlyphs - numberOfHMetrics; ++i)
            {
                this.leftSideBearings.Add(r.ReadInt16());
            }
        }
示例#7
0
            public bool Read(TTFReader r)
            {
                // Set defaults in case we don't read them
                // because it's filtered out from the flags.
                this.argument1 = 0;
                this.argument2 = 0;
                this.scale     = 1.0f;
                this.xscale    = 1.0f;
                this.yscale    = 1.0f;
                this.scale01   = 0.0f;
                this.scale10   = 0.0f;

                r.ReadInt(out this.flags);
                r.ReadInt(out this.glyphIndex);

                if ((this.flags & ARG_1_AND_2_ARE_WORDS) != 0)
                {
                    short a1 = r.ReadInt16();
                    short a2 = r.ReadInt16();

                    if ((this.flags & ARGS_ARE_XY_VALUES) != 0)
                    {
                        this.argument1 = a1;
                        this.argument2 = a2;
                    }
                    else
                    {
                        this.argument1 = (ushort)a1;
                        this.argument2 = (ushort)a2;
                    }
                }
                else
                {
                    sbyte a1 = r.ReadInt8();
                    sbyte a2 = r.ReadInt8();

                    if ((this.flags & ARGS_ARE_XY_VALUES) != 0)
                    {
                        this.argument1 = a1;
                        this.argument2 = a2;
                    }
                    else
                    {
                        this.argument1 = (byte)a1;
                        this.argument2 = (byte)a2;
                    }
                }
                if ((this.flags & WE_HAVE_A_SCALE) != 0)
                {
                    this.scale = r.ReadFDot14();
                }
                else if ((this.flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0)
                {
                    this.xscale = r.ReadFDot14();   // Format 2.14
                    this.yscale = r.ReadFDot14();   // Format 2.14
                }
                else if ((this.flags & WE_HAVE_A_TWO_BY_TWO) != 0)
                {
                    this.xscale  = r.ReadFDot14();  // Format 2.14
                    this.scale01 = r.ReadFDot14();  // Format 2.14
                    this.scale10 = r.ReadFDot14();  // Format 2.14
                    this.yscale  = r.ReadFDot14();  // Format 2.14
                }

                return((this.flags & MORE_COMPONENTS) != 0);
            }