I want to include a vector font file instead of a .ttf file to my application (not Bitmap based).
Unfortunately, I do only see hints regarding an import of .ttf files. The common approach does not work for .svg.
Add Font file to build target
Add Key to Info.plist file: Fonts provided by application
Add each Font file to the array
Has anyone made experience with embedding a such in an iOS application or is aware, whether this feature even exists / is being about to be implemented?
Related
Hi I need to add extra icons to rocksolid icon sets. I follwed the instructions in https://rocksolidthemes.com/de/contao/blog/iconfont-anpassen-icons-hinzufuegen and successfully downloaded the new icon set and copied to the desired folder. But the new icons are not showing in the picker. I need to know whether the new icons were lost when the rocksolid is upgraded? If yes, what is the remedy for this? Can I add more than one icon files in the configuration?
But the new icons are not showing in the picker.
This is probably a caching problem. Please try to delete all browser cache after replacing the font files in the template directory. Further make sure the new font files have the same font names as the original files ("replace" the original files in the template font folder). You also have to update/replace the font css file as stated at the end of the linked article:
Roughly translated: "To see the new icons in Icon Picker copy the file style.css of the downloaded font packet to the font folder of your template and rename it to rocksolid-icons.css. Delete rocksolid-icons.html if this file exists."
I need to know whether the new icons were lost when the rocksolid is upgraded
The font files are part of the template and included in the template folder. So you should make a backup of the template folder before updating to a newer version of the used rocksolid template. After updating the rocksolid template you can again replace the font files and css within the template folder to get your own icons back in place...
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 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.
I would like to dynamically load all images in an xcassets directory. The files are named StockPhoto# where # is the number in the list. If I can access my StockPhotos.xcassets at runtime to count all the files in the directory, I won't have to manually load the files each time I add new stock photos.
If there are other solutions to this problem, I'm open to that but I'm also just very curious how xcassets are handled by the file system- whether they're just reference to a set of files, or actually their own directory. Information on this is sparse.
If there are other solutions to this problem, I'm open to that
The problem is that there is no introspection at runtime into an asset catalog: it isn't a "thing" you can "see" as far as Objective-C and Cocoa Touch are concerned.
The usual solution to this kind of problem is to drag a folder full of images into your project at the outset, and when you do, choose "Create folder references for any added folders" in the dialog - not "Create groups for any added folders". The result is that the folder is copied into your app bundle, and now you can use ordinary file system methods to say "every file in this folder".
Upon compilation of your iOS project, xcassets are compiled to produce either image files, or a proprietary .car file. In that latter case images won't be stored in a directory you can browse.
If your "Deployment Target" is less that iOS7 (meaning that your app would still be able to run on iOS6)
It will produces the same set of image files that you would have had to produce without using Assets Catalog, namely <YourImageName>.png, <YourImageName>#2x.png, <YourImageName>~ipad.png, <YourImageName>~ipad#2x.png and so on, for each image set of your xcassets.
If your "Deployment Target" is iOS7 or greater (meaning that your app would only be able to run on iOS7+)
It will produce a single big .car file in the final bundle (I don't really looked up if this file was actually an sqlite3 datatbase or some proprietary format or whatnot, but who cares, you are not supposed to manipulate it anyway). This big .car file contains all the images, with all their provided variants, and even with slicing info (if you did slice some of them for tiling or to use them as 9-patch images using the tool provided for that in the Assets Catalog editor)
Whatever the produced result you shouldn't / are not supposed to dig into internal details of your bundle like that. The format of the .car file may even change from one iOS version to another (who knows? that's internal details after all which we shouldn't have to deal with) so don't base your logic on it.
[EDIT]: If you need to be sure to have a directory with your set of images at the end of the compilation, you could instead use a folder reference (referencing a real folder in the Finder, as opposed to an Xcode "group" as only group files in Xcode's Project Navigator) then use code to browse it. But then you will have to deal with other details, like only browse files that match the current device (iPhone vs. iPad, non-retina vs. retina…), so this would only shift the problem further in your case; you really should use a constant somewhere to declare the number of images (or put this in some PLIST file for example) and iterate thru them.
As the files you provide at compile time will be in your Bundle — which cannot be altered once compiled as it is digitally signed — the number of images will never changed once the app is compiled anyway. (That's not like if you used the Documents directory and enabled iTunes File Sharing or whatever, letting the user add images himself ;-))
If you're targeting iOS 7+ then no. Xcode will package the files into a proprietary format (.car) that you can't access directly.
Either use imageNamed: methods, or don't use Image Catalogs for the files you need to access directly.
as #AliSoftware suggests you can store all assets images to plist and access them later for more details see here
I have added custom fonts to my resources and bundle resources and also to my plist. Everything works fine in iOS5 but when I try the iOS 4.3 simulator, none of the custom fonts work.
Any idea why?
Here is a sample of how I am accessing the fonts:
lblWait.font = [UIFont fontWithName:#"AvenirNextLTPro-Medium" size:22];
The names in that NSString in the first parameter have to be spot on and what's weird is that it's not consistent. It depends on if it's a .otf file or a .ttf file. I've found that a .otf file uses the postscript name and .ttf uses the full name. A good way to find these is to open the font file in Font Book and find it's information (cmd-I). I would try either to see what sticks.
Edit:
It's not always that the TTF uses the FULLNAME and the OTF uses the POSTSCRIPT name, you should try both.
Many times the source of this problem is that the font file is added to the project but not to the target.
Click on the font and make sure it's ticked in "Target Membership", in the right hand column.