0

I am trying to Embed fonts in External css file using @font-face in flex4.11 sdk. The code snippet is like this,

MyOwnFontStyle.css:

 @namespace s "library://ns.adobe.com/flex/spark";
 @namespace mx "library://ns.adobe.com/flex/mx";
 @font-face {
    src:url("font/GOTHICB.ttf");
    fontFamily: myFontFamily;
    embedAsCFF: true;
    fontWeight: bold;
 }

 s|VGroup {
    fontFamily: myFontFamily;
    fontSize: 15;
 }   

It builds successfully without any errors. But when am launching application it throws runtime execption like below,

ArgumentError: Error #1508: The value specified for argument font is invalid. at flash.text::Font$/registerFont() at MyOwnFontStyle/setStyleDeclarations() at MethodInfo-19757() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at ModuleInfoProxy/moduleEventHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at ModuleInfo/readyHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.core::FlexModuleFactory/update() at mx.core::FlexModuleFactory/docFrameHandler() at mx.core::FlexModuleFactory/docFrameListener()

If anyone come across this kind of things, Kindly share your ideas to resolve this issue. Thanks in advance.

ketan
  • 19,129
  • 42
  • 60
  • 98
raj
  • 43
  • 14

2 Answers2

1

If anyone facing the same problem, do forcefully include the below statements in your main application.

import mx.core.EmbeddedFontRegistry;

private var embeddedFontRegistry:EmbeddedFontRegistry;

raj
  • 43
  • 14
0

Maybe you setted wrong url. Try to set

src:url("/font/GOTHICB.ttf");

also note that the "font" directory need to be located in "src" directory

Or try to use some new font, maybe

GOTHICB.ttf

file is non-working

Andre Lombaard
  • 6,985
  • 13
  • 55
  • 96
Anton
  • 305
  • 3
  • 6
  • Thanks for your response. Now its working fine for me. If anyone facing the same problem, do forcefully including "import mx.core.EmbeddedFontRegistry; private var embeddedFontRegistry:EmbeddedFontRegistry;" in your main application. – raj Aug 14 '14 at 09:23
  • If this answer was helpful for you then can you please approve and up it? – Anton Aug 14 '14 at 10:21