コード例 #1
0
ファイル: glyph.cs プロジェクト: labiel1/DreamHouse_Gaminp
        public override void OnChildrenLoaded()
        {
            // Pull defaults if needed.

            SVGFontElement parentFont = ParentFont;

            bool noParent = (parentFont == null);

            if (HorizAdvX == float.MaxValue)
            {
                HorizAdvX = noParent?0:parentFont.VertAdvY;
            }

            if (VertAdvY == float.MaxValue)
            {
                VertAdvY = noParent?0:parentFont.VertAdvY;
            }

            if (VertOriginX == float.MaxValue)
            {
                VertOriginX = noParent?0:parentFont.VertOriginX;
            }

            if (VertOriginY == float.MaxValue)
            {
                VertOriginY = noParent?0:parentFont.VertOriginY;
            }

            // Base:
            base.OnChildrenLoaded();
        }
コード例 #2
0
ファイル: glyph.cs プロジェクト: labiel1/DreamHouse_Gaminp
        public override bool OnAttributeChange(string property)
        {
            if (property == "d")
            {
                // Path data here!
                Glyph.Clear();

                PathString.Load(getAttribute("d"), Glyph);
            }
            else if (property == "glyph-name" || property == "unicode")
            {
                // Just ignore this one (we want it so we can return true).
            }
            else if (property == "horiz-adv-x")
            {
                HorizAdvX = GetFloatAttribute("horiz-adv-x", float.MaxValue);

                if (HorizAdvX == float.MaxValue)
                {
                    // Pull from parent font:
                    SVGFontElement parentFont = ParentFont;

                    HorizAdvX = (parentFont == null)?0:parentFont.HorizAdvX;
                }
            }
            else if (property == "vert-adv-y")
            {
                VertAdvY = GetFloatAttribute("vert-adv-y", float.MaxValue);

                if (VertAdvY == float.MaxValue)
                {
                    // Pull from parent font:
                    SVGFontElement parentFont = ParentFont;

                    VertAdvY = (parentFont == null)?0:parentFont.VertAdvY;
                }
            }
            else if (property == "vert-origin-x")
            {
                VertOriginX = GetFloatAttribute("vert-origin-x", float.MaxValue);

                if (VertOriginX == float.MaxValue)
                {
                    // Pull from parent font:
                    SVGFontElement parentFont = ParentFont;

                    VertOriginX = (parentFont == null)?0:parentFont.VertOriginX;
                }
            }
            else if (property == "vert-origin-y")
            {
                VertOriginY = GetFloatAttribute("vert-origin-y", float.MaxValue);

                if (VertOriginY == float.MaxValue)
                {
                    // Pull from parent font:
                    SVGFontElement parentFont = ParentFont;

                    VertOriginY = (parentFont == null)?0:parentFont.VertOriginY;
                }
            }
            else if (!base.OnAttributeChange(property))
            {
                return(false);
            }

            return(true);
        }