Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Use custom font for label?

Okay, I've followed all of the steps I could find for this:

  • Converted my font to OpenType (.otf)
  • Copied the font file to the 'Resources' directory
  • Added the following code the the 'info.plist.template' file in 'Resources/iphone' directory:
    <key>UIAppFonts</key>
    <array>
      <string>HelveticaCondensedBold.otf</string>
    </array>
    
  • Set the fontFamily property for my label with this code:
    var makeLabel = Ti.UI.createLabel({
      font:{fontFamily:"HelveticaCondensedBold",fontSize:60},
      color:"#2d2e2f",
      top:0,
      right:60,
      textAlign:"right",
      text:"2009 VOLKSWAGEN"
    });
    

But it doesn't work. The label just displays in the default font. Any ideas why?

— asked June 6th 2010 by Bill Labus
  • custom
  • font
  • label
5 Comments
  • exactly the same for me. No answers?

    — commented June 10th 2010 by Klaus Heyne
  • Really, nobody has any input on this? Seems like this would be something anyone making apps would need to be able to do.

    — commented July 6th 2010 by Phillip Williams
  • I'm having the same problem. Anyone get this figured out? I'm using the 4.0 SDK with Titanium 1.3.2 and it's still not working.

    — commented July 13th 2010 by Clifton Labrum
  • I posted this bug to the Titanium Mobile bug tracking tool.

    I assigned it to Jeff Haynie at Appcelerator, so hopefully we'll see a fix soon.

    — commented July 21st 2010 by Clifton Labrum
  • The guy promptly marked it as invalid.

    — commented July 29th 2010 by Caio Iglesias

12 Answers

  • On the bug report for this, Jeff Haynie from Appcelerator posted an update to the blog post where he introduced custom fonts.

    Supposedly if you copy your info.plist from:

    /YourAppRoot/build/iphone/info.plist
    

    to:

    /YourAppRoot/info.plist
    

    …it will work. Unfortunately I still can't get it to work even after doing this. Can anyone pull it off with that tip?

    — answered July 21st 2010 by Clifton Labrum
    permalink
    0 Comments
  • This thread here worked for me:
    http://developer.appcelerator.com/question/49151/custom-font-solution

    Apparently you'll have to delete the contents in your build folder, and do a complete rebuild

    — answered January 25th 2011 by Marshall Jones
    permalink
    0 Comments
  • I got it working using this dirty workaround

    — answered July 29th 2010 by Caio Iglesias
    permalink
    0 Comments
  • I got this working

    — answered August 3rd 2010 by Rafael Hernandez
    permalink
    1 Comment
    • rhis works but make sure your font file has estension in lower case (.otf and not .OTF)

      — commented February 17th 2011 by Enrico Luciano
  • i get the same thing man. No idea. Super frustrating!

    — answered June 16th 2010 by scott l
    permalink
    0 Comments
  • Yep, and this (and many other issues) is why I would never in a million years consider paying for their outrageously priced professional subscriptions. Get the free version working first before you start trying to charge people. I've yet to be able to write a single working app with Titanium, since no matter what, I eventually run into some crippling bug, limitation or deficiency.

    — answered June 16th 2010 by Bill Labus
    permalink
    0 Comments
  • Just wanted to chime in since I'm having the same issue. I followed the instructions here, which it looks like you did also, and it doesn't work.

    — answered July 5th 2010 by Sean Stevens
    permalink
    0 Comments
  • — answered July 19th 2010 by Paul Dowsett
    permalink
    0 Comments
  • — answered July 19th 2010 by Paul Dowsett
    permalink
    0 Comments
  • I have to say, while I admire what the Ti guys are trying to achieve, they need to concentrate on fixing the bugs in existing features and ensuring that basic functionality (such as the one raised in this thread) is provided before embarking on new complex features.

    — answered July 19th 2010 by Paul Dowsett
    permalink
    1 Comment
    • Sorry for all the duplicates

      — commented November 4th 2010 by Paul Dowsett
  • Having to bail on this issue for now, hope it can be addressed before i have to use images for a timer. :S

    Help!

    — answered July 25th 2010 by Juan Bermudez
    permalink
    0 Comments
  • make sure your font file has estension in lower case (.otf and not .OTF)

    — answered February 17th 2011 by Enrico Luciano
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.