Hi,
Thanks for your response. As suggested I tried by adding fontWeight: bold to
the mypaneltitle selector, but no change.
My problem is trying to load external stylesheet via
styleManager.loadStyleDeclarations() method, the embedded font in stylesheet is
not getting reflected in my application. But if I use <fx:Style> tag inside
application with same contents available in stylesheet, the embedded font is
getting reflected. I am using Flex4.11 SDK.
Sample I worked out is listed below,
EmbedFont.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: centuryGothicBold;
advancedAntiAliasing: true;
embedAsCFF: true;
fontWeight: bold;
}
.mypanelTitle {
color: #b56a00;
fontFamily: centuryGothicBold;
fontSize: 12;
}
EmbeddedFontFace.mxml:
---------------------------------
<?xml version="1.0"?>
<!-- fonts/EmbeddedFontFace.mxml -->
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="init()"
width="100%">
<fx:Script>
<![CDATA[
import mx.styles.StyleManager;
private function init() : void {
var styleLoadEvent:IEventDispatcher =
StyleManager.loadStyleDeclarations("EmbedFont.swf",true); // If I use this,
embedded Font is not applying to 'myPanel' component
}
]]>
</fx:Script>
<!-- <fx:Style><!-- If I use this instead of StyleManager class, embedded
Font is applying to 'myPanel' component -->
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@font-face {
src: url("font/GOTHICB.ttf");
fontFamily: centuryGothicBold;
advancedAntiAliasing: true;
embedAsCFF: true;
fontWeight: bold;
}
.mypanelTitle {
color: #b56a00;
fontFamily: centuryGothicBold;
fontSize: 12;
}
</fx:Style> -->
<s:Panel id="myPanel" title="Embedded Font Applied With Type Selector"
styleName = "mypanelTitle" horizontalCenter="0" >
<s:VGroup>
<s:RichText width="250" >
<s:text>
The text in this RichText control uses the font set on the
VGroup.
</s:text>
</s:RichText>
</s:VGroup>
</s:Panel>
</s:Application>
Please let me know anything I missed out using
styleManager.loadStyleDeclarations(). Kindly revert back to me asap.
Regards,
Mohanraj N
-----Original Message-----
From: Alex Harui [mailto:[email protected]]
Sent: 21 May 2014 20:02
To: [email protected]
Cc: Sasi Kumar K
Subject: Re: Embed Font using @font-face in Flex SDK4.11
Add fontWeight: bold to the mypaneltitle selector
On 5/21/14 12:22 AM, "Mohanraj N" <[email protected]> wrote:
>Hi,
>
>Thanks for your response. We have not include FontSWF during SDK
>download. So we downloaded SDK4.11 again with FontSWF option, now it¹s
>working fine.
>But we are facing another problem like embedded fonts in the external
>CSS are reflected only in compile time using <fx:Style> tag. If we
>tried to load CSS using ŒStyleManager¹ class during runtime the Fonts
>are not getting reflected.
>
>Below the sample I worked out for the above scenario,
>
>EmbedFont.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: centuryGothicBold;
> advancedAntiAliasing: true;
> embedAsCFF: true;
> fontWeight: bold;
> }
>
>.mypanelTitle {
> color: #b56a00;
> fontFamily: centuryGothicBold;
> fontSize: 12;
> }
>
>
>mainAppln.mxml:
>----------------------
><?xml version="1.0"?>
><s:Application
> xmlns:fx="http://ns.adobe.com/mxml/2009"
> xmlns:mx="library://ns.adobe.com/flex/mx"
> xmlns:s="library://ns.adobe.com/flex/spark" width="100%"
>creationComplete="init()">
>
> <fx:Script>
> <![CDATA[ import
>mx.styles.StyleManager;
>
> private function init() : void {
>StyleManager.loadStyleDeclarations("EmbedFont.swf",true); //Load css
>during run time, embed font is not getting reflected
>
> }
>
> ]]>
> </fx:Script>
>
> <!-- <fx:Style source="EmbedFont.css" /> --> //Load css during
>compile time, embed font is getting reflected
>
> <s:Panel id="myPanel" title="Embedded Font Applied With Type Selector"
>horizontalCenter="0" styleName = "mypanelTitle" >
> <s:VGroup>
> <s:RichText width="250" >
> <s:text>
> The text in this RichText control uses the font set on
>the VGroup.
> </s:text>
> </s:RichText>
> </s:VGroup>
> </s:Panel>
></s:Application>
>
>Please share your idea to solve this problem.
>
>Regards,
>Mohanraj N
>
>From: [email protected]<mailto:[email protected]>
>[mailto:[email protected]] On Behalf Of OmPrakash Muppirala
>Sent: 19 May 2014 12:36
>To: [email protected]<mailto:[email protected]>
>Cc: Sasi Kumar K
>Subject: Re: Embed Font using @font-face in Flex SDK4.11
>
>Do you see any compile errors?
>
>How did you install the 4.11 SDK? Did you select the FontSWF utility
>during the install process?
>
>Thanks,
>Om
>
>On Sun, May 18, 2014 at 11:33 PM, Mohanraj N
><[email protected]<mailto:[email protected]>> wrote:
>Hi,
>
>I am trying to embed fonts using @font-face builds with Flex sdk4.11
>which is not reflected in the application. But if I build application
>with Flex sdk 4.6, the embed font is getting reflected. 'font' folder
>is available in same directory of application.
>
>I don't know whether I missed out anything in code or during compilation.
>
><?xml version="1.0"?>
><s:Application
> xmlns:fx="http://ns.adobe.com/mxml/2009"
> xmlns:mx="library://ns.adobe.com/flex/mx<http://ns.adobe.com/flex/mx>"
>
>xmlns:s="library://ns.adobe.com/flex/spark<http://ns.adobe.com/flex/spa
>rk>
>">
>
> <fx:Style>
> @font-face {
> src:url("font/GOTHIC.ttf");
> fontFamily: myFont;
> embedAsCFF: true;
> }
>
> @font-face {
> src:url("font/GOTHICB.ttf");
> fontFamily: myFont1;
> fontWeight: bold;
> embedAsCFF: true;
> }
>
> @font-face {
> src:url("font/GOTHICI.ttf");
> fontFamily: myFont2;
> fontStyle: italic;
> embedAsCFF: true;
> }
>
> .myPlainStyle {
> fontSize: 20;
> fontFamily: myFont;
> }
>
> .myBoldStyle {
> fontSize: 20;
> fontFamily: myFont1;
> fontWeight: bold;
> }
>
> .myItalicStyle {
> fontSize: 20;
> fontFamily: myFont2;
> fontStyle: italic;
> }
> </fx:Style>
>
>
> <s:VGroup>
> <s:RichText text="Plain Label" styleName="myPlainStyle"/>
> <s:RichText text="Bold Label" styleName="myBoldStyle"/>
> <s:RichText text="Italic Label" styleName="myItalicStyle"/>
> </s:VGroup>
></s:Application>
>
>Please let me know the idea's to solve this problem asap.
>
>Regards,
>Mohanraj N
>DISCLAIMER: Information contained in and transmitted by this e-mail is
>proprietary to Ramco Systems Limited and/or its parents, subsidiaries
>and other affiliates, including Ramco Systems Corporation,
>(collectively "Ramco Systems"), is a confidential communication between
>Ramco Systems and the intended recipient(s) and is intended for use
>only by the individual or entity to which it is addressed, and may
>contain information that is privileged, confidential or exempt from
>disclosure under applicable law. If this is a forwarded message, the
>content of this e-mail may not have been sent with the authority of
>Ramco Systems. Any unauthorized disclosure, dissemination, forwarding,
>printing, copying or other use of this email, and/or any action taken
>in reliance on the contents of this e-mail is strictly prohibited and
>may be unlawful. Ramco Systems shall not be liable or responsible to an
>unintended recipient of this email in any way for the contents of this
>email, or for the consequences of any such use or action. If you have
>received this communication in error, either directly or through
>forwarding, please notify Ramco Systems immediately at
>[email protected]<mailto:[email protected]> and delete/destroy this
>email and any copies of this email. In the absence of a consistent
>formal hard copy or electronic contract or waiver or other instrument
>duly executed on behalf of Ramco Systems by duly authorized officer(s)
>or agent(s), Ramco Systems shall not be contractually bound by any
>email sent on its behalf. Emails will be used by Ramco Systems only for
>making proposals, conducting negotiations, providing information and
>positions on issues and for similar purposes.
>
>DISCLAIMER: Information contained in and transmitted by this e-mail is
>proprietary to Ramco Systems Limited and/or its parents, subsidiaries
>and other affiliates, including Ramco Systems Corporation,
>(collectively "Ramco Systems"), is a confidential communication between
>Ramco Systems and the intended recipient(s) and is intended for use
>only by the individual or entity to which it is addressed, and may
>contain information that is privileged, confidential or exempt from
>disclosure under applicable law. If this is a forwarded message, the
>content of this e-mail may not have been sent with the authority of
>Ramco Systems. Any unauthorized disclosure, dissemination, forwarding,
>printing, copying or other use of this email, and/or any action taken
>in reliance on the contents of this e-mail is strictly prohibited and
>may be unlawful. Ramco Systems shall not be liable or responsible to an
>unintended recipient of this email in any way for the contents of this
>email, or for the consequences of any such use or action. If you have
>received this communication in error, either directly or through
>forwarding, please notify Ramco Systems immediately at
>[email protected] and delete/destroy this email and any copies of
>this email. In the absence of a consistent formal hard copy or
>electronic contract or waiver or other instrument duly executed on
>behalf of Ramco Systems by duly authorized
>officer(s) or agent(s), Ramco Systems shall not be contractually bound
>by any email sent on its behalf. Emails will be used by Ramco Systems
>only for making proposals, conducting negotiations, providing
>information and positions on issues and for similar purposes.
DISCLAIMER: Information contained in and transmitted by this e-mail is
proprietary to Ramco Systems Limited and/or its parents, subsidiaries and other
affiliates, including Ramco Systems Corporation, (collectively "Ramco
Systems"), is a confidential communication between Ramco Systems and the
intended recipient(s) and is intended for use only by the individual or entity
to which it is addressed, and may contain information that is privileged,
confidential or exempt from disclosure under applicable law. If this is a
forwarded message, the content of this e-mail may not have been sent with the
authority of Ramco Systems. Any unauthorized disclosure, dissemination,
forwarding, printing, copying or other use of this email, and/or any action
taken in reliance on the contents of this e-mail is strictly prohibited and may
be unlawful. Ramco Systems shall not be liable or responsible to an unintended
recipient of this email in any way for the contents of this email, or for the
consequences of any such use or action. If you have received this communication
in error, either directly or through forwarding, please notify Ramco Systems
immediately at [email protected] and delete/destroy this email and any copies
of this email. In the absence of a consistent formal hard copy or electronic
contract or waiver or other instrument duly executed on behalf of Ramco Systems
by duly authorized officer(s) or agent(s), Ramco Systems shall not be
contractually bound by any email sent on its behalf. Emails will be used by
Ramco Systems only for making proposals, conducting negotiations, providing
information and positions on issues and for similar purposes.