Exemplo n.º 1
0
        FontFamilyInternal(GdiFontFamily gdiFontFamily)
        {
            _sourceName    = _name = gdiFontFamily.Name;
            _gdiFontFamily = gdiFontFamily;
#if WPF
            // Hybrid build only.
            _wpfFontFamily = new WpfFontFamily(gdiFontFamily.Name);
#endif
        }
Exemplo n.º 2
0
 internal static FontFamilyInternal GetOrCreateFromGdi(GdiFontFamily gdiFontFamily)
 {
     try
     {
         Lock.EnterFontFactory();
         FontFamilyInternal fontFamily = new FontFamilyInternal(gdiFontFamily);
         fontFamily = FontFamilyCache.CacheOrGetFontFamily(fontFamily);
         return(fontFamily);
     }
     finally { Lock.ExitFontFactory(); }
 }
Exemplo n.º 3
0
        FontFamilyInternal(WpfFontFamily wpfFontFamily)
        {
#if !SILVERLIGHT
            _sourceName    = wpfFontFamily.Source;
            _name          = wpfFontFamily.FamilyNames[FontHelper.XmlLanguageEnUs];
            _wpfFontFamily = wpfFontFamily;
#else
            _sourceName    = _name = wpfFontFamily.Source;
            _wpfFontFamily = wpfFontFamily;
#endif
#if GDI
            // Hybrid build only.
            _gdiFontFamily = new GdiFontFamily(_sourceName);
#endif
        }
Exemplo n.º 4
0
        // Implementation Notes
        // FontFamilyInternal implements an XFontFamily.
        //
        // * Each XFontFamily object is just a handle to its FontFamilyInternal singleton.
        //
        // * A FontFamilyInternal is uniquely identified by its name. It
        //    is not possible to use two different fonts that have the same
        //    family name.

        FontFamilyInternal(string familyName, bool createPlatformObjects)
        {
            _sourceName = _name = familyName;
#if CORE || GDI
            if (createPlatformObjects)
            {
                _gdiFontFamily = new GdiFontFamily(familyName);
                _name          = _gdiFontFamily.Name;
            }
#endif
#if WPF && !SILVERLIGHT
            if (createPlatformObjects)
            {
                _wpfFontFamily = new WpfFontFamily(familyName);
                _name          = _wpfFontFamily.FamilyNames[FontHelper.XmlLanguageEnUs];
            }
#endif
#if SILVERLIGHT
            _wpfFontFamily = new WpfFontFamily(_name);
            _name          = _wpfFontFamily.Source; // Not expected to change _name.
#endif
        }