コード例 #1
0
        static CTFont CTFontWithFamily(FontFamily family, CTFontSymbolicTraits traits, float size)
        {
            // Semibold font hack
            if (FontFamily.RemoveSemiboldSuffix(family.Name, out string familyName))
            {
                if (CTFontWithFamilyName(familyName, traits, size, CTFontWeight.Semibold) is CTFont semibold)
                {
                    return(semibold);
                }
            }

            var font           = CTFontWithFamily(family, size);
            var mask           = (CTFontSymbolicTraits)uint.MaxValue;
            var fontWithTraits = font.WithSymbolicTraits(size, traits, mask);

            return(fontWithTraits ?? font);
        }