From 76424950e373d3b04ac3dd13019151bfba3e8423 Mon Sep 17 00:00:00 2001 From: sumuel Date: Mon, 17 Aug 2026 20:44:55 +0000 Subject: Add the files --- src/detection/font/font_apple.m | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/detection/font/font_apple.m (limited to 'src/detection/font/font_apple.m') diff --git a/src/detection/font/font_apple.m b/src/detection/font/font_apple.m new file mode 100644 index 0000000..e8aff3c --- /dev/null +++ b/src/detection/font/font_apple.m @@ -0,0 +1,37 @@ +#include "common/font.h" +#include "common/io.h" +#include "font.h" + +#import + +static void generateString(FFFontResult* font) +{ + if(font->fonts[0].length > 0) + { + ffStrbufAppend(&font->display, &font->fonts[0]); + ffStrbufAppendS(&font->display, " [System]"); + if(font->fonts[1].length > 0) + ffStrbufAppendS(&font->display, ", "); + } + + if(font->fonts[1].length > 0) + { + ffStrbufAppend(&font->display, &font->fonts[1]); + ffStrbufAppendS(&font->display, " [User]"); + } +} + +const char* ffDetectFontImpl(FFFontResult* result) +{ + ffStrbufAppendS(&result->fonts[0], [NSFont systemFontOfSize:12].familyName.UTF8String); + ffStrbufAppendS(&result->fonts[1], [NSFont userFontOfSize:12].familyName.UTF8String); + #ifdef MAC_OS_X_VERSION_10_15 + ffStrbufAppendS(&result->fonts[2], [NSFont monospacedSystemFontOfSize:12 weight:400].familyName.UTF8String); + #else + ffStrbufAppendS(&result->fonts[2], ""); + #endif + ffStrbufAppendS(&result->fonts[3], [NSFont userFixedPitchFontOfSize:12].familyName.UTF8String); + generateString(result); + + return NULL; +} -- cgit v1.2.3