views:

614

answers:

4

Hi guys, I'm looking for the right textfield parameters or work-around for my latest problem here dealing with Flash fonts & text fields.

I have a textFormat and textField generation some text using the Font: Franklin Gothic Book point size 8. Currently this is how the font will look when I run the movie:

alt text

The bottom ®MYLOGO is a jpg from Photoshop, clean and how it should look. Next up is the font directly typed on the stage in Flash, and the very top ®MYLOGO is generated from my code.

What parameters am I missing to make the code generated copy look as close as possible to the Jpeg?

My Code below:

var tsFont = new TextFormat();
    tsFont.font = FranklinGothic;
    tsFont.size = 8;
    tsFont.color = 0xFFFFFF;
    tsFont.align = TextFormatAlign.LEFT;

var tsLogo:TextField = new TextField();
    tsLogo.defaultTextFormat = tsFont;
    tsLogo.selectable = false;
    tsLogo.mouseEnabled = false;
    tsLogo.x = 18;
    tsLogo.y = 98;
    tsLogo.width = 64;
    tsLogo.height = 16;
    tsLogo.text = "®MYLOGO";

    addChild(tsLogo);

You guys may remember this code from my last question X_x


FIXED WORKING CORE: thx to Andy Li

var tsFont = new TextFormat();
    tsFont.font = (new FranklinGothic() as Font).fontName;
    tsFont.size = 8;
    tsFont.color = 0xFFFFFF;
    tsFont.align = TextFormatAlign.LEFT;

var tsLogo:TextField = new TextField();
    tsLogo.selectable        = false;
    tsLogo.mouseEnabled      = false;
    tsLogo.embedFonts        = true;
    tsLogo.antiAliasType     = flash.text.AntiAliasType.NORMAL;
    tsLogo.gridFitType       = "pixel";
    tsLogo.sharpness         = 400
    tsLogo.x                 = 6;
    tsLogo.y                 = 5;
    tsLogo.width             = 600;
    tsLogo.height            = 40;
    tsLogo.text              = "®MYLOGO";
    tsLogo.setTextFormat(tsFont)

Graphic Examples:

NORMAL

alt text

ADVANCED

alt text

+2  A: 

Try to add this code:

tsLogo.antiAliasType = flash.text.AntiAliasType.NORMAL;

or

tsLogo.antiAliasType = flash.text.AntiAliasType.ADVANCED;

Riccardo Bartoli
hmm just tried both, still same result... starting to wonder if its something to do with the actual font Franklin Gothic
Leon
I just realized I have a different problem, emebedding fonts correctly, but your solutions does work for anti aliasing, thx!
Leon
+1  A: 

Yes make sure you check the Aliasing, but if that doesn't do it I would try calling:

tsLogo.setTextFormat(tsFont)

Right after you set the text. That function will apply the font to the text in the field.

resolveaswontfix
+2  A: 

Controlling text rendering in Flash is painful sometime...

You need to play around several properties: antiAliasType, gridFitType, sharpness, thickness of the TextField. Try Adobe's example. Or a even more detailed tutorial.

Andy Li
hey thx will be trying these out as well.. but just noticed something I increased my font size to 12 and 16 and I can tell it's not Franklin Gothic, but times and it looks much better at a size other then 8 hmm
Leon
Are you sure you embedded and using the embedded font?
Andy Li
I imported the font and gave it the class name: FranklinGothic, but I guess that's not all I have to do to embed it correct? :(
Leon
Try this: Change the line `tsFont.font = FranklinGothic;` to `tsFont.font = (new FranklinGothic() as Font).fontName;`. And then add `tsLogo.embedFonts = true;`.
Andy Li
Ah sweet that worked! My font's now FranklinGothic and the Aliasing works on it :D...
Leon
A: 

hmmmm, I don't get the fixed working core: when reading the Flash Docs on sharpness on TextFields, it states: "The sharpness of the glyph edges in this text field. This property applies only if the flash.text.AntiAliasType property of the text field is set to flash.text.AntiAliasType.ADVANCED."

in your fixed working core the flash.text.AntiAliasType property of the text field is set to flash.text.AntiAliasType.NORMAL still you alter the sharpness afterwards.

it makes no sense, does it?

felisan
Uhm, I just tested this and didn't notice any difference in the quality when I played with the sharpness value. I added some graphics to the original question however to demonstrate the big difference between NORMAL and ADVANCED.
Leon