Reputation: 43
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.
Upvotes: 0
Views: 105
Reputation: 43
If anyone facing the same problem, do forcefully include the below statements in your main application.
import mx.core.EmbeddedFontRegistry;
private var embeddedFontRegistry:EmbeddedFontRegistry;
Upvotes: 1
Reputation: 305
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
Upvotes: 0