Skip to main content
Participant
March 18, 2014
Question

Truncation letter in TextField with tags i b et arial font

  • March 18, 2014
  • 1 reply
  • 377 views

Hi,

I created a textfield, I used :

  • htmlText with tags b and i,
  • a style with Arial font.

Some lettters truncated.

If i used Verdana font, i have not problem

My code :

var _texteBox:TextField=new TextField();

   _texteBox.name="txt";

   _texteBox.type = TextFieldType.DYNAMIC;

   _texteBox.background = false; // pas de background

    _texteBox.border = false; // pas de bordure

   _texteBox.condenseWhite = true; // on ne supprime pas les espaces blanc, saut de ligne...

   _texteBox.selectable = false; // non selectionable

   _texteBox.multiline = true; // plusieurs lignes

   _texteBox.wordWrap = false;

   _texteBox.autoSize = TextFieldAutoSize.LEFT;

   _texteBox.styleSheet = StyleManager.Instance.css;

   _texteBox.htmlText = myTexte

    // on passe en dynamique

    _texteBox.wordWrap = true;

    _texteBox.width = largeurMax;

htmlText (variable myTexte) contains :

<b><i>azertyuiopqsdfghjklmwxcvbn</i></b> not truncate<br/>

<b><i>d</i></b> d truncate<br/>

<b><i>i</i></b> i truncate<br/>

<b><i>i d</i></b> d truncate<br/>

<b><i>d i</i></b> i truncate<br/>

<b><i>d i</i></b>r  i truncate<br/>

My style :

.intitule{

font-family: Arial, Helvetica, sans-serif;

}

Thanks for helpful

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
March 18, 2014

you need to embed your fonts and one solution is:

to use stylesheets. using fonts exported for actionscript with the class names used below, the following works.

var ss: StyleSheet = new StyleSheet();

var bold: Object = new Object();

bold.fontWeight = "bold";

bold.fontFamily = new VerdanaBold().fontName;

bold.color = "#FF0000";

var ital: Object = new Object();

ital.fontStyle = "italic";

ital.fontFamily = new VerdanaItalic().fontName;

var reg: Object = new Object();

reg.fontFamily = new VerdanaReg().fontName;

ss.setStyle(".bold", bold);

ss.setStyle(".ital", ital);

ss.setStyle(".reg", reg);

var tf: TextField = new TextField();

tf.rotation = 3;

tf.width = 500;

tf.embedFonts = true;

tf.styleSheet = ss;

addChild(tf);

tf.htmlText = "<span class='bold'>This is bold text.</span><span class='ital'> This is italic.</span><span class='reg'> This is regular text.</span>";

snopims_Author
Participant
March 18, 2014

It's very complicated for a concept will be naitve

i don't understand, why Flash have this bug.

I think that i must change the font : arial to verdana because with verdana, i've not a problem.