Exemple #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());
        }
Exemple #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));
        }
Exemple #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);
        }
Exemple #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));
        }
        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);
        }
Exemple #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));
        }
Exemple #7
0
        /// <inheritdoc />
        public override int GetHashCode()
        {
            var comparer = StringComparerHelpers.GetCaseInsenativeStringComparer(this.Culture);

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