mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
TerminalFont (macOS): detect non-ascii font of iTerm
This commit is contained in:
@@ -10,6 +10,7 @@ typedef struct FFTerminalFontResult
|
||||
{
|
||||
FFstrbuf error;
|
||||
FFfont font;
|
||||
FFfont fallback;
|
||||
} FFTerminalFontResult;
|
||||
|
||||
bool ffDetectTerminalFont(FFTerminalFontResult* result);
|
||||
|
||||
@@ -38,6 +38,14 @@ static void detectIterm2(FFTerminalFontResult* terminalFont)
|
||||
return;
|
||||
}
|
||||
ffFontInitWithSpace(&terminalFont->font, normalFont.UTF8String);
|
||||
|
||||
NSNumber* useNonAsciiFont = [bookmark valueForKey:@"Use Non-ASCII Font"];
|
||||
if(useNonAsciiFont.boolValue)
|
||||
{
|
||||
NSString* nonAsciiFont = [bookmark valueForKey:@"Non Ascii Font"];
|
||||
if (nonAsciiFont)
|
||||
ffFontInitWithSpace(&terminalFont->fallback, nonAsciiFont.UTF8String);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
||||
{
|
||||
FFTerminalFontResult terminalFont;
|
||||
ffFontInit(&terminalFont.font);
|
||||
ffFontInit(&terminalFont.fallback);
|
||||
ffStrbufInit(&terminalFont.error);
|
||||
|
||||
if(!ffDetectTerminalFont(&terminalFont))
|
||||
@@ -22,7 +23,13 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs.key, &options->moduleArgs.keyColor);
|
||||
ffStrbufPutTo(&terminalFont.font.pretty, stdout);
|
||||
ffStrbufWriteTo(&terminalFont.font.pretty, stdout);
|
||||
if(terminalFont.fallback.pretty.length)
|
||||
{
|
||||
fputs(" / ", stdout);
|
||||
ffStrbufWriteTo(&terminalFont.fallback.pretty, stdout);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -37,6 +44,7 @@ void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
||||
|
||||
ffStrbufDestroy(&terminalFont.error);
|
||||
ffFontDestroy(&terminalFont.font);
|
||||
ffFontDestroy(&terminalFont.fallback);
|
||||
}
|
||||
|
||||
void ffInitTerminalFontOptions(FFTerminalFontOptions* options)
|
||||
|
||||
Reference in New Issue
Block a user