textLayoutFormat.fontLookup =FontLookup.EMBEDDED_CFF breaks font?
Hi,
My Flash Player version: 10,1,50,433 (Debug version)
My Flex SDK: 4.5 downloaded from the trunk. SVN Status shows no updates required.
Font embedding is not working. I read some other threads on this, but it's pretty confusing stuff. Perhaps I just need confirmation if there is a bug in Flex 4.5 and if it's not currently possible to embed fonts in Flex (if that is indeed the case).
Here is some my code:
[Embed(source="/assets/MyriadPro-Bold.otf", fontFamily="Myriad Pro Bold", embedAsCFF="true")]
private var _MyriadProBoldSubset:Class;
public function FontTest()
{
Font.registerFont(_MyriadProBoldSubset);
textLayoutFormat = new TextLayoutFormat();
textLayoutFormat.color = 0xFFFFFF;
textLayoutFormat.renderingMode = RenderingMode.CFF;
// Turning this off makes the text bold, turning it off makes non-bold. This indicates that font embedding is not working, so it falls back to some other font.
textLayoutFormat.fontLookup = FontLookup.EMBEDDED_CFF;
textLayoutFormat.textAlign = "center";
textLayoutFormat.fontFamily = "Myriad Pro Bold";
textLayoutFormat.fontSize = 12;
textLayoutFormat.fontWeight = FontWeight.BOLD;
var fonts = Font.enumerateFonts();
var fooFont:Font = fonts[0];
// Traces out "Myriad Pro Bold :: true" . This seems to confirm that the font is embedded and has the glyph I need for my "CC" button
trace(fooFont.fontName + " :: " + fooFont.hasGlyphs("C"));
textFlow= new TextFlow();
paragraph = new ParagraphElement();
span = new SpanElement;
paragraph.addChild(span);
textFlow.addChild(paragraph)
var controller:ContainerController = new ContainerController(cc_btn, 18, 17);
textFlow.flowComposer.addController(controller);
textFlow.hostFormat = textLayoutFormat;
span.text = "CC";
textFlow.flowComposer.updateAllControllers();
