Skip to main content
Inspiring
Mar 9, 2014 2:37 PM UTC
Answered

Spark labels won´t show embedded fonts on AIR 4.0

Hello.

After noticing that AIR 3.9 was no longer accepted on the Apple Store (http://flashgamer.com/blog/comments/apple-is-not-currently-accepting-applications-built-with-air-3.9), I downloaded a new Apache Flex SDK (version 4.11 + AIR 4.0 + Flash Player 12.0). I then recompiled my mobile application, with no errors.

But both on the emulator and the device (iPhone 3GS), the spark labels I used in the whole application don´t load properlly the embedded fonts set on the CSS file. They always show the default font style. This is my code:

styles.css

@namespace s "library://ns.adobe.com/flex/spark";

@namespace local "*";

@font-face {

          src: url("assets/fonts/CustomFont.ttf");

          fontFamily: "CustomFontCFF";

          embedAsCFF: true;

}

@font-face {

          src: url("assets/fonts/CustomFont.ttf");

          fontFamily: "CustomFont";

          embedAsCFF: false;

}

.phrase

{

     color: #FF0000; /* red */

     fontFamily: "CustomFontCFF";

}

App.mxml (The label is in fact inside another view, but I think this is enough to get the concept)

<?xml version="1.0" encoding="utf-8"?>

<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

                                                            xmlns:s="library://ns.adobe.com/flex/spark">

          <fx:Style source="assets/css/styles.css" />

        <s:Label id="phraseLabel" width="100%"

                                             cacheAsBitmap="false"

                                             styleName="phrase" />

</s:TabbedViewNavigatorApplication>

Compilation arguments:

-locale en_US  -swf-version=23 -debug=false

I can say the stylesheet is being loaded because the spark label is red, as the CSS specifies. But the font won´t show, even if I set the non-CFF version (CustomFont instead of CustomFontCFF). So, now the app is ready for submitting to the Apple Store, but I´ve lost a basic visual feature on the app (styled labels with custom embedded fonts)...

Anyone else is having this weird issue?

This topic is closed to new replies. Start a new post to keep the conversation going.
SpacorumCorrect answer
Inspiring
Mar 10, 2014 6:48 PM UTC

Ok, the problem was on the SDK I downloaded.. In the Apache Flex installer there are some important checkboxes (I didn´t check all of them). The important here is to check the "Adobe Embedded Font Libraries and Utilities (Optional)"


4 replies

Participant
Jul 23, 2018 4:47 AM UTC

This is my issue for a couple of days. This post and fontswf utility, a great help indeed. Thanks.

Translate
Apr 3, 2015 12:02 PM UTC

Thanks a lot for this fix! I spent more than a week trying to make it work.

Translate
SpacorumAuthor
Inspiring
Mar 10, 2014 1:01 AM UTC

There´s a warning message when debugging the application:

warning: incompatible embedded font 'CustomFontCFF' specified for spark.components::Label (Label110) . This component requires that the embedded font be declared with embedAsCFF=true.

Which is strange, because that property is set to true on the CSS stylesheet.

Translate
SpacorumAuthorCorrect answer
Inspiring
Mar 10, 2014 6:48 PM UTC

Ok, the problem was on the SDK I downloaded.. In the Apache Flex installer there are some important checkboxes (I didn´t check all of them). The important here is to check the "Adobe Embedded Font Libraries and Utilities (Optional)"


Translate