My App will be used on iOS, I have Windows and Android versions, but I am not too concerned with getting the custom font to work for those platforms. Mainly IOS.
I know how to add the .ttf file to my Resources folder, and set it to Copy Always, I also update the IOS file info.plist and add a string array with name 'Fonts provided by application' and value 'Cardinal.ttf'
What I am not clear on is how to call the Font Family in my Cross Platform code. I know I do something like
labelName.Font = UI.Font( "Cardinal" )
However this will not work in Cross Platform because the UI namespace is not available.
Any help here?
Something with Device.OnPlatform( ...
Thanks to #Gusman above! You simply specify the FontFamily as a string with the value of the Font name. As long as you added the ttf file to resources and updated the info.plist file correctly, it will load the Font on App startup and the call to
FontFamily="Cardinal"
will work fine. Cheers!!!
Related
I use a third-party SDK in my iOS app which requires me to define the fonts I wish to use in a pre-defined .plist file. I have been using Lato-Regular all throughout the app but it seems I cannot use the same in a property list file for some reason. Is there any to achieve this?
P.S. I have checked and rechecked for the name of the font so that's not the problem.
I am wanting to use Helvetica Neue Ultra Light in my Watchkit app. I have followed all of the instructions for adding a custom font (added to Extension bundle and added in Info.plist for Extension and Watchkit app), but NOTHING is working and it will never get used.
Really strange thing is, other ttf fonts that I have added DO work, it seems to just be some strange issue with Helvetica.
Where is Helvetica, and why can't I add it?
Edit: To clear things up and prevent what people think might be obvious answers.
Watchkit only includes the system font (San Francisco), it doesn't
expose all of the fonts that iOS has. (Ref:
devforums.apple.com/message/1096179#1096179) THIS is why I am trying
to include Helvetica.
Option 1
I had the same issue. I fixed it by including the - character between the font name and the name of its weight. In some ways, Xcode could recognize the font.
Try changing HelveticaNeueUltraLight.ttf into HelveticaNeue-UltraLight.ttf wherever possible (info.plist file and in the project folder).
Option 2
Open up the FontBook that comes included within your Mac. Install the font if you haven't already and look closely at the PostScript name of the font. If it differs from the name you are currently using in Xcode, then change it.
Option 3
If you can't still get this working, download the same font from another source.
Our application has support for multiple region and languages. When I develop today extensions widget and read App Extension Programming Guide, I still can't find a localize solution. Even if I created the Localize.strings file like a normal Xcode project, define Localize.strings file like:
"scene_people_liked"="%d people like";
use :
#define NSLocalizedString(key, comment) \
[[NSBundle bundleWithPath:moLocalizedPath] localizedStringForKey:(key) value:#"" table:#"Localizable"]
and call it with:
NSLocalizedString(#"scene_people_liked", nil)
, it still does't work. Anyone has an idea about this problem?
Check that your TodayWidget target has the Localizable.strings files in the target membership.
take some time i has been resolved this problem.
if you want localize your today extensions widget, actually it was does't have any different step with do it in a normal project.
but it has litter problem about "Localize.strings" file name, you must have use "Localize" to named "Localize.strings" file in the normal project。localize should be work,but if you use it same name as main application or use some "InfoPlist.String" keyword,
even if test everything fine when you debug your project ,but when you package it up and install device, you will find out the localize can't get the value, so you must define a customer name without "Localize.strings" or some keywords.
:)
Following the instructions here, I'm trying to use custom fonts on my game. The custom font works okay in iOS device but not on the android device I'm testing on. I've made sure to include the font file (.ttf) on my project folder and I'm using this to set the font:
if(system.getInfo("platformName") == "Android") then
label = display.newText("text", 100, 100, customfonthere, 38)
end
However, when I run the game on the device, the custom font doesn't work. Is there something I might be missing here? I've also tried the font name with and without the file extension.
UPDATE: Actually, never mind. I guess my font file was damaged somehow. I just deleted it on the project folder and copied it from one of my backup files.
For everyone else who encounter problems with using custom fonts in Corona, try deleting the font file and redownloading it from wherever you got the font file or if you have a backup of the font file somewhere, just copy it back to your project folder. My font file was damaged so when I deleted it and added it again, it worked.
Follow the instructions from here. If the font doesn't show on your simulator, don't panic like I did. It simply means the font isn't installed in your workstation but rest assured, it will work on the device.
Then just use the font like you would use any system fonts in corona. You don't have to put the file extension (ttf or otf) for android devices. At least that's how it is for mine.
I want to use fonts in my app that I've downloaded from my server. I may have a font at some point that I haven't bundled with the app but I want to use; is there a way to download it (well, that's the easy part) and then load it and use it in a view?
It is an old question, but things are changed. The answer is yes since iOS 6.
Here is Apple's example:
https://developer.apple.com/Library/ios/samplecode/DownloadFont/Introduction/Intro.html
You have to "notify" your app about which fonts you intend to use by adding them to the "Fonts Provided By Application" entry in your info.plist file. It is bad practice and for all intents-and-purposes wrong to edit this file at run time. Thus, all fonts that your app will use need to bundled with it at compile time and shipped along with the application.
No, fonts have to be in your application bundle and registered with your Info.plist at compile-time.
If you really wanted to use a font that you downloaded, you could try converting it to a series of images and compositing them together, but that would be pretty hacky.