To include a font in your Xcode project through CMake, follow these steps:
Create a new directory in your project called Fonts and place your font file (.ttf, .otf, etc.) in that directory.
In your CMakeLists.txt, create a variable that holds the path to your Fonts directory:
set(FONT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Fonts")
# Copy font to app bundle
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND
${CMAKE_COMMAND} -E copy_directory ${FONT_DIR} ${APP_BUNDLE}/Contents/Resources)
In your Xcode project, go to your app target and add the font file to the project by selecting "Add Files to [App Name]" from the File menu.
Select the font file and set the target membership to your app target.
In your app's Info.plist, add a new entry for the font file with the name of the file and the relative path to the Fonts directory:
<key>UIAppFonts</key>
<array>
<string>MyFont.ttf</string>
</array>
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-10 02:59:57 +0000
Seen: 15 times
Last updated: Jun 10 '23
How can libxml++ library be added to cmake?
Using CMake, what is the process to include a pre-existing static library in a project?
How can I obtain compilation information per transaction unit using cmake?
What is the meaning of the Cmake error stating that Wayland (WAYLAND_CLIENT_INCLUDE_DIR) is missing?
How can I incorporate Blazor Web Assembly into my current .Net Core 6 project through injection?
How do I create an index.html page for the js project in D3 JS?