Skip to main content
Inspiring
July 16, 2017
Answered

Font embed AIR 24 / 25 [HELP]

  • July 16, 2017
  • 3 replies
  • 2177 views

Does anyone know how to get this to work?  The example I found says to do it like this in your app-xml

?xml version="1.0" encoding="utf-8" standalone="no"?>

<application xmlns="http://ns.adobe.com/air/application/24.0">

     <embedFonts>

             <font>

                  <fontName>Life is goofy</fontName>

                  <fontPath>life_is_goofy.ttf</fontPath>

             </font>

     </embedFonts>

</application>

I try this and I get an error.  I'm using a Mac.   Trying to build an Android app with the embedded font. Any help appreciated here.

This topic has been closed for replies.
Correct answer el111

I remember I got that error until I put the font in my "src root" folder.

You may also try putting the full path eg:

<fontPath>/Path/on_your/machine/life_is_goofy.ttf</fontPath>

As reference - I am using AIR25 and this compiles fine for me on Android and iOS with the setup here:

WebViewANE/WebViewANESample-app.xml at master · tuarua/WebViewANE · GitHub

3 replies

Douglas McCarroll
Inspiring
January 15, 2018

> Hi Douglas! We you able to show chinese fonts in the end?

Sorry, I haven't had time to look into this. This project is on the back burner for now.

Inspiring
July 16, 2017

Which compilers are you using ?

ASC2 from the AIR SDK ?
or
ASC (eg. v1) from an AIR SDK merged with a Flex SDK?

AND


Where do you try to use the embedded font ?

Are you using those embedFonts settings to use in a StageText or something else?

see here

Custom fonts support for StageText on iOS and Android

eg.

Beginning with AIR 24, we have introduced support for Custom fonts on StageText for iOS and Android. Earlier, StageText was created with specific system fonts. With the introduction of this feature, the AS developers now have more flexibility in using fonts apart from the ones present in system. The developers can use ttf and otf font files.


also

  • For packaging the .apk file using Flash Builder, the developer needs to provide absolute fontPath.
  • With Java 1.6 on Windows, otf files are not rendered for IPAs.

that's about it, if you use this setting to embed font to display somewhere else than in StageText, not really gonna work

from Flash Builder you gonna need absolute path, from the command-line you may be able to use relative path

Alternatively, depending on your compiler (ASC1 or ASC2) you could try what's described here
Adobe Flex 4.6 Embed Fonts

If you use the AIR SDK by itself (without merging with the Flex SDK)
in ASC2 font transcoding has been removed and fonts should be pre-transcoded
with the command-line tool fontswf

Assuming (I did not test this specific case with StageText) that AIR 24 <embedFonts>
work the same way as previously font embedding, with ASC2 you should be able fontswf
to compile your font to a SWF file, and the -a param should be the equivalent of <fontName>,

eg. you could embed the SWF, not use the setting  <embedFonts> and still be able to use the

font name as the fontFamily property for a StageText.

I would say it's worth a try and few tests to just avoid the absolute path in your app xml.

Applauz78Author
Inspiring
July 16, 2017

I'm using Animate CC.

I just got it to work!

I had to use full path like this   -  /Users/username/Desktop/FolderNam/FolderWithAppNam

Now the only pain in the ass is that the Y coords on Android are different than iOS ... so will have to work around that... but at least the font renders now.

Colin Holgate
Inspiring
July 16, 2017

Is life_is_goofy.tt online?

Is this HTML5 Canvas? That could affect what fonts could work.

Applauz78Author
Inspiring
July 16, 2017

Thats not the font I'm using .. thats just an example..

This is for an AIR - Android / iOS app.