Skip to content

Commit

Permalink
chore(GlyphRenderer): 最適化
Browse files Browse the repository at this point in the history
  • Loading branch information
EbiseLutica committed Jan 22, 2024
1 parent 7748832 commit 2541ae5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Promete/Graphics/GlyphRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Promete.Graphics;
public class GlyphRenderer(IWindow window)
{
private readonly Dictionary<object, FontFamily> fontCache = new();
private readonly FontCollection fontCollection = new FontCollection();

public Text CreateElement(string content)
{
Expand Down Expand Up @@ -64,7 +65,7 @@ private SixLabors.Fonts.Font ResolveFont(Font f)
}
else if (f.Path != null && File.Exists(f.Path))
{
family = new FontCollection().Install(f.Path);
family = fontCollection.Install(f.Path);
}
else if (f.Path != null)
{
Expand All @@ -73,7 +74,7 @@ private SixLabors.Fonts.Font ResolveFont(Font f)
else if (f.Stream != null)
{
f.Stream.Position = 0;
family = new FontCollection().Install(f.Stream);
family = fontCollection.Install(f.Stream);
}
else
{
Expand Down

0 comments on commit 2541ae5

Please sign in to comment.