/// <summary>
        /// Gets the size of.
        /// </summary>
        /// <returns>Size of this object</returns>
        protected int GetSizeOf()
        {
            int res = 6;

            if (startBounds != null)
            {
                res += startBounds.GetSizeOf();
            }
            if (endBounds != null)
            {
                res += endBounds.GetSizeOf();
            }
            if (morphFillStyles != null)
            {
                res += morphFillStyles.GetSizeOf();
            }
            if (morphLineStyles != null)
            {
                res += morphLineStyles.GetSizeOf();
            }

            ShapeWithStyle.NumFillBits = (uint)morphFillStyles.Count;
            ShapeWithStyle.NumLineBits = (uint)morphLineStyles.Count;

            if (startEdges != null)
            {
                res += startEdges.GetSizeOf();
            }
            if (endEdges != null)
            {
                res += endEdges.GetSizeOf();
            }
            return(res);
        }
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void UpdateData(byte version)
        {
            if (version < 2)
            {
                return;
            }

            bool fontFlagsWideOffsets = HasWideOffsets();
            bool fontFlagsHasLayout   = HasLayoutInfo();
            bool fontFlagsWideCodes   = HasWideCodes(version);

            if (glyphShapesTable != null)
            {
                glyphShapesTable.IsWideCodes = fontFlagsWideCodes;
            }

            MemoryStream         m = new MemoryStream();
            BufferedBinaryWriter w = new BufferedBinaryWriter(m);

            RecordHeader rh = new RecordHeader(TagCode, GetSizeOf());

            rh.WriteTo(w);

            w.Write(fontId);

            w.WriteBoolean(fontFlagsHasLayout);
            w.WriteBoolean(fontFlagsShiftJIS);
            w.WriteBoolean(fontFlagsSmallText);
            w.WriteBoolean(fontFlagsANSI);
            w.WriteBoolean(fontFlagsWideOffsets);
            w.WriteBoolean(fontFlagsWideCodes);
            w.WriteBoolean(fontFlagsItalic);
            w.WriteBoolean(fontFlagsBold);
            if (version >= 6)
            {
                w.Write((byte)languageCode);
            }
            else
            {
                w.Write((byte)0);
            }
            w.Write((byte)(this.fontName.Length + 1));
            w.WriteString(fontName);

            int numGlyph = GetNumGlyphs();

            w.Write((ushort)numGlyph);

            glyphShapesTable.IsWideCodes = fontFlagsWideCodes;

            //Create the codetableoffset and offsettable
            int offsetTableSize = 0;

            if (fontFlagsWideOffsets)
            {
                offsetTableSize = (numGlyph * 4) + 4;
            }
            else
            {
                offsetTableSize = (numGlyph * 2) + 2;
            }

            char[]      codes         = glyphShapesTable.GetOrderedCodes();
            IEnumerator glyphsEnum    = glyphShapesTable.GetOrderedGlyphs(codes).GetEnumerator();
            int         currentOffset = 0;

            for (int i = 0; glyphsEnum.MoveNext(); i++)
            {
                long offset = offsetTableSize + currentOffset;
                if (fontFlagsWideOffsets)
                {
                    w.Write((uint)offset);
                }
                else
                {
                    w.Write((ushort)offset);
                }

                ShapeRecordCollection shapes = ((ShapeRecordCollection)glyphsEnum.Current);
                int shapeSize = shapes.GetSizeOf();
                currentOffset += shapeSize;
            }

            if (fontFlagsWideOffsets)
            {
                w.Write((uint)(offsetTableSize + currentOffset));
            }
            else
            {
                w.Write((ushort)(offsetTableSize + currentOffset));
            }

            glyphShapesTable.WriteTo(w);

            if (fontFlagsHasLayout)
            {
                w.Write(fontAscent);
                w.Write(fontDescent);
                w.Write(fontLeading);

                if (numGlyph > 0)
                {
                    fontAdvanceTable.WriteTo(w);
                    fontBoundsTable.WriteTo(w);
                    if (version >= 7)
                    {
                        w.Write((ushort)0);
                    }
                    else
                    {
                        fontKerningTable.WriteTo(w);
                    }
                }
            }

            w.Flush();
            // write to data array
            _data = m.ToArray();
        }