Skip to content

Commit 471dd59

Browse files
committed
- fixed to deal with oxyplot requesting segue ui on linux
1 parent e257df4 commit 471dd59

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

Source/OxyPlot.Eto.Forms_NET40/GraphicsRenderContext.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,9 +441,25 @@ Font GetCachedFont(string fontFamily, double fontSize, double fontWeight)
441441

442442
var fs = (fontWeight >= 700) ? FontStyle.Bold : FontStyle.None;
443443
var key = fontFamily + ' ' + fs + ' ' + fontSize.ToString("0.###");
444-
Font font;
445444

446-
return _FontCache.TryGetValue(key, out font) ? font : _FontCache[key] = new Font(fontFamily,(float)fontSize,fs);
445+
Font font = null;
446+
447+
if(_FontCache.TryGetValue(key, out font))
448+
{
449+
return font;
450+
}
451+
452+
try
453+
{
454+
_FontCache[key] = font = new Font(fontFamily,(float)fontSize,fs);
455+
}
456+
catch (System.ArgumentOutOfRangeException)
457+
{
458+
//The request font isn't available...take the default
459+
_FontCache[key] = font = SystemFonts.Default();
460+
}
461+
462+
return font;
447463
}
448464

449465

0 commit comments

Comments
 (0)