Using Italics or Bold in text seems impossible... what am I missing?

I am sure I am missing something, but could use a pointer. I am testing this on the Conona Simulator #2011.591 (on Win 7), trying to use a custom font with italics or bold, but having no luck.

So here is the code:

[lua]tBox1 = display.newText(“Example A”, 0, 20, “Segoe UI”, 18)
tBox2 = display.newText(“Example B”, 0, 40, “Segoe UI Bold”, 18)
tBox3 = display.newText(“Example B”, 0, 60, “Segoe UI Italic”, 18)[/lua]

Simple enough. Line 1 prints what I want. Lines 2 and 3 don’t…

I get an error that the system could not load the bold or italic version of the font.

…lines 2 and 3 are set to use the “default” system font. Now then, I understand that I need to use the correct name to access my bold or italic version of the font. So I try to find that name… when I list my available fonts, I can see that I have a few variations of the Segoe font… “Segoe UI”, “Segoe UI Light”, “Segoe UI Symbol”, “Segoe Print”, etc…

However, I KNOW I have Segoe UI and it’s corresponding Bold and Italic fonts installed on my machine. And I know that the Corona Simulator is pulling it’s font list directly from the list of available fonts of my system. If it wasn’t, then it couldn’t get Segoe UI. I don’t include it in any other place in my little test app (not in config.lua, or build.settings and no copy of the segoeui.ttf in my main.lua folder) so it comes from my system, right?

In addition, I can look at the name of the font in Windows font previewer to get the names… but those are exactly the names I am currently using. So what gives?

How do I refer to the Italics or Bold variant of this font?

I’m about to sacrifice a goat to get the answer. Please help. Save a goat’s life. And my sanity. Thanks!
[import]uid: 10818 topic_id: 14979 reply_id: 314979[/import]

The goat got to go…

I mean save the goat, do not threaten goats or any other animals to get answers…

I *think* that the reason is simple, the fonts Bold and Italics are used to look into to render Italics and bold only if the app chose so, because you are creating a user font with normal settings, you are unable to use that font.

You almost need to create a boldFont and ItalicFont with the fontname to get it to use the Bold and Italic fonts.

Hope that makes sense to you, I was baaaadly traaaumaaatized due to the fact thaaaat you held a goaaaaat at knife point.
UPDATE: Like you have the systemFont and the systemFontBold (which is missing from the API page) there should be something to create a customFont and customFontBold and customFontItalics.
cheers,

?:slight_smile: [import]uid: 3826 topic_id: 14979 reply_id: 55275[/import]

Oz-

Thanks so much for the input. You can sleep well, knowing I have removed the goat from the sacrificial pentagram.

I’m hoping you can clarify a bit more for me…

So, from what I can tell, I have 4 different font files on my computer: “segoeui.ttf”, “segoeuib.ttf”, “segoeuii.ttf”, “segoeuiz.ttf”. Each one of those takes a different amount of disk space, and appear to be ‘pre-rendered’ versions of the Segoe UI font, in normal, bold, italic, and bold-italic styles respectively.

I am thinking it is just a matter of getting Corona to access the correct file. But you seem to be suggesting that Corona won’t do that. It will only access the ‘normal’ version, yes?

That being the case, perhaps I could “fool” Corona into thinking my “segoeuii.ttf” file (italics version) is a completely new font, yes? Let’s say I copied the “segoeuii.ttf” file and renamed it “slantySegoe.ttf”. And then if Corona loaded this “slantySegoe.ttf” font into its list of available fonts, I could access it.

Step #2:

But I’d need to know the name to access the font by… and I think I might need to be able to define that name in my “slantySegoe” font definition file so that it appears as a unique font.

If my above assumption is correct, any thoughts on step #2?

And if my understanding is incorrect… well, I’ll probably have to go get the goat again… or, well, just for you I’ll spare the goat and throw a pizza delivery boy on the altar :wink:

Thanks!

[import]uid: 10818 topic_id: 14979 reply_id: 55281[/import]

Thaaaanks for removing the goat, it nearly got me goat.

When you do sacrifice the pizza delivery boy, post a video online :wink:

But damn, I need to save him too, with another input…

Just changing the name of the font will not suffice. The font file name has nothing to do with the font name. The font name is embedded in the font file, so you will need a tool that helps you create/edit fonts. That way you can have bold fonts.

Now, I may be totally wrong about the fact that Corona cannot allow for the bold and italic fonts, maybe Eric or Tom or even Walter or someone might just jump in to clarify that Corona does allow for bold and italic fonts, that will be so nice, till then I stand my ground that it can’t be done :wink:

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 14979 reply_id: 55282[/import]

Okay. The pizza delivery guy is screaming for help, now. I’ve got the video camera set up, but I’ve told him I won’t do anything for a few days in the hopes that one of the big guns can give me a definitive answer on this one. (Don’t worry, in the mean time I will feed him the pizza so he doesn’t starve.)

I agree with you that changing the file name alone won’t help. I have to adjust the font name within the font definition file if this work-around is to have a shot. Knowing that, the final question boils down to this:

Can Corona render a font as bold or italic? Or are those variants embedded within the definition of the font itself, and Corona code is responsible for interpreting a font definition and converting it to bold, italic, etc.?

Oz says:“it must be handled by Corona or no go.”
I says:“it might just be a matter of getting the right file loaded.”
And the pizza delivery guy says:“Heeeeeeeeeeeelp!”

You hear that, Walter! There are lives at stake! :wink:

Thanks again, Oz!
[import]uid: 10818 topic_id: 14979 reply_id: 55289[/import]

Try to use a thick fat font and you will see that it works, so this font when changed has to be *not* the bold version, but the normal version of a thick font.

BTW, the name is Jayant, not OZ, OZ is just where I came to see the wizard when I was not in Kansas any more and found that Dorothy had left…

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 14979 reply_id: 55296[/import]

Jayant!

Ahh, I just kept looking at your logo for OzApps and it got stuck in a recursive function call in my head! Oi!

I know there are thick versions of segoe UI… such as the “Segoe UI Semibold” version. And I know that works. I’m looking to create a FontStyle class structure that manages the use of any font in normal, bold, italic, or bold-italic styling. If I am going to be able to do it, tho, now it looks like I need to somehow extract the font-styles for a particular font-face into uniquely named font files… (renaming them in the font file’s data structure, mind you, not just the font’s file name)

Sorry to hear about the Wizard and Dorothy and the two of them running off like that. Probably for the best. She had a real mean streak to her… always checking the locks on parked cars…

I’ll post again if I get this working…

-Dune

(I’m going to wait a few more days to release the delivery boy, tho, just in case.)

[import]uid: 10818 topic_id: 14979 reply_id: 55309[/import]

Hello guys,
I am having the same problem with another font, Sunday Comics. I need to use both the normal and bold versions of it, so I included those two files in the application.

If I call the font using the “SundayComicsBB” name, I get the regular version. If I call it using the “SundayComicsBB-Bold” name, I get the bold variant … but only in the Corona Simulator. I cannot make it work on the real device, or even the Xcode Simulator. The “SundayComicsBB-Bold” name is the system font name for the bold variant.

Any suggestions?
Thank you! [import]uid: 121401 topic_id: 14979 reply_id: 91553[/import]