Beispiel #1
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            if (IsReadFontImpl(reader.Version))
            {
                LineSpacing = reader.ReadSingle();
                DefaultMaterial.Read(reader);
                FontSize = reader.ReadSingle();
                Texture.Read(reader);
                reader.AlignStream(AlignType.Align4);
            }

            if (IsShortAsciiStartOffset(reader.Version))
            {
                AsciiStartOffset = reader.ReadInt16();
                FontCountX       = reader.ReadInt16();
                FontCountY       = reader.ReadInt16();
            }
            else
            {
                AsciiStartOffset = reader.ReadInt32();
                if (IsReadFontCount(reader.Version))
                {
                    FontCountX = reader.ReadInt32();
                    FontCountY = reader.ReadInt32();
                }
            }

            if (IsReadKerning(reader.Version))
            {
                Kerning = reader.ReadSingle();
            }
            if (IsReadTracking(reader.Version))
            {
                Tracking = reader.ReadSingle();
            }

            if (!IsReadFontImpl(reader.Version))
            {
                LineSpacing = reader.ReadSingle();
            }

            if (IsReadCharacterSpacing(reader.Version))
            {
                CharacterSpacing = reader.ReadInt32();
                CharacterPadding = reader.ReadInt32();
            }

            if (IsReadPerCharacterKerning(reader.Version))
            {
                if (IsBytePerCharacterKerning(reader.Version))
                {
                    m_perCharacterKerningByte = reader.ReadTupleByteSingleArray();
                }
                else
                {
                    m_perCharacterKerning = reader.ReadTupleIntFloatArray();
                }
            }

            ConvertCase = reader.ReadInt32();
            if (!IsReadFontImpl(reader.Version))
            {
                DefaultMaterial.Read(reader);
            }
            m_characterRects = reader.ReadArray <CharacterInfo>();
            if (!IsReadFontImpl(reader.Version))
            {
                Texture.Read(reader);
            }

            if (IsReadGridFont(reader.Version))
            {
                if (IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                }
            }

            if (IsByteKerningValues(reader.Version))
            {
                m_kerningValuesByte = new Dictionary <Tuple <byte, byte>, float>();
                m_kerningValuesByte.Read(reader);
            }
            else
            {
                m_kerningValues.Read(reader);
            }

            if (IsReadPixelScale(reader.Version))
            {
                PixelScale = reader.ReadSingle();
                reader.AlignStream(AlignType.Align4);
            }

            if (IsReadGridFont(reader.Version))
            {
                if (!IsGridFontFirst(reader.Version))
                {
                    GridFont = reader.ReadBoolean();
                    if (IsAlign(reader.Version))
                    {
                        reader.AlignStream(AlignType.Align4);
                    }
                }
            }

            if (IsReadFontData(reader.Version))
            {
                m_fontData = reader.ReadByteArray();
                reader.AlignStream(AlignType.Align4);

                if (!IsReadFontImpl(reader.Version))
                {
                    FontSize = reader.ReadSingle();
                }
                Ascent = reader.ReadSingle();
            }
            if (IsReadDescent(reader.Version))
            {
                Descent = reader.ReadSingle();
            }
            if (IsReadDefaultStyle(reader.Version))
            {
                DefaultStyle = (FontStyle)reader.ReadUInt32();
                m_fontNames  = reader.ReadStringArray();
            }

            if (IsReadFallbackFonts(reader.Version))
            {
                m_fallbackFonts = reader.ReadArray <PPtr <Font> >();
                reader.AlignStream(AlignType.Align4);

                FontRenderingMode = (FontRenderingMode)reader.ReadInt32();
            }

            if (IsReadUseLegacyBoundsCalculation(reader.Version))
            {
                UseLegacyBoundsCalculation = reader.ReadBoolean();
            }
            if (IsReadShouldRoundAdvanceValue(reader.Version))
            {
                ShouldRoundAdvanceValue = reader.ReadBoolean();
            }
        }