0

My problem is, that when I add a font which is described here and when I want to retrieve the font family names with [UIFont familyNames] it crashes. I did it the same way described in the example, but for me it doesn't work.

This is my stack trace:

0x314b9ebe in CFDictionaryGetValue
0x33d79be4 in copy_localized_value
0x33d79bd4 in CGFontNameTableCopyRootName
0x33d796f2 in CGFontNameTableCreate
0x33d79e86 in CGFontCopyFamilyName
0x3414ca00 in AddFontsFromCGFontAndPath
0x3414cb7e in AddFontsFromURLOrPath
0x3414cc98 in Initialize
0x3414ce0a in GSFontCopyFamilyNames
0x323fce84 in +[UIFont familyNames]
...

I'm testing it on iOS 3.2.2 and because i don't want my iPad to be upgraded, I can't tell if it works on other iOS Versions

What am I doing wrong?

Community
  • 1
  • 1
NicTesla
  • 1,626
  • 5
  • 21
  • 35
  • Might be helpful if you post more of your code so we can take a closer look. – AustinRathe Jan 04 '12 at 13:43
  • I think, the problem is much more based on the configuration, than on source code. But to be clear, i do the same as described in this [Stack Overflow Question - Answere from jtbandes] (http://stackoverflow.com/questions/3350131/how-to-add-new-font-to-xcode-3-2). – NicTesla Jan 04 '12 at 13:59
  • When i remove the value Futura_extrabold.ttf from the array with the UIAppFonts it works pretty fine. – NicTesla Jan 04 '12 at 14:45
  • 1
    Are you sure your font file is valid and works? – Sherman Lo Jan 04 '12 at 15:31
  • When i use it on the iPad Simulator with iOS 4.3 and iOS 5.0 it also shows the fontfamily names but not the newly added fontname! It appears that the font "Futura condensed-extrabold" has gone, when i add the font. An other clue: I now added the font to the IB and tried to set it to a label. But when i select it, the selector automatically jumps to the first entry in the fontname list. Does that mean, that it is invalid? – NicTesla Jan 04 '12 at 16:03
  • @Sherman: You where right!! After using a different font, it worked and didn't crash anymore!! Could you please post it as an answer, so i can check it? Thx – NicTesla Jan 05 '12 at 07:24

1 Answers1

1

Are you sure your font file is valid and works?

Sherman Lo
  • 2,759
  • 20
  • 20
  • Mine was definatly corrupt somehow!! I tried it with an other ttf file and it worked. In addition: it might be possible, that the newly installed font file could override some existing font families. So for all those, how are facing the same problem, try to find a font file with its fontfamilies name the same as the font, you want to use, or create it your own with some font managing tools. – NicTesla Jan 05 '12 at 13:14