Author Topic: Gahhh!... Textured Fonts  (Read 4090 times)

Guidez

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Gahhh!... Textured Fonts
« on: February 20, 2014, 12:29:50 PM »
I've been beating my head against a wall for days with this. Research, videos, everything! I just can't seem to figure it out.

I want to be able to use textured fonts in my games. GUI and fonts are such a core piece to any game, I don't understand why it's the hardest part of Unity3D (my opinion of course). Could someone send me in the correct direction of how to use NGUI or even the regular tools in Unity to create a custom textured font? I'm at my wits end with this one.  :-\

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Gahhh!... Textured Fonts
« Reply #1 on: February 21, 2014, 03:37:17 PM »
I believe I create a bitmap font at the beginning of an older video -- http://www.youtube.com/watch?v=OT0hTxjjkY4

Guidez

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Gahhh!... Textured Fonts
« Reply #2 on: February 21, 2014, 03:52:20 PM »
I believe I create a bitmap font at the beginning of an older video -- http://www.youtube.com/watch?v=OT0hTxjjkY4

You make a dynamic font, but that video nor any other video I find does what I want. Essentially, I'd want to be able to create a custom textured font in Photoshop, then use that font in game, complete with all its little extra touches. For example, I have these numbers I've made in photoshop:



I want to make a custom font that reference's the number in the picture, and retains the border and color. I'd use Font Setter - Packer (https://www.assetstore.unity3d.com/#/content/6594) , but it's currently broken for Unity 4.3

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Gahhh!... Textured Fonts
« Reply #3 on: February 21, 2014, 04:10:54 PM »
Yeah this is not a bitmap font. It's not even a font per say. You're basically just trying to pull sprites from a pre-existing atlas. So stick to just that. Each digit is a separate sprite. Create an atlas, add those sprites to it. Use UISprite to draw them.

Either that, or take the much more difficult approach of creating a custom bitmap font -- but there are no tutorials or tools for that. Examine the FNT/TXT file exported by BMFont for an example on how to define each glyph's position:
  1. info face="Arimo" size=20 bold=1 italic=0 charset="" unicode=1 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=1,1 outline=0
  2. common lineHeight=20 base=16 scaleW=256 scaleH=256 pages=1 packed=0 alphaChnl=0 redChnl=4 greenChnl=4 blueChnl=4
  3. page id=0 file="Arimo20.tga"
  4. chars count=191
  5. char id=32   x=252   y=31    width=1     height=1     xoffset=0     yoffset=16    xadvance=5     page=0  chnl=15
  6. char id=33   x=250   y=74    width=3     height=12    xoffset=1     yoffset=4     xadvance=5     page=0  chnl=15
  7. char id=34   x=163   y=101   width=7     height=4     xoffset=1     yoffset=4     xadvance=9     page=0  chnl=15
  8. char id=35   x=0     y=91    width=10    height=12    xoffset=0     yoffset=4     xadvance=10    page=0  chnl=15
  9. ...etc

Guidez

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Re: Gahhh!... Textured Fonts
« Reply #4 on: February 21, 2014, 04:12:56 PM »
Thank you for your help.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Gahhh!... Textured Fonts
« Reply #5 on: February 23, 2014, 01:31:44 AM »
The ez and hackish way to do it, is to use BM font to output a font file about what you want, and then just drawing your own on top of the positions that it outputs.