示例#1
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);
            }