set font for local glyph rasterizer GLFW app Apple platforms (#4098)

This commit is contained in:
Bart Louwers
2026-02-12 22:16:21 +01:00
committed by GitHub
parent f9caebd1d4
commit 1e2c53d973
2 changed files with 18 additions and 0 deletions

View File

@@ -31,6 +31,13 @@ set_property(
PROPERTY COMPILE_DEFINITIONS MLN_ASSETS_PATH=\"${PROJECT_SOURCE_DIR}/platform/glfw/assets/\"
)
if(APPLE)
target_sources(
mbgl-glfw
PRIVATE ${PROJECT_SOURCE_DIR}/platform/glfw/glfw_apple_init.mm
)
endif()
if(MLN_WITH_OPENGL)
find_package(OpenGL REQUIRED)
target_sources(

View File

@@ -0,0 +1,11 @@
#import <Foundation/Foundation.h>
// Called early in GLFW initialization so that the local glyph rasterizer
// can find a suitable CJK font via NSUserDefaults.
__attribute__((constructor))
static void setDefaultIdeographicFont() {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if (![defaults objectForKey:@"MLNIdeographicFontFamilyName"]) {
[defaults setObject:@[@"PingFang TC"] forKey:@"MLNIdeographicFontFamilyName"];
}
}