Skip to main content
Inspiring
March 9, 2014
Answered

Spark labels won´t show embedded fonts on AIR 4.0

  • March 9, 2014
  • 4 replies
  • 1791 views

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.
Correct answer Spacorum

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
July 23, 2018

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

April 3, 2015

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

SpacorumAuthor
Inspiring
March 10, 2014

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.

SpacorumAuthorCorrect answer
Inspiring
March 10, 2014

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)"