Skip to main content
Daniel_Bunte
Participant
Jul 8, 2011 12:06 PM UTC
Question

faking bold and italic styles

hi there,

i hope this is the right forum, since i'm only talking about the FTE rather than the TLF

atm. i work with the FTE to create text from html. in my application, the font can be set dynamically, so i don't always know, if the requested styles like bold/italic are available, but i always want the text to appear like it is formatted with html tags like <em>,<strong>.

i check the availablity with FontDescription.isFontCompatible() - this is where the journey begins. what should i do if the requested style isn't available?

e.g. i use tahoma and have regular and bold embedded, but there's no italic nor bold-italic style available. i can of course force using _sans, but this really gives crappy results.

is there an easy and natively available way to fake bold/italic, or do i have to stretch/skew the text on my own to fake the styles?

thanks in advance!

best regards,

daniel

This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Adobe Employee
Jul 11, 2011 7:29 AM UTC

You can map your font as the one you like and set the other attributes, when you find it is not compatible.

For example,

        function myFontMapper(fd:FontDescription):void
        {
            if (fd.fontName == "Arial Black")
            {
                fd.fontName = "Arial";
                fd.fontWeight = FontWeight.BOLD;
            }
        }

Translate