Skip to main content
August 12, 2011
Answered

embedding fonts in AIR 2.7 for iOS

  • August 12, 2011
  • 1 reply
  • 1545 views

Hi,

this may have been ask several times, but what is the exact / best way to use custom fonts in an iOS app?

It seems, that by using a lot of textfields, the app is not running smooth anymore.

Is there some magic way that will restore performance? And still be able to use custom fonts?

kind regards!

This topic has been closed for replies.
Correct answer markc888

The 'magic trick' would be to create bitmaps of the textfields and add these to the display list rather than the textfields.

//container is a sprite that has a textfield added to it.

var bmp:BitmapData = new BitmapData(container.width, container.height);

bmp.draw(container);

var snapshot:Bitmap = new Bitmap(bmp);

snapshot.smoothing = true;

snapshot.cacheAsBitmap = true;

addChild(snapshot);

Hope that helps.

1 reply

markc888
markc888Correct answer
Inspiring
August 12, 2011

The 'magic trick' would be to create bitmaps of the textfields and add these to the display list rather than the textfields.

//container is a sprite that has a textfield added to it.

var bmp:BitmapData = new BitmapData(container.width, container.height);

bmp.draw(container);

var snapshot:Bitmap = new Bitmap(bmp);

snapshot.smoothing = true;

snapshot.cacheAsBitmap = true;

addChild(snapshot);

Hope that helps.

September 7, 2011

Hi! Just realized that I didn't mark your answer, but that was indeed working! Kinda weard still, I thought using bitmap drawing would be much slower then just using "simple" ready made text field. Anyways...Thnx for the tip!