Highlighted

Spark labels won´t show embedded fonts on AIR 4.0

Explorer ,
Mar 09, 2014

Copy link to clipboard

Copied

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?

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

Captura.PNG

TOPICS
Development

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Spark labels won´t show embedded fonts on AIR 4.0

Explorer ,
Mar 09, 2014

Copy link to clipboard

Copied

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?

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

Captura.PNG

TOPICS
Development

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 09, 2014 1
Explorer ,
Mar 09, 2014

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 09, 2014 0
Explorer ,
Mar 10, 2014

Copy link to clipboard

Copied

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

Captura.PNG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 10, 2014 0
New Here ,
Apr 03, 2015

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 03, 2015 0
New Here ,
Jul 22, 2018

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 22, 2018 0