Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            bool flag = !(obj is StyleFont);
            bool result;

            if (flag)
            {
                result = false;
            }
            else
            {
                StyleFont lhs = (StyleFont)obj;
                result = (lhs == this);
            }
            return(result);
        }
        public StyleFont GetStyleFont(StylePropertyId id)
        {
            StyleValue styleValue = default(StyleValue);
            bool       flag       = this.TryGetStyleValue(id, ref styleValue);
            StyleFont  result;

            if (flag)
            {
                Font v = styleValue.resource.IsAllocated ? (styleValue.resource.Target as Font) : null;
                result = new StyleFont(v, styleValue.keyword);
            }
            else
            {
                result = StyleKeyword.Null;
            }
            return(result);
        }
Exemplo n.º 3
0
        private bool SetStyleValue(StylePropertyId id, StyleFont inlineValue, StyleFont sharedValue)
        {
            var sv = new StyleValue();

            if (TryGetStyleValue(id, ref sv))
            {
                if (sv.resource.IsAllocated)
                {
                    var font = sv.resource.IsAllocated ? sv.resource.Target as Font : null;
                    if (font == inlineValue.value && sv.keyword == inlineValue.keyword)
                    {
                        return(false);
                    }

                    if (sv.resource.IsAllocated)
                    {
                        sv.resource.Free();
                    }
                }
            }
            else if (inlineValue.keyword == StyleKeyword.Null)
            {
                return(false);
            }

            sv.id       = id;
            sv.keyword  = inlineValue.keyword;
            sv.resource = inlineValue.value != null?GCHandle.Alloc(inlineValue.value) : new GCHandle();

            SetStyleValue(sv);

            if (inlineValue.keyword == StyleKeyword.Null)
            {
                sv.keyword  = sharedValue.keyword;
                sv.resource = sharedValue.value != null?GCHandle.Alloc(sharedValue.value) : new GCHandle();
            }

            ApplyStyleValue(sv);
            return(true);
        }
Exemplo n.º 4
0
 public bool Equals(StyleFont other)
 {
     return(other == this);
 }
Exemplo n.º 5
0
 internal StyleFont(GCHandle gcHandle, StyleKeyword keyword)
 {
     this = new StyleFont(gcHandle.IsAllocated ? (gcHandle.Target as Font) : null, keyword);
 }
Exemplo n.º 6
0
 public StyleFont(StyleKeyword keyword)
 {
     this = new StyleFont(null, keyword);
 }
Exemplo n.º 7
0
 public StyleFont(Font v)
 {
     this = new StyleFont(v, StyleKeyword.Undefined);
 }