Esempio n. 1
0
        /// <summary>
        /// An XGlyphTypeface for a font souce that comes from a custom font resolver
        /// creates a solitary font family exclusively for it.
        /// </summary>
        internal static XFontFamily CreateSolitary(string name)
        {
            // Custom font resolver face names must not clash with platform family names.
            FontFamilyInternal fontFamilyInternal = FontFamilyCache.GetFamilyByName(name);

            if (fontFamilyInternal == null)
            {
                fontFamilyInternal = FontFamilyInternal.GetOrCreateFromName(name, false);
                fontFamilyInternal = FontFamilyCache.CacheOrGetFontFamily(fontFamilyInternal);
            }

            // Create font family and save it in cache. Do not try to create platform objects.
            return(new XFontFamily(fontFamilyInternal));

            //// Custom font resolver face names must not clash with platform family names.
            //if (FontFamilyCache.GetFamilyByName(name) != null)
            //{
            //    // User must rename its font face to resolve naming confilict.
            //    throw new InvalidOperationException(String.Format("Font face name {0} clashs with existing family name.", name));
            //}

            //// Create font family and save it in cache. Do not try to create platform objects.
            //FontFamilyInternal fontFamilyInternal = FontFamilyInternal.GetOrCreateFromName(name, false);
            //fontFamilyInternal = FontFamilyCache.CacheFontFamily(fontFamilyInternal);
            //return new XFontFamily(fontFamilyInternal);
        }
Esempio n. 2
0
 internal XFontFamily(string familyName, bool createPlatformObjects)
 {
     FamilyInternal = FontFamilyInternal.GetOrCreateFromName(familyName, createPlatformObjects);
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XFontFamily"/> class.
 /// </summary>
 /// <param name="familyName">The family name of a font.</param>
 public XFontFamily(string familyName)
 {
     FamilyInternal = FontFamilyInternal.GetOrCreateFromName(familyName, true);
 }