Cocos2d Font Extensions Issues - iphone

Good afternoon, sports!
I have a fast doubt.
I'm using COCOS2D and i need to know if i can use other extension type of font other than ".fnt".
Because i used a few and didn't have any luck.
I'm using this piece of code to make a "credits" scene:
CCBitmapFontAtlas* l_026 = [CCBitmapFontAtlas bitmapFontAtlasWithString:#"Look for our apps in the AppStore" fntFile:#"fission.fnt"];
If it isn't which can i use?
And it is do you know any font converter to change "normal fonts" to ".fnt"
Thanks!

The best font program in my opinion is: Glyph Designer. It is inexpensive and very easy to make great looking fonts.
I use CCLabelBMFont but I'm pretty sure it is basically the same thing.

If you have some cash to spend you can use Glyph Designer as suggested by Aaron. But you can also use a free Java tool named Hiero. You might have to do some tweaking to get the result you want though.
The tool will output 2 files: one .png and another .fnt. Add these files into your Xcode project and use it using simple lines like below:
CCLabelBMFont *some_label = [CCLabelBMFont labelWithString:#"Your Text" fntFile:#"fontfile.fnt"];
Do note though that the size of the font from each pair of fnt/png files is fixed, so you have to create multiple pairs if you want to have different font sizes. Also, you need separate pair for Retina and non-Retina display modes.

Related

Unity - Displaying Burmese (Zwagyi) text

We're currently developing a game in Unity (2019.4.28f1). This game is played internationally. We'd like to add support for languages other than common Latin written languages. Currently, we're trying to implement support for Burmese, but aren't making much progress.
Finding fonts to display Burmese isn't a big issue. As you can see in the image below, we manage to display all characters that are supposed to be displayed.
However, the big problem here is that the displayed order of symbols isn't the same as what it's supposed to be (see image below for the desired result).
We've tried several fonts that use either Unicode or Zwagyi encoding, but none of them seem to display characters in the correct order. Currently, we're using a padauk font from here, which is supposedly Unicode encoded. Then, within Unity, we applied to following settings to that font:
So, if one of you knows more about this and can share some information with me, that would be much appreciated!
Thanks.
We've already found a solution for this! Before setting the text of the text component convert the Unicode codes to Zwagyi and it'll display the text in the correct order!
All the credits go to this guy who put in the effort to make a tool for these use cases!
Of course, you still need a (Unicode) font that supports these (Burmese) symbols.
Example:
Text textComponent = GetComponent<Text>();
textComponent.text = mmfont.Net.Converter.Uni2ZG(yourUnicodeText);

How to load font from disk?

Is it possible to load a font from disk and use it during run-time?
If so, how/where do you store the fonts on the iphone/ipod/ipad for your app to use?
(To be clear, I'm not talking about adding the font as a resource at design-time. I'm asking about a way to allow a user to select a font file during run-time, loading it, and making it available for use.)
You should put them (.ttf, .otf) into your info-plist under UIAppFonts then you can "use" them with setFont: withSize:
You add your font as a resource, add it to your info.plist under Fonts provided by application (UIAppFonts) array, then use it as any embedded one.
Ok, in that case take a look at FontLabel project.
One thing though, looking through it's code - you can only get CGFontRef and with kind of voodoo work with it, no conversion between CGFontRef and UIFont really exists. See this question

Custom font doesn't work in interface builder!

I've downloaded a font that's called "aldo the apache (.tff) " from dafont.com.
I used it with different programms like adobe illustrator and it seemed to work just fine.
Recently i tried to use it in a game that i'm making to experement. It didn't work -_-.
IB was displaying the font as a slightly bigger version of arial.
How can i solve this problem and get the font to display correctly?
If you have any suggestions, please post them down below.
-DD
You have to edit your <appname>-Info.plist file and create a new UIAppFonts key with type array, where each element is a String with the name of your font file, in this case AldotheApache.ttf. Then use the name in IB or with UIFont as it shows in the application Font Book app of your Mac, in your case Aldo the Apache. Obviously the font should also be added as a resource of your project.

Best way to display barcodes from NSString

Just wondering what is the best way to display a barcode given a string on the iPhone. I have looked over stackoverflow and google and a few people have different ways each requiring a decent amount of work (I think) and also slightly old so I wanted to get it right first time.
One way I've read is using a custom font that you can now use in iOS4, using this font Someone else has written a class to import custom fonts, though this apparently isn't needed for iPads.
I have also found a Library but not much further details on it.
If using the font is the best way is the font linked above good or are there better ones?
Cheers for any help.
Well I went ahead and checked it out anyway. Fonts work extremely well and are very easy to implement. Basically copy this barcode font into your project. Then in your App info.plist type this in:
<key>UIAppFonts</key>
<array>
<string>3OF9_NEW.TTF</string>
</array>
For the above linked font.
Then in where you want to place the barcode just use a UILabel and then for the font use :
label.font = [UIFont fontWithName:#"3 of 9 Barcode" size:40];
Note that the font name is not 30F9_NEW.TTF. If you are using another barcode font or other font in general just open the ttf file in font book and it will say the name up the top of the window. Also you need to have a * at the beginning and end of the string you are using. If you navigated here looking at how to implement a custom font you can do it the same way, just not the font name isn't the file name.

Which iPhone system fonts can I use safely and which are recommended for what kind of display purpose?

Fonts are like a coin lost in the forrest: You're never sure where to look first. Had to say that ;-)
Ok, so the problem: I come from the web dev world and my mind is screwed up completely regarding fonts. There is a UIFont class that can be used to specify how text in a label should look like. Unfortunately it seems I have to know a lot of font secrets to use it properly. Does anyone know which kind of fonts I can specify and which are "safe to use"?
With safe to use I mean: Which ones are not dependent a lot on the language of the user, i.e. completely inavailable if the user has Chinese language active. Nor sure if that would be a different font, all those funny symbols and stuff. I want to use the font in a "tight graphical environment" where I have a design that's made to match that font. That would look like crap if in japan the font is italic style and in greece they see huge chunky and bold letters.
So which fonts would be best to use to avoid most of uglyness-problems arount internationalization and different devices?
Here are a list of available fonts for the iPhone OS.
Also, you can use the UIFont APIs systemFontOfSize:, boldSystemFontOfSize: and italicSystemFontOfSize: - any of which I would imagine will handle localization reasonably.
More UIFont documentation can be found here.