This content originally appeared on DEV Community and was authored by Mateus Rodrigues
There's a very important information in Applying custom fonts to text that may go unnoticed:
When retrieving the font with
custom(_:size:)
, match the name of the font with the font’s PostScript name. You can find the postscript name of a font by opening it with the Font Book app and selecting the Font Info tab.
This means that the font name is not necessarily the font filename.
Consider, for example, the Bricolage Grotesque font. If you download it you will have a file named BricolageGrotesque-VariableFont_opsz,wdth,wght.ttf, but the name that you're gonna use in the code is actually Bricolage Grotesque.
Text("Hello, world!")
.font(Font.custom("Bricolage Grotesque", size: 18))
You can even rename the file as you wish but you will always use "Bricolage Grotesque" to reference the font.
This content originally appeared on DEV Community and was authored by Mateus Rodrigues
Mateus Rodrigues | Sciencx (2024-10-18T14:17:48+00:00) About Custom Font in iOS App. Retrieved from https://www.scien.cx/2024/10/18/about-custom-font-in-ios-app/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.