I am trying to figure out why some letters (like the norwegian Å (Å)) are cutted out in the middle of the top "o":
My code is this:
var titleFormat:TextFormat = new TextFormat();
titleFormat.size = textSize;
// this is embedded font, and exported for action script, declared
titleFormat.font = myFontBold.fontName;
titleFormat.bold = true;
titleFormat.color = parseInt("0x"+fontColor,16);
var titleText:TextField = new TextField();
titleText.defaultTextFormat = titleFormat;
titleText.embedFonts = true;
titleText.antiAliasType = AntiAliasType.ADVANCED;
titleText.text = "Å"+text;
addChild(titleText);
titleText.selectable = false;
titleText.wordWrap = true;
titleText.width = maskImg.width - 80;
// this should autosize to fit all text, but it doesn't the top of text
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.x = x;
titleText.y = y;
So, i have tried different things like setting height hardcoded and bigger than text, but top us cutted again, i have tried with css but no success. Anyone has idea why the letter is not showed fully and why if i zoom in the swf (2-3 zoom ins) it shows up normal (and what i try to achieve) like this:
I think it has to do with the topMargin, but unfortunately i didn't find something like that in as3 documentation.
Not sure if this helps, but I tested the following complete, self contained code with the Verdana font, not embedded and it works fine. Perhaps the font you are embedding has a problem itself, or the embedding is causing a problem for some reason?
package {
import flash.display.MovieClip;
import flash.text.*;
public class TestText extends MovieClip {
public function TestText() {
var textSize = 20;
var titleFormat:TextFormat = new TextFormat();
titleFormat.size = textSize;
titleFormat.font = "Verdana";
titleFormat.color = 0xFF0000;
var titleText:TextField = new TextField();
titleText.defaultTextFormat = titleFormat;
titleText.text = "Åbcdefg";
titleText.backgroundColor = 0x000000;
titleText.background = true;
addChild(titleText);
titleText.autoSize = TextFieldAutoSize.LEFT;
titleText.selectable = false;
titleText.wordWrap = true;
titleText.width = 200;
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With