mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Merge pull request #269 from CarterLi/master
Font: fix compiling on Android; detect more fonts on macOS
This commit is contained in:
@@ -12,9 +12,9 @@ typedef struct FFFontResult
|
||||
FFstrbuf error;
|
||||
|
||||
/**
|
||||
* Linux / BSD: QT, GTK2, GTK3, GTK4
|
||||
* MacOS: System, User, Unset, Unset
|
||||
* Other: Unset, Unset, Unset, Unset
|
||||
* Linux / BSD: QT, GTK2, GTK3, GTK4
|
||||
* MacOS: System, User, Monospace, Application
|
||||
* Other: Unset, Unset, Unset, Unset
|
||||
*/
|
||||
FFstrbuf fonts[FF_DETECT_FONT_NUM_FONTS];
|
||||
} FFFontResult;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "fastfetch.h"
|
||||
#include "font.h"
|
||||
|
||||
void ffDetectFontImpl(const FFinstance* instance, FFFontResult* result)
|
||||
{
|
||||
|
||||
@@ -7,19 +7,7 @@
|
||||
static void detectFontForType(CTFontUIFontType uiType, FFstrbuf* font)
|
||||
{
|
||||
CTFontRef ctFont = CTFontCreateUIFontForLanguage(uiType, 12, NULL);
|
||||
ffCfStrGetString(CTFontCopyFullName(ctFont), font);
|
||||
|
||||
if(font->length == 0)
|
||||
return;
|
||||
|
||||
FFstrbuf familyName;
|
||||
ffStrbufInit(&familyName);
|
||||
ffCfStrGetString(CTFontCopyFamilyName(ctFont), &familyName);
|
||||
|
||||
if (ffStrbufComp(&familyName, font) != 0)
|
||||
ffStrbufAppendF(font, " (%*s)", familyName.length, familyName.chars);
|
||||
|
||||
ffStrbufDestroy(&familyName);
|
||||
ffCfStrGetString(CTFontCopyFamilyName(ctFont), font);
|
||||
}
|
||||
|
||||
void ffDetectFontImpl(const FFinstance* instance, FFFontResult* result)
|
||||
@@ -27,4 +15,6 @@ void ffDetectFontImpl(const FFinstance* instance, FFFontResult* result)
|
||||
FF_UNUSED(instance);
|
||||
detectFontForType(kCTFontUIFontSystem, &result->fonts[0]);
|
||||
detectFontForType(kCTFontUIFontUser, &result->fonts[1]);
|
||||
detectFontForType(kCTFontUIFontUserFixedPitch, &result->fonts[2]);
|
||||
detectFontForType(kCTFontUIFontApplication, &result->fonts[3]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user