Files
ersatztv/ErsatzTV.Infrastructure/Streaming/Graphics/Fonts/GraphicsEngineFonts.cs
T
Jason DoveandGitHub 5d081ceeff fix editorconfig and run code cleanup (#2324)
* fix formatting rules

* reformat ersatztv

* reformat ersatztv.application

* reformat ersatztv.core

* refactor ersatztv.core.tests

* reformat ersatztv.ffmpeg

* reformat ersatztv.ffmpeg.tests

* reformat ersatztv.infrastructure

* cleanup infra mysql

* cleanup infra sqlite

* cleanup infra tests

* cleanup ersatztv.scanner

* cleanup ersatztv.scanner.tests

* sln cleanup

* update dependencies
2025-08-16 14:44:48 +00:00

32 lines
924 B
C#

using Topten.RichTextKit;
namespace ErsatzTV.Infrastructure.Streaming.Graphics;
public class GraphicsEngineFonts(CustomFontMapper mapper)
{
private static readonly System.Collections.Generic.HashSet<string> LoadedFontFiles
= new(StringComparer.OrdinalIgnoreCase);
public FontMapper Mapper => mapper;
public void LoadFonts(string fontsFolder)
{
foreach (string file in Directory.EnumerateFiles(fontsFolder, "*.*", SearchOption.AllDirectories))
{
if (!file.EndsWith(".ttf", StringComparison.OrdinalIgnoreCase) &&
!file.EndsWith(".otf", StringComparison.OrdinalIgnoreCase))
{
continue;
}
if (!LoadedFontFiles.Add(file))
{
continue;
}
using FileStream stream = File.OpenRead(file);
mapper.LoadPrivateFont(stream, null);
}
}
}