Can load custom font, but not bold version

I have a font on my Windows 7 machine called "CreativeBlock BB". When I check it in the Windows fonts directory it shows as one font, but when I copy it I get two files, CREABBRG.TTF (regular) and CREABBB.TTF (the bold version).

I need the bold version in my app, but when testing this in the simulator I can only load the regular, non-bold version using display.newText('', x, y, 'CreativeBlock BB', fontSize). How do I reference the bold version? I tried the obvious, like adding Bold, -Bold etc., but always get

"Warning: could not load font CreativeBlock BBBold. Using default font."

Thanks for any help! For what it's worth, finally it's supposed to be an iPhone app, not an Android app, I'm just using Windows for development.

You just reference the both (bold and non bold) in your build.settings and initialize the proper one when you want to display bold / non bold characters:

build.settings

.....
UIAppFonts =
{
"CREABBRG.TTF",
"CREABBB.TTF"
},
.....

Then check the font names in a Windows software that displays that, equivalent to the Font Book on the Mac. The two fonts have for sure different names. Then initialize your text with the right font name:

display.newText('', x, y, 'CreativeBlock BB Bold', fontSize)

or

display.newText('', x, y, 'CreativeBlock BB Regular', fontSize)

Alex.

Alex, thanks for the help. I still can't get it to work. And for starters, shouldn't the Bold version of this font be listed when I use

1
2
3
4
local fonts = native.getFontNames()
for i, font in ipairs(fonts) do
    print(font)
end

Just downloaded it on my drive. The two fonts are called identically. That's why you won't get the bold one in the font list.

Just tried also on my Mac to create a paragraph using only the bold font. It works.

Could you send a pastebin of your build.settings and then the code you use to create the paragraph?

Did you set a different font color than the background? (silly question, but a black on black text won't be visible :)).

Alex

Thanks again for following up.

Well, I tried it in the Mac simulator now, and all works fine!
So for better or worse, this seems to be a Windows simulator problem.
On the Mac, I was able to use the obvious font name, 'CreativeBlock BB Bold', and things show up as expected...

Unfortunately i only have Macs, so i cannot follow that on Windows...

A.

views:1984 update:2011/9/29 19:21:19
corona forums © 2003-2011