fix for custom font collection
authorKonstantin Triger <kostat@mono-cvs.ximian.com>
Wed, 16 Nov 2005 10:02:39 +0000 (10:02 -0000)
committerKonstantin Triger <kostat@mono-cvs.ximian.com>
Wed, 16 Nov 2005 10:02:39 +0000 (10:02 -0000)
svn path=/trunk/mcs/; revision=53101

mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/FontFamily.jvm.cs

index 10b31b55b6ec528a3fad3ab1e402dea1ce05a38f..6959287234fc7fd8c7f366f191c882c8969c1423 100644 (file)
@@ -1,3 +1,7 @@
+2005-11-16 Konstantin Triger <kostat@mainsoft.com>
+
+        * FontFamily.jvm.cs: fix for custom font collection
+
 2005-11-14 Vladimir Krasnov <vladimirk@mainsoft.com>
 
        * FontFamily.jvm.cs: fixed GetName
index 489cac458a2864bdde8ebab9cfaad1de20b1e031..6ffd757726930a8ae2238c3d01c9b7bf952f9c2e 100644 (file)
@@ -54,7 +54,6 @@ namespace System.Drawing {
                }
                
                private readonly string _name;
-               private readonly FontCollection _fontCollection;
 
                private awt.FontMetrics _fontMetrics = null;
                private FontStyle _lastStyle = FontStyle.Regular;
@@ -87,15 +86,16 @@ namespace System.Drawing {
 
                public FontFamily(string name, FontCollection fontCollection) {
                        if (fontCollection == null)
-                               _fontCollection = _installedFonts;
-                       else
-                               _fontCollection = fontCollection;
+                               fontCollection = _installedFonts;
 
-                       if ( !_fontCollection.Contains(name) )
-                               _name = _genericSansSerif._name;
+                       if (fontCollection.Contains(name))
+                               _name = name;
+                       else {
+                               _name = ToGenericFontName(GenericFontFamilies.SansSerif);
+                               fontCollection = _installedFonts;
+                       }
 
-                       _name = name;
-                       _font = _fontCollection.GetInitialFont( _name );
+                       _font = fontCollection.GetInitialFont( _name );
                }
 
                public FontFamily(GenericFontFamilies genericFamily) : this(ToGenericFontName(genericFamily)) {