mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-03-27 09:49:49 +08:00
25 lines
643 B
C#
25 lines
643 B
C#
using MicaSetup.Natives;
|
|
using System.Drawing;
|
|
using System.Drawing.Text;
|
|
|
|
namespace MicaSetup.Helper;
|
|
|
|
public static class SystemFontHelper
|
|
{
|
|
public static bool HasFontFamily(string familyName, int? language = null!)
|
|
{
|
|
language ??= NativeMethods.MakeLangId(PrimaryLanguageID.LANG_ENGLISH, SublanguageID.SUBLANG_ENGLISH_US);
|
|
|
|
InstalledFontCollection installedFonts = new();
|
|
|
|
foreach (FontFamily fontFamily in installedFonts.Families)
|
|
{
|
|
if (fontFamily.GetName(language!.Value) == familyName)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
}
|