mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Resolve conflicts
This commit is contained in:
parent
9133f2f951
commit
8674fca082
2 changed files with 23 additions and 11 deletions
|
|
@ -96,7 +96,7 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
public string ResultSubFontStyle { get; set; }
|
||||
public string ResultSubFontWeight { get; set; }
|
||||
public string ResultSubFontStretch { get; set; }
|
||||
public string SettingWindowFont { get; set; } = GetSystemDefaultFont(false);
|
||||
public string SettingWindowFont { get; set; } = Win32Helper.GetSystemDefaultFont(false);
|
||||
public bool UseGlyphIcons { get; set; } = true;
|
||||
public bool UseAnimation { get; set; } = true;
|
||||
public bool UseSound { get; set; } = true;
|
||||
|
|
|
|||
|
|
@ -628,21 +628,33 @@ namespace Flow.Launcher.Infrastructure
|
|||
{ "pt", "Noto Sans" }
|
||||
};
|
||||
|
||||
public static string GetSystemDefaultFont()
|
||||
/// <summary>
|
||||
/// Gets the system default font.
|
||||
/// </summary>
|
||||
/// <param name="useNoto">
|
||||
/// If true, it will try to find the Noto font for the current culture.
|
||||
/// </param>
|
||||
/// <returns>
|
||||
/// The name of the system default font.
|
||||
/// </returns>
|
||||
public static string GetSystemDefaultFont(bool useNoto = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
var language = culture.Name; // e.g., "zh-TW"
|
||||
var langPrefix = language.Split('-')[0]; // e.g., "zh"
|
||||
|
||||
// First, try to find by full name, and if not found, fallback to prefix
|
||||
if (TryGetNotoFont(language, out var notoFont) || TryGetNotoFont(langPrefix, out notoFont))
|
||||
if (useNoto)
|
||||
{
|
||||
// If the font is installed, return it
|
||||
if (Fonts.SystemFontFamilies.Any(f => f.Source.Equals(notoFont)))
|
||||
var culture = CultureInfo.CurrentCulture;
|
||||
var language = culture.Name; // e.g., "zh-TW"
|
||||
var langPrefix = language.Split('-')[0]; // e.g., "zh"
|
||||
|
||||
// First, try to find by full name, and if not found, fallback to prefix
|
||||
if (TryGetNotoFont(language, out var notoFont) || TryGetNotoFont(langPrefix, out notoFont))
|
||||
{
|
||||
return notoFont;
|
||||
// If the font is installed, return it
|
||||
if (Fonts.SystemFontFamilies.Any(f => f.Source.Equals(notoFont)))
|
||||
{
|
||||
return notoFont;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue