Sie sind nicht angemeldet.

1

Samstag, 28. April 2018, 07:09

Autosize doesn't work using custom font?

Dear Klaus,

we've looked at the possibility of using some custom fonts for our textfield based plugins (layers), so far we've only been using Arial. Thing is, it seems the onautosized event isn't always working properly. Here's the code that sets the css for the layer in question:

Quellcode

1
menuItem.css = "font-family:Armata,sans-serif;font-size:13px;color:#FFFFFF;text-align:center";


The text appears and displays fine, but (with a certain html string) it sets itself to a width of 111px, when in reality it's more like 128. If I find the corresponding table element in the devtools, it correctly displays the height of 128x40px.



Yet the following code

Quellcode

1
menuItem.onautosized = "trace(width)";


traces 111 around 9 times out of 10. Yet on the 10th reload it traces 128 correctly.

Any idea what might be causing this? As long as we've only used Arial, it was always working perfectly...