need specify font path when use as system font (#19692)

* need specify font path when use as system font

* set custom fonts
This commit is contained in:
coulsonwang 2019-05-14 09:31:46 +08:00 committed by minggo
parent 825c4aa3f7
commit 833ab9bb81
3 changed files with 20 additions and 1 deletions

View File

@ -215,6 +215,7 @@ macro(cocos_pak_xcode cocos_target)
INFO_STRING
LONG_VERSION_STRING
SHORT_VERSION_STRING
CUSTOM_FONT
)
set(multiValueArgs)
cmake_parse_arguments(COCOS_APP "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
@ -228,6 +229,7 @@ macro(cocos_pak_xcode cocos_target)
cocos_fake_set(COCOS_APP_INFO_STRING "cocos2d-x app")
cocos_fake_set(COCOS_APP_LONG_VERSION_STRING "1.0.0")
cocos_fake_set(COCOS_APP_SHORT_VERSION_STRING "1.0")
cocos_fake_set(COCOS_APP_CUSTOM_FONT "")
# set bundle info
set_target_properties(${cocos_target}
PROPERTIES
@ -241,6 +243,7 @@ macro(cocos_pak_xcode cocos_target)
set(MACOSX_BUNDLE_INFO_STRING ${COCOS_APP_INFO_STRING})
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${COCOS_APP_LONG_VERSION_STRING})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${COCOS_APP_SHORT_VERSION_STRING})
set(MACOSX_CUSTOM_FONT_FILE ${COCOS_APP_CUSTOM_FONT})
message(STATUS "cocos package: ${cocos_target}, plist file: ${COCOS_APP_INFO_PLIST}")

View File

@ -47,5 +47,9 @@
<array>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
</array>
<key>UIAppFonts</key>
<array>
${MACOSX_CUSTOM_FONT_FILE}
</array>
</dict>
</plist>

View File

@ -467,7 +467,19 @@ if(APPLE)
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/proj.mac/Info.plist"
)
elseif(IOS)
cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in")
# set custom fonts
set(GAME_CUSTOM_FONT)
set(CUSTOM_FONT_LIST
"fonts/A Damn Mess.ttf"
"fonts/Abberancy.ttf"
"fonts/Paint Boy.ttf"
"fonts/Schwarzwald.ttf"
"fonts/Scissor Cuts.ttf")
foreach(font ${CUSTOM_FONT_LIST})
string(APPEND GAME_CUSTOM_FONT "\n<string>${font}</string>")
endforeach()
cocos_pak_xcode(${APP_NAME} INFO_PLIST "iOSBundleInfo.plist.in" CUSTOM_FONT ${GAME_CUSTOM_FONT})
set_xcode_property(${APP_NAME} ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon-${APP_NAME}")
set_xcode_property(${APP_NAME} DEVELOPMENT_TEAM "")
set_xcode_property(${APP_NAME} CODE_SIGN_IDENTITY "iPhone Developer")