Exemple #1
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = inherit.GetHashCode();
         hashCode = (hashCode * 397) ^ (color != null ? color.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (backgroundColor != null ? backgroundColor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ fontSize.GetHashCode();
         hashCode = (hashCode * 397) ^ (fontWeight != null ? fontWeight.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ fontStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ letterSpacing.GetHashCode();
         hashCode = (hashCode * 397) ^ wordSpacing.GetHashCode();
         hashCode = (hashCode * 397) ^ textBaseline.GetHashCode();
         hashCode = (hashCode * 397) ^ height.GetHashCode();
         hashCode = (hashCode * 397) ^ (decoration != null ? decoration.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (decorationColor != null ? decorationColor.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ decorationStyle.GetHashCode();
         hashCode = (hashCode * 397) ^ decorationThickness.GetHashCode();
         hashCode = (hashCode * 397) ^ (foreground != null ? foreground.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (background != null ? background.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (fontFamily != null ? fontFamily.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^
                    (fontFamilyFallback != null ? fontFamilyFallback.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (shadows != null ? shadows.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (fontFeatures != null ? fontFeatures.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemple #2
0
 public Entry(string?fontFamily, FontWeight fontWeight, TypefaceStyle style)
 {
     FontFamily = fontFamily;
     FontWeight = fontWeight;
     Style      = style;
     _hashCode  = (FontFamily?.GetHashCode() ?? 0) ^ FontWeight.GetHashCode() ^ Style.GetHashCode();
 }
Exemple #3
0
 private Int32 Hash(FontFamily ff, FontStyle style, FontWeight weight, FontStretch stretch)
 {
     unchecked
     {
         return(ff.GetHashCode() + style.GetHashCode() * 1229 + weight.GetHashCode() * 20011 + stretch.GetHashCode() * 200003);
     }
 }
Exemple #4
0
        public override int GetHashCode()
        {
            var hashCode = 577408457;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FontFamily);

            hashCode = hashCode * -1521134295 + FontWeight.GetHashCode();
            hashCode = hashCode * -1521134295 + FontStyle.GetHashCode();
            hashCode = hashCode * -1521134295 + Size.GetHashCode();
            return(hashCode);
        }
Exemple #5
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = fontFamily?.GetHashCode() ?? 0;
         hashCode = (hashCode * 397) ^ (fontSize?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (fontWeight?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (fontStyle?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (height?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (leading?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ forceStrutHeight.GetHashCode();
         return(hashCode);
     }
 }
        /// <summary>
        /// Create correspondent hash code for the object
        /// </summary>
        /// <returns>object hash code</returns>
        public override int GetHashCode()
        {
            int hash = _fontFamily.GetHashCode();

            if (_fallbackFontFamily != null)
            {
                hash = HashFn.HashMultiply(hash) + _fallbackFontFamily.GetHashCode();
            }

            hash = HashFn.HashMultiply(hash) + _style.GetHashCode();
            hash = HashFn.HashMultiply(hash) + _weight.GetHashCode();
            hash = HashFn.HashMultiply(hash) + _stretch.GetHashCode();
            return(HashFn.HashScramble(hash));
        }
Exemple #7
0
        private static int GetFontKey(Device dev, string name, int size, bool italic, FontWeight weight, FontQuality quality)
        {
            int hashCode = 0;

            unchecked
            {
                hashCode += 1000000007 * dev.ComPointer.GetHashCode();
                hashCode += 1000000009 * name.GetHashCode();
                hashCode += 1000000021 * size.GetHashCode();
                hashCode += 1000000033 * italic.GetHashCode();
                hashCode += 1000000087 * weight.GetHashCode();
                hashCode += 1000000093 * quality.GetHashCode();
            }

            return(hashCode);
        }
Exemple #8
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = MinorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ MajorVersion.GetHashCode();
         hashCode = (hashCode * 397) ^ (PropMask?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (int)FontEffects;
         hashCode = (hashCode * 397) ^ (int)FontHeight;
         hashCode = (hashCode * 397) ^ FontCharSet.GetHashCode();
         hashCode = (hashCode * 397) ^ FontPitchAndFamily.GetHashCode();
         hashCode = (hashCode * 397) ^ ParagraphAlign.GetHashCode();
         hashCode = (hashCode * 397) ^ FontWeight.GetHashCode();
         hashCode = (hashCode * 397) ^ (FontName?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
 public override int GetHashCode()
 {
     unchecked {
         return((Name != null ? Name.GetHashCode() : 0) ^ Foreground.GetHashCode() ^ Background.GetHashCode() ^ FontWeight.GetHashCode() ^ FontStyle.GetHashCode());
     }
 }
 public override int GetHashCode()
 {
     return(FontFamily.GetHashCode() ^ FontSize.GetHashCode() ^ FontWeight.GetHashCode() ^ FontStretch.GetHashCode() ^ FontStyle.GetHashCode());
 }
Exemple #11
0
        private void OnPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if (e.Property.Name == FontFamilyProperty.Name)
            {
                FontFamily ff = (FontFamily)e.NewValue;
                using (var us = new Utf8String(ff.Source))
                {
                    _scintilla.CallScintilla(SCI_STYLESETFONT, new IntPtr(Index), us.Pointer);
                }
                return;
            }

            if (e.Property.Name == FontSizeProperty.Name)
            {
                double size = (double)e.NewValue;
                _scintilla.CallScintilla(SCI_STYLESETSIZE, Index, (int)size);
                return;
            }

            if (e.Property.Name == ForegroundProperty.Name)
            {
                _scintilla.CallScintilla(SCI_STYLESETFORE, Index, ToScintillaColor(Foreground, Colors.Black));
                return;
            }

            if (e.Property.Name == BackgroundProperty.Name)
            {
                _scintilla.CallScintilla(SCI_STYLESETBACK, Index, ToScintillaColor(Background, Colors.White));
                return;
            }

            if (e.Property.Name == FontWeightProperty.Name)
            {
                FontWeight w = (FontWeight)e.NewValue;
                int        h = w.GetHashCode(); // yes, it's the value
                _scintilla.CallScintilla(SCI_STYLESETWEIGHT, Index, h);
                return;
            }

            if (e.Property.Name == TextDecorationsProperty.Name)
            {
                bool underline = false;
                foreach (var td in TextDecorations)
                {
                    if (td.Location == TextDecorationLocation.Underline)
                    {
                        underline = true;
                        _scintilla.CallScintilla(SCI_STYLESETUNDERLINE, Index, 1);
                    }
                }

                if (!underline)
                {
                    _scintilla.CallScintilla(SCI_STYLESETUNDERLINE, Index, 0);
                }
                return;
            }

            if (e.Property.Name == IsVisibleProperty.Name)
            {
                _scintilla.CallScintilla(SCI_STYLESETVISIBLE, Index, (bool)e.NewValue ? 1 : 0);
                return;
            }

            if (e.Property.Name == FontStyleProperty.Name)
            {
                FontStyle s = (FontStyle)e.NewValue;
                if (FontStyles.Italic.Equals(s))
                {
                    _scintilla.CallScintilla(SCI_STYLESETITALIC, Index, 1);
                }
                else if (FontStyles.Normal.Equals(s))
                {
                    _scintilla.CallScintilla(SCI_STYLESETITALIC, Index, 0);
                }
                return;
            }
        }