コード例 #1
0
        /// <summary>
        /// Parses this object out of a stream
        /// </summary>
        protected override void Parse()
        {
            BinaryReader br = new BinaryReader(this._dataStream);
            this._fontID = br.ReadUInt16();

            try
            {
                AbstractTagHandler handler = this._SourceFileReference.GetCharacterByID(this._fontID);

                if (handler.Tag.TagType.Equals(TagTypes.DefineFont))
                {
                    DefineFont font = (DefineFont)handler;
                    this._numberOfGlyphs = font.NumberOfGlyphs;
                }
                else if (handler.Tag.TagType.Equals(TagTypes.DefineFont2))
                {
                    DefineFont2 font = (DefineFont2)handler;
                    this._numberOfGlyphs = font.NumberOfGlyphs;
                }
                else if (handler.Tag.TagType.Equals(TagTypes.DefineFont3))
                {
                    DefineFont3 font = (DefineFont3)handler;
                    this._numberOfGlyphs = font.NumberOfGlyphs;
                }
                else
                {
                    throw new SwfFormatException("The character that matches the font ID(" + this._fontID + ") is no font!");
                }

            }
            catch (Exception e)
            {
               Log.Error(this, e.Message);
               throw e;
            }

            BitStream bits = new BitStream(this._dataStream);

            this._CSMTableHint = (byte)bits.GetBits(2);
            byte reserved = (byte)bits.GetBits(6);

            this._ZoneTable = new ZoneRecord[this._numberOfGlyphs];

            for (int i = 0; i < this._numberOfGlyphs; i++)
            {
                ZoneRecord zr = new ZoneRecord(this._SwfVersion);
                zr.Parse(this._dataStream);
                this._ZoneTable[i] = zr;
            }
        }