Hello Guest

Author Topic: Two Font Sizes not Working  (Read 6425 times)

hheeb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Two Font Sizes not Working
« on: February 17, 2016, 09:29:00 am »
I created a font in 2D toolkit from bitmaps in two sizes.

The first font I created works on all iOS and Android devices I tried. The second (smaller) font does not work on older iOS devices (it works fine on Android and new iOS devices). I am pretty sure that I created the fonts in the exact same way.

See the screenshot from an iPhone6 and an iPhone4s

Any pointer why this could happen is highly appreciated.

Kind regards
Hans

oug

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Two Font Sizes not Working
« Reply #1 on: February 19, 2016, 09:05:54 am »
Are you using platform support (4x 2x 1x)?

hheeb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Two Font Sizes not Working
« Reply #2 on: February 20, 2016, 03:31:42 pm »
No, not using platform support.

Ortho camera and resolution is set to iPad portrait (768 x 1024). All images and fonts were made for this resolution.

oug

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Two Font Sizes not Working
« Reply #3 on: February 22, 2016, 08:49:14 am »
Does it work with a different font (let's say Arial)?
What program do you use to create the font-atlasses?

hheeb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Two Font Sizes not Working
« Reply #4 on: February 22, 2016, 09:07:36 am »
I don't think the font bitmaps are the issue, but I will verify tonight. After all it works fine almost everywhere.

I attached the font data below.

I used BMFont to generate them.

hheeb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Two Font Sizes not Working
« Reply #5 on: February 22, 2016, 07:38:51 pm »
An update: I tried a new project with a different font, same sizes (76 and 96).

This time I created the 76 font first and tried it alone: it failed in the same way, i.e. on the older iOS devices! 96 later worked, as in the last example. So the title is wrong: some fonts are not working on old Apple devices, even by themselves (new devices were again ok).

Examining the fonts I saw that the bitmaps of the 76 fonts have a somewhat non-standard size: 512 x 768 (the bitmap for the 96 font is a more standard 1024 x 512). Could this be a problem?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Two Font Sizes not Working
« Reply #6 on: February 23, 2016, 09:17:27 pm »
Is your font texture set to uncompressed or compressed? There are restrictions on sizes on some old iOS devices (can't remember them off the top of my head) but Unity doesn't warn and silently fails on some configs. It almost certainly is because of the size - some sizes aren't supported at certain bit depths on certain devices (phew, that was a mouthful)

hheeb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Two Font Sizes not Working
« Reply #7 on: February 23, 2016, 09:27:44 pm »
OK, thanks. They are compressed.

A bit surprising that the smaller font fails, if it is the size, but let me test some more in this direction.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Two Font Sizes not Working
« Reply #8 on: February 23, 2016, 09:31:29 pm »
It will be the size. Try uncompressed

hheeb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Two Font Sizes not Working
« Reply #9 on: February 24, 2016, 11:56:19 am »
Yes!! It was the size. Just trying uncompressed did not work.

But when I recreated all font bitmaps in a known good size (1024 x 512), imported into Unity again (uncompressed, no filter) and created new fonts it worked. Thanks!

If anybody has a pointer to the legal bitmap size I would appreciate, because the 1024 x 512 is wasteful for small fonts. 2 : 1 ratio? multiples of 512?