I'm trying to add a downloaded font to Xcode and I've folowed every single step based on this link: http://codewithchris.com/common-mistakes-with-adding-custom-fonts-to-your-ios-app/
I added the font to my Xcode Project,
included it in Copy Bundle Resources (Build Phases),
and typed it in Fonts Provided by Application (in Info.plist).
Then I typed this in GameScene.swift inside didMoveToView
It has worked with other fonts but not with this one. This is really frustrating me and I've got no idea what the problem is, thanks.
The name of the font is not always the name of the file. Try looking for the file and then opening in. It should automatically pull it up in font book, and the name of the font is located on the top bar. Simply enter that instead of the file name and it should work.
Related
I'm having trouble adding a custom front on my IOS project on Xcode 9...
I tried everything proposed on this toppic: Xcode 9 custom fonts not working
but nothing worked out.
On my project, I got my FugazOne-Regular.ttf file, his target membership is set to my app. My Info.plist has Front provided by application and Item 0 is set to FugazOne-Regular.ttf. FugazOne-Regular.ttf is also in Copy bundle resources, in Build phases.
If I try to print every font name with something like this:
for family in UIFont.familyNames.sorted() {
let names = UIFont.fontNames(forFamilyName: family)
print("Family: \(family) Font names: \(names)")
}
I can see all the defaults fonts but no FugazOne-Regular or anything similar,
I tried deleting the font, cleaning the project but nothing changed...
(it is my first time posting here so tell me if I am doing anything wrong)
UPDATE: I thing this might be an Xcode bug, I'm using Xcode 9.4.1 but un macOS Mojave.
Repeat the following steps:
Import the font to the project by dragging it to Xcode and check Copy items if needed and your desired targets
Add into your .plist file (careful with spelling)
Drag the imported font from the project inside Xcode, NOT from Finder into Build Phases > Copy Bundle Resources
I added a custom font called "Quicksand_Dash.otf", "Quicksand-Bold.otf" to an iOS project. I can see it in Interface builder but can't see when I list fonts in code.
"Fonts provided by application" and relevant name added to plist file.
I checked If font file is in copy bundle resources.
How I list the font;
for family in UIFont.familyNames {
let sName: String = family as String
print("family: \(sName)")
for name in UIFont.fontNames(forFamilyName: sName) {
print("name: \(name as String)")
}
}
I checked probably every answer in stack overflow but I think I have a different problem.
How To Use Custom Fonts in iPhone SDK
Custom Fonts Not Working
EDIT: If I add a label in storyboard and make its font Quicksand. Font is also listed in code. However, I don't wanna user storyboard. I'm creating controllers in code.
EDIT2: If I delete label in storyboard. It started to not seen again.
This is the same problem I'm facing but I applied the solutions in that post already;
Custom Font only available in Interface Builder
You're going to kick yourself...
In your plist info file, you have:
`Quicksand-Dash.otf`
but the file you added is named:
`Quicksand_Dash.otf`
underscore not hyphen
Either rename your file, or edit the plist entry, and you'll see your font.
Debug console output:
family: Quicksand
name: Quicksand-BoldItalic
name: QuicksandDash-Regular
name: Quicksand-Bold
Here is a plain single-view project that works fine for me - on both Simulator and Device. (I have not added the fonts to OS X, only to my project):
https://github.com/DonMag/Quicksand
Just for setup reference:
I also stuck to this issue and given solutions don't work for me. In my case ttf file's "Target Membership" block is uncheck. So when I click on it, the respected ttf font listed in font family list.
Happy Coding!!
From reference of #Donmag answer. I download his example project from GitHub and copy fonts from his project to my project then copy "Fonts provided by application" area from plist to my plist. Interestingly, It copied as "UIAppFonts". However, It started to work now.
To use custom fonts in application
Add fonts to your project folder
add it in plist file
check if its added in copy bundle resource
add font to your font book
Check the below link for more reference.
https://stackoverflow.com/a/28843547/9332509
i am trying to include a custom font into my project but i just cannot appear to do that. I was able to do it in my pervious projects without a problem.
First of all, when i include a font in to xCode project it appears like this:
I have tried alots of things, and I know the guidelines when adding a new font,I have read a lot of articles like this (Common Mistakes With Adding Custom Fonts to Your iOS App) and done that several times with success, but now it just wont work.
Fonts are included in the project, they are in copy bundle resources and in the .plist file.
Also I have tried cleaning the project, deleting derivated data, I actually created the whole project from scratch, with no success...
xCode version is 6.4
Font in question is Roboto but i couldn't include any other.
Font type is .ttf but i have tried with .otf also.
Any help here?
Does your project name have any special characters in the name? That can cause problems. E.g. question marks...
I am looking to change those two info in XCode showing in the simulator when the App is installed.
Do you know where I should look for (see attached screenshot), the name and the copyright.
I already tried to change the bundle name and target without success.
There's a file called LaunchScreen.xib in your project. It is automatically created as part of the project template, and it shows the name of the project (at the time of creation - that's why you had no luck changing the settings) and the organization name.
You can customize this screen as you wish (e.g. show a logo), or get rid of it altogether - then you need to provide the good old 'Default*.png' files, and indicate in the Project settings that you don't want to use a Launch Screen File.
I am attempting to make a TTF font file available to my main application and also in my photo editing extension. But the font isn't found when I attempt to access it by name in the extension, although it works in the main app.
I've selected the TTF file and in the File inspector I've checked AppName and AppNameExtension to add them both targets. I ensured the font shows up in Extension > Build Phase > Copy Bundle Resources. The font name and extension exists as the first index of an array for the “Fonts provided by application” in the extension's Info.plist. And I am calling it in code by its proper name. Again, it is working in the main app but not the extension.
Did I do something wrong in order for that resource to be available in the extension, is this not possible in the extension, or is this a bug I should report?
It seems you have everything correct and it is possible I had some issues trying to get it to work as well but it turned out I had thoughtlessly selected the font I wanted to use in Interface Builder before I created the "new" font for the extension and it seemed to be trying to reference the font in the container app, I removed that reference and set it programmatically.
You have to be a little more careful debugging with iOS extensions as Xcode doesn't seem to be as "helpful" as it is in the container app in regards to debugging messages, at least in my opinion currently.