Skip to content

Commit e06fa1e

Browse files
committed
- changed to more explicit approach
1 parent 471dd59 commit e06fa1e

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Source/OxyPlot.Eto.Forms_NET40/GraphicsRenderContext.cs

+14-3
Original file line numberDiff line numberDiff line change
@@ -449,16 +449,27 @@ Font GetCachedFont(string fontFamily, double fontSize, double fontWeight)
449449
return font;
450450
}
451451

452-
try
452+
bool foundFamily = false;
453+
454+
foreach(FontFamily ff in Fonts.AvailableFontFamilies)
455+
{
456+
if(fontFamily == ff.Name)
457+
{
458+
foundFamily = true;
459+
break;
460+
}
461+
}
462+
463+
if(foundFamily)
453464
{
454465
_FontCache[key] = font = new Font(fontFamily,(float)fontSize,fs);
455466
}
456-
catch (System.ArgumentOutOfRangeException)
467+
else
457468
{
458469
//The request font isn't available...take the default
459470
_FontCache[key] = font = SystemFonts.Default();
460471
}
461-
472+
462473
return font;
463474
}
464475

0 commit comments

Comments
 (0)