set font for local glyph rasterizer GLFW app Apple platforms (#4098)
This commit is contained in:
@@ -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(
|
||||
|
||||
11
platform/glfw/glfw_apple_init.mm
Normal file
11
platform/glfw/glfw_apple_init.mm
Normal 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"];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user