0
votes

We have a large flash site which is translated into 11 languages. We have a font loading system whereby all the characters required to display the site in each language are embedded in external swfs (so 11 swfs).

A recent update to the site requires us to use the Text Layout Framework (TLF) for one area of text display, which of course only supports fonts embedded in the new CFF format. I've attempted to embed a second instance of the font using the tag embedAsCFF="true", and after loading in the font SWF I can see this font is correctly registered as it shows up in the array returned by Font.enumerateFonts.

The TextFlow instance I am using has the following properties set:

textFlow.fontLookup = FontLookup.EMBEDDED_CFF;
textFlow.renderingMode = RenderingMode.CFF;
textFlow.fontFamily = "HeadingFontCFF";

However the text that is displayed is not finding the embedded font. It is displayed in the Times New Roman device font. I'm pretty sure I have the TLF set up correct, as when I put the [Embed] tag in the same class (i.e. embedding in same SWF) as my TLF code, the font is displayed correctly. So it seems to relate just to fonts loaded in external SWFs.

I think this problem is related to the one listed here: Example of using embedded fonts loaded at runtime Flex 4 runtime loaded modules, although this post refers to a Flex 4 build whereas ours is a pure Flash 10 build.

2

2 Answers

3
votes

Okay so after a lot of digging I found the answer. It turns out we were using a compiler argument

-managers flash.fonts.AFEFontManager

which instructs the compiler to use the AFEFontManager when transcoding the fonts, rather than the default (BatikFontManager/AFEFontManager/JREFontManager). These font managers take font files and turn them into vector outlines to be rendered in Flash. There's more information here: About the font managers.

It seems that when this argument is included, all fonts are embedded using the old DefineFont3 method, rather than DefineFont4 (CFF), even if you use the tag embedAsCff="true".

An easy way to see which method was actually used to embed the font is by checking the fontType property of the fonts returned by Font.enumerateFonts(). If the value is "embedded" then DefineFont3 was used, if it's "embeddedCFF" then DefineFont4 was used.

Hope this helps someone out there!

0
votes

I found this very useful: "By default MX components use TextField for text display and TextField cannot use CFF fonts. TextField will show blanks if it is told to use embedded fonts but there isn’t a font it can use or glyphs for that character in the font. Spark components use FTE and FTE requires CFF fonts. Thus mixing the two is problematic. You could embed a font twice, both with CFF true and false, but that’s not very efficient. In most cases if you use the MXFTEText.css file or check the box in the project properties, the MX components will switch to using FTE and CFF fonts." by By Alex Harui - 9:12 PM on September 2, 2010

As seen here on a very detailed (and long) explanation related to the subject.