Example #1
0
        internal IEnumerable <IFontInstance> FindAll(string name, CultureInfo culture)
        {
            StringComparer?comparer = StringComparerHelpers.GetCaseInsensitiveStringComparer(culture);

            return(this.instances
                   .Where(x => comparer.Equals(x.Description.FontFamily(culture), name))
                   .ToArray());
        }
Example #2
0
        /// <inheritdoc/>
        public bool Equals(FontFamily other)
        {
            StringComparer comparer = StringComparerHelpers.GetCaseInsensitiveStringComparer(this.Culture);

            return(comparer.Equals(this.Name, other.Name) &&
                   EqualityComparer <CultureInfo> .Default.Equals(this.Culture, other.Culture) &&
                   EqualityComparer <IReadOnlyFontMetricsCollection> .Default.Equals(this.collection, other.collection));
        }
Example #3
0
        /// <inheritdoc />
        public override bool Equals(object obj)
        {
            if (obj is FontFamily other)
            {
                var comparer = StringComparerHelpers.GetCaseInsenativeStringComparer(this.Culture);
                return(this.collection == other?.collection && this.Culture == other?.Culture && comparer.Equals(this.Name, other?.Name));
            }

            return(false);
        }
Example #4
0
        /// <inheritdoc/>
        public bool Equals(FontFamily?other)
        {
            if (other is null)
            {
                return(false);
            }

            StringComparer?comparer = StringComparerHelpers.GetCaseInsensitiveStringComparer(this.Culture);

            return(this.collection == other.collection &&
                   this.Culture == other.Culture &&
                   this.DefaultStyle == other.DefaultStyle &&
                   this.AvailableStyles.SequenceEqual(other.AvailableStyles) &&
                   comparer.Equals(this.Name, other.Name));
        }
Example #5
0
        private bool TryFindInternal(string fontFamily, CultureInfo culture, [NotNullWhen(true)] out FontFamily?family)
        {
            var comparer = StringComparerHelpers.GetCaseInsenativeStringComparer(culture);

            family = null !; // make the compiler shutup

            var familyName = this.instances
                             .Select(x => x.Description.FontFamily(culture))
                             .FirstOrDefault(x => comparer.Equals(x, fontFamily));

            if (familyName == null)
            {
                return(false);
            }

            family = new FontFamily(familyName, this, culture);
            return(true);
        }
Example #6
0
        /// <inheritdoc />
        public override int GetHashCode()
        {
            StringComparer?comparer = StringComparerHelpers.GetCaseInsensitiveStringComparer(this.Culture);

            return(HashCode.Combine(this.collection, this.Culture, this.DefaultStyle, this.AvailableStyles) ^ comparer.GetHashCode(this.Name));
        }
Example #7
0
        /// <inheritdoc />
        public override int GetHashCode()
        {
            var comparer = StringComparerHelpers.GetCaseInsenativeStringComparer(this.Culture);

            return(HashCode.Combine(this.collection, this.Culture) ^ comparer.GetHashCode(this.Name));
        }