Ejemplo n.º 1
0
        public List <SegmentMap> axisSegmentMap; // The segment maps array — one segment map for each axis, in the order of axes specified in the 'fvar' table.

        public void Read(TTFReader r)
        {
            r.ReadInt(out this.majorVersion);
            r.ReadInt(out this.minorVersion);
            r.ReadInt(out reserved);
            r.ReadInt(out axisCount);

            this.axisSegmentMap = new List <SegmentMap>();
            for (int i = 0; i < this.axisCount; ++i)
            {
                SegmentMap sm = new SegmentMap();
                sm.axisValueMaps = new List <AxisValueMap>();

                r.ReadInt(out sm.positionMapCount);
                for (int j = 0; j < sm.positionMapCount; ++j)
                {
                    AxisValueMap avm = new AxisValueMap();

                    avm.fromCoordinate = r.ReadFDot14();
                    avm.toCoordinate   = r.ReadFDot14();

                    sm.axisValueMaps.Add(avm);
                }

                this.axisSegmentMap.Add(sm);
            }
        }
Ejemplo n.º 2
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);
            }