Skip to main content
October 24, 2009
Question

Embedded Font Subsetting Using DefineFont4

  • October 24, 2009
  • 1 reply
  • 2709 views

Hi ,

I am trying to follow this example here:

http://blogs.adobe.com/tlf/2008/11/embedded-font-subsetting-using.html

I am working on Mac OS X Version 10.5.8
I have  Flex Builder 3 Educational version installed: Version: 3.0.205647

I also downloaded and installed flex_sdk_4.0.0.6898

to test the installation I tried this example here:

"Creating a transparent Spark TextArea control in Flex Gumbo"

http://blog.flexexamples.com/2009/06/02/creating-a-transparent-spark-textarea-control-in-flex-gumbo/

and this works fine. Howvere I really need to use Flex Gumbo to create
an swf file with DefineFont4 Embedded arabic Font to be used in a
Flash CS4 Project.

Unfortunately I cannot compile the Text Layout Framework Team's example here:
http://blogs.adobe.com/tlf/2008/11/embedded-font-subsetting-using.html

I create a new Flex Project called FontTest,
In the project properties I select Flex 4 SDK, and
in the HTML wrapper I change the default flash player version
to 10.0.0 and apply the changes.

I guess, this has something to do with namespace changes also
as the example was compiled on a PC i need to use a different path
here:

Embed(source='C:/WINDOWS/Fonts/AdobeArabic-Regular.otf',

on my mac I guess it can be :

Embed(source='/Library/Fonts/AdobeArabic-Regular.otf',

when I try and compile the example I get :
could not resolve <TextView> to a component implementation.

also sometimes when I try and run projects with sdk 4,
the html file is deleted


thanks

ped

This topic has been closed for replies.

1 reply

October 25, 2009

Hi ,

I have managed to upate the code to the following, and it seems to work with the new tags,

but only with the full font embedded. with the device font i just see crossed out rectangles,

and with subset font I see the arabic text with a couple of crossed out rectangles.

Also is <s:RichEditableText> a good substitute for <TextView> ??

thanks in advance,

ped

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/halo">


<s:layout> <s:BasicLayout /></s:layout>

<fx:Script>

<![CDATA[
[Embed(source='/Library/Fonts/AdobeArabic-Regular.otf', cff='true', fontFamily='_AdobeArabicSubset', unicodeRange='U+0627,U+0644,U+0625,U+062E,U+0627,U+0621')]
private const AdobeArabicSubsetFont:Class;

[Embed(source='/Library/Fonts/AdobeArabic-Regular.otf', cff='true', fontFamily='_AdobeArabicFull')]
private const AdobeArabicFullFont:Class;
]]>
</fx:Script>

<s:RichEditableText id="deviceFont" fontSize="28" fontLookup="device" fontFamily="AdobeArabic-Regular">
Device: &#x0627;&#x0644;&#x0625;&#x062E;&#x0627;&#x0621;
</s:RichEditableText>

<s:RichEditableText id="subsetFont" fontSize="28" fontLookup="embeddedCFF" fontFamily="_AdobeArabicSubset">
Subset: &#x0627;&#x0644;&#x0625;&#x062E;&#x0627;&#x0621;
</s:RichEditableText>


<s:RichEditableText id="fullFont" fontSize="28" fontLookup="embeddedCFF" fontFamily="_AdobeArabicFull">
Full: &#x0627;&#x0644;&#x0625;&#x062E;&#x0627;&#x0621;
</s:RichEditableText>
</s:Application>

Peter_deHaan
Participating Frequently
October 26, 2009

@xplatform,

The following works for me in Flex SDK 4.0.0.11114:

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/halo">

    <fx:Script>
        <![CDATA[
            [Embed(source='C:/Windows/Fonts/AdobeArabic-Regular.otf', embedAsCFF='true', fontFamily='_AdobeArabicSubset', unicodeRange='U+0627,U+0644,U+0625,U+062E,U+0627,U+0621')]
            private const AdobeArabicSubsetFont:Class;

            [Embed(source='C:/Windows/Fonts/AdobeArabic-Regular.otf', embedAsCFF='true', fontFamily='_AdobeArabicFull')]
            private const AdobeArabicFullFont:Class;
        ]]>
    </fx:Script>

    <s:VGroup left="20" top="20">
        <s:RichEditableText id="deviceFont" fontSize="28" fontLookup="device" fontFamily="AdobeArabic-Regular">
            Device: &#x0627;&#x0644;&#x0625;&#x062E;&#x0627;&#x0621;
        </s:RichEditableText>

        <s:RichEditableText id="subsetFont" fontSize="28" fontLookup="embeddedCFF" fontFamily="_AdobeArabicSubset">
            Subset: &#x0627;&#x0644;&#x0625;&#x062E;&#x0627;&#x0621;
        </s:RichEditableText>

        <s:RichEditableText id="fullFont" fontSize="28" fontLookup="embeddedCFF" fontFamily="_AdobeArabicFull">
            Full: &#x0627;&#x0644;&#x0625;&#x062E;&#x0627;&#x0621;
        </s:RichEditableText>
    </s:VGroup>

</s:Application>

October 27, 2009

Hi Peter,

thanks for your updated version. I see cff=true has been changed to

embedAsCFF='true'

Also, for anyone interested, here is the class file I used to embed the arabic font in an swf to be used in my flash CS4 project, (this is for Mac OSX)

package {
     import flash.display.Sprite;

    public class ArabicFont extends Sprite
     {
        
         [Embed(source='/Library/Fonts/AdobeArabic-Regular.otf', fontName='_ArabicFont', cff='true')]
         public static var _ArabicFont:Class;
        
     }
}

On the mac using the subset font I still see a couple of rectangles crossed out, but not sure what is causing this, as it looks like all the characters being used have been embedded in the subset? I have attached a picture

but the full embedding works great.

thanks again for your help