I downloaded the new SFPro fonts from this url https://developer.apple.com/fonts/. And I can see that it is properly installed in Font Book. But when I try to use it as System font inside my app's UILabel, it gives me the SFUI fonts instead. (I print the system font with the code below and it prints '.SFUIText')
print(UIFont.systemFont(ofSize: 15).fontName)
How can I use new SFPro fonts instead of SFUI? My Xcode version is 8.2.1 and the software is El Capitan version 10.11.16.
I am successful in using it by following steps:
1) Add font files to your project
2) In your info.plist press on the plus button. Type Fonts provided by application. Add your font files names for example (SF-Pro-Text-Regular.otf)
3) Make sure the font file has your project as a targeted membership by clicking on the file and then ticking on checkmark under target membership section
Related
We recently integrated the Here SDK lite for iOS in our app and during the submission to the AppStore, we discover that the xcframework contains unsupported files.
ITMS-90853: Invalid font - There was an error validating the font at
'Subito.app/Frameworks/heresdk.framework/style/fonts/FiraGO-Map.woff'.
Font not supported by platform.
ITMS-90853: Invalid font - There was an error validating the font at
'Subito.app/Frameworks/heresdk.framework/style/fonts/DroidSansFallback.woff'.
Font not supported by platform.
ITMS-90853: Invalid font - There was an error validating the font at
'Subito.app/Frameworks/heresdk.framework/style/fonts/FiraGO-Italic.woff'.
Font not supported by platform.
We didn't find any instructions on the official documentation about stripping these files before submitting to the store, but that's what we proceeded to do, since we are not using any UI related component coming from the SDK at the moment. I hope that it's a safe operation (resulting app seems to work fine).
Are there any other folders that could/should be removed from the xcframework before the submission to the store (e.g. style folder)?
The HERE SDK contains several fonts to render map labels in different languages. If you want to strip those files - or if you want to optimize the size of the overall app, you can remove selected fonts. For example, the font with Chinese, Japanese and Korean characters is around 1.7MB. To remove this font, open the heresdk.framework file and remove the following files:
style/fonts/DroidSansFallback.woff
style/fonts/DroidSansFallback.license
When you remove the font, it is recommended to switch the map language to any other language than Chinese, Japanese or Korean.
Check also the map / language documentation with more related info.
This should help at least as a workaround until the faulty fonts are fixed by the HERE SDK team with a newer HERE SDK release.
For your question: You can also remove the related license file.
I try using custom font in react native app ,
create assets/fonts/ folder in root of project and put fonts in there.
create react-native.config.js and write ,
module.exports = {
project: {
ios: {},
android: {},
},
assets: ['./assets/fonts/'],
};
and try react-native link
it is working in android but not working in ios
react-native: 0.60.5
npm: 6.11.0
node: 10.16.0
Android will use the font name but in IOS it will use the “PostScript name(Please check may be this is the issue)”.
Suppose you have a font "SFUIDisplayBold.otf" . You have link the font . It will work in Android but not in IOS . Because PostScript name of font is“SFUIDisplay-Bold.otf” so for IOS you have to use "SFUIDisplay-Bold.otf" despite the fact that we have added font with name "SFUIDisplayBold.otf". (See Details)
You can see the PostScript name of fonts in font book
Custom fonts are not bundled automatically for IOS. You need to link them for IOS manually.
A detailed instruction can be found at Custom Fonts in React Native for iOS & Android Builds
The last step was the key for me to make this work. Make sure you use the PostScript name of the font when adding fontFamily to your style.
I want to select "Custom" option from Attribute Inspector of WatchKit Interface for UILabel but its disabled.
Is Any one facing the same problem? Please give me direction if I am missing any thing;
I am using XCode Version 6.2 (6C131e)
The standard iOS fonts are only standard on iOS devices. They are not included on Apple Watch.
The documentation shows this list of all standard WatchKit font styles:
Note the phrase "none installed" in your screenshot.
If you want to use any other font, you'll need to install a custom font. From the WatchKit docs:
To use custom fonts, you must install those fonts by doing the following:
Include the custom font file in both your WatchKit app and your WatchKit extension bundle.
Add the UIAppFonts key to your WatchKit app’s Info.plist file, and use it to specify the fonts you added to the bundle. For more information about this key, see Information Property List Key Reference.
I'm making a simple Apple Watch app, using Objective-C, and I'm trying to use a custom font.
I have added the font to the info.plist, and also the supporting files folder. The font does work in the storyboard, but when I run the app in the simulator it's just the regular system font. Any ideas?
(I haven't used any code to set up the font)
Have you included the custom font file in both your WatchKit extension bundle and the WatchKit app bundle? The reason for this is you need to be able to create strings with the font at runtime (via the WatchKit extension), then the information is sent to Watch and the font from the WatchKit app's bundle is used to render the string on Watch.
Then it's simply a case of adding it to the UIAppFonts key in your Info.plist file as you mentioned.
Apple has documentation on using custom fonts, found here.
Hope this helps!
J
Im using custom font in my application and have run into very weird issue. The font is available on the simulator but unavailable on an actual iPad.
1 I'm not confusing font name and file name. The file name is bitdust2.ttf whereas font name is BitDustTwo and this is how i call it and on simulator it is ok.
2 The is not a question of case sensitivity. The font is really unavailable on the device. I know that cause when i do this:
NSLog(#"%#", [UIFont familyNames]);
i see that on simulator my font is included in the familyNames array, but is missing on the iPad. What's wrong? Did you ever encounter such an issue?
(From above comment:) Verify that the font file "bitdust2.ttf" has been added to the target and is copied into the application bundle.
The simulator is, as titled, a simulator, and not a true emulator. The simulator runs the same named APIs, but since the simulator runs on OS X, not iOS, the simulator often has more functionality. For example, the media player classes on the simulator support more types of files (codecs) than on the device because OS X supports more codecs than iOS. On the simulator, you have more Fonts available than on the device.
Here's more details about embedding fonts in an iOS app:
There is a simple way to use custom fonts in iOS 4.
Add your font file (for example, Chalkduster.ttf) to Resources folder of the project in XCode.
Open info.plist and add a new key called UIAppFonts. The type of this key should be array.
Add your custom font name to this array including extension (Chalkduster.ttf).
Now you can use [UIFont fontWithName:#"Chalkduster" size:16] in your application.
It's important not to miss any steps. If you're still having problems, go to the Build Phases tab of your project in XCode and under the Copy Bundle Resources tab, ensure that your font file is included. If not, add it.
Check your device OS version as well as its support for iOs versions. The custom font you used must be compatible with iOS of your device.
Check this answer out. May be you need to have alternate custom font in case it is not supported.
I just had this same problem and after verifying everything was correct:
Font is added to proper key in info.plist "Fonts provided by application"
Font is added to project -> info under same key as the info.plist (this just means that i saved the plist)
Font file is added to the project
Font file is in the project folder
Project -> target -> Build Phases -> Copy bundle resources: contains my font file
File is checked off for being associated with target
I had to download the file again and re-add it.. when i did the file name was changed ... so i think the .ttf file was corrupted
You'll need to embed the font onto the app; instructions are here.