Skip to content

Commit ca75b6b

Browse files
committed
Font: fix compiling on Android; detect more fonts on macOS
1 parent 666b596 commit ca75b6b

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

src/detection/font/font.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ typedef struct FFFontResult
1212
FFstrbuf error;
1313

1414
/**
15-
* Linux / BSD: QT, GTK2, GTK3, GTK4
16-
* MacOS: System, User, Unset, Unset
17-
* Other: Unset, Unset, Unset, Unset
15+
* Linux / BSD: QT, GTK2, GTK3, GTK4
16+
* MacOS: System, User, Monospace, Application
17+
* Other: Unset, Unset, Unset, Unset
1818
*/
1919
FFstrbuf fonts[FF_DETECT_FONT_NUM_FONTS];
2020
} FFFontResult;

src/detection/font/font_android.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "fastfetch.h"
2+
#include "font.h"
23

34
void ffDetectFontImpl(const FFinstance* instance, FFFontResult* result)
45
{

src/detection/font/font_apple.m

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,14 @@
77
static void detectFontForType(CTFontUIFontType uiType, FFstrbuf* font)
88
{
99
CTFontRef ctFont = CTFontCreateUIFontForLanguage(uiType, 12, NULL);
10-
ffCfStrGetString(CTFontCopyFullName(ctFont), font);
11-
12-
if(font->length == 0)
13-
return;
14-
15-
FFstrbuf familyName;
16-
ffStrbufInit(&familyName);
17-
ffCfStrGetString(CTFontCopyFamilyName(ctFont), &familyName);
18-
19-
if (ffStrbufComp(&familyName, font) != 0)
20-
ffStrbufAppendF(font, " (%*s)", familyName.length, familyName.chars);
21-
22-
ffStrbufDestroy(&familyName);
10+
ffCfStrGetString(CTFontCopyFamilyName(ctFont), font);
2311
}
2412

2513
void ffDetectFontImpl(const FFinstance* instance, FFFontResult* result)
2614
{
2715
FF_UNUSED(instance);
2816
detectFontForType(kCTFontUIFontSystem, &result->fonts[0]);
2917
detectFontForType(kCTFontUIFontUser, &result->fonts[1]);
18+
detectFontForType(kCTFontUIFontUserFixedPitch, &result->fonts[2]);
19+
detectFontForType(kCTFontUIFontApplication, &result->fonts[3]);
3020
}

0 commit comments

Comments
 (0)