Bitmap font not working on Android?

I wanted to use bitmap font. I followed example from here:
https://github.com/mono/CocosSharp/wiki/Labels#cclabel

label = new CCLabel("Hello CocosSharp", "Fonts/bitmapFontTest.fnt");

I used test font from CocosSharp samples. It is working fine on Windows Phone, but on Android I just see white rectangles like on the screenshot. Should I do something else for Android to make it work? I'm using CocosSharp 1.7.1.

Answers

  • BenLevy.4265BenLevy.4265 USMember ✭✭

    I use SpriteFonts, so this may not be of help, but seeing as there are very few "Answers" on this form, I will do my best.

    Here are some things to try with the BitMapFont.

    1) Make sure your Font resource is in "Assets/Content/Fonts" in your Android Project.
    2) Do not use the file extension, just the file name (ie bitmapFontTest)
    3) Make sure the font file has a build action of "AndroidAsset" in the Android Project (Also "Do not copy").
    4) Specify CCLabelFormat.BitMapFont as the format.

    What does work if you want is SpriteFonts. This however will require you to compile them with the MonoGame Pipeline. You are going to need to use this anyway at some point.

  • Thanks for your help! There is indeed very little activity.

    As for SpriteFonts, I already used them too and they work fine. I wanted to use BitmapFonts though, because they are more flexible - I can add gradients, outline, shadow, etc. I can't do that with SpriteFonts.

    I also went through your list and tried things that you suggested, but unfortunately nothing helped.

Sign In or Register to comment.