4 Replies Latest reply on Sep 29, 2011 3:03 AM by Karl_Sigiscar_1971

    How to embed a font into Flex 4 module?

    purusothamyb

      Hi,

           I have a problem in embedding a font into flex 4 module.

       

          Here is the snipet of code I am using. The text is not renderer with the embeded font. Any flaw in my code??

       

      /*

                                    * Embed a font by location.

                                    */

                                    [Embed(source='/assets/fonts/DS-DIGI.TTF',

                                            fontName='DS-Digital',

                                            mimeType='application/x-font',

                                            embedAsCFF='false')]

                                    private var customFont:Class;

       

       

      // Style definition

       

      .digitalFontStyle {

                                    fontFamily:DS-Digital;

                                    fontSize: 35pt;

                          }

       

      // MXML code

       

      <s:BorderContainer borderWeight="1" cornerRadius="3" dropShadowVisible="true" minWidth="0" minHeight="0"

                                                           width="{diskContainer.width}" height="{diskContainer.height}">

                          <mx:VBox width="100%" height="100%" horizontalAlign="center" verticalAlign="middle">

                                    <s:Label text="Response Time" fontWeight="bold"/>

                                    <mx:HRule width="100%"/>

                                    <s:RichText textAlign="center" styleName="digitalFontStyle" paddingTop="10">

                                              <s:span>

                                                        {serverInfo.responseTime}

                                              </s:span>

                                              <s:span fontSize="30">

                                                        ms

                                              </s:span>

                                    </s:RichText>

                          </mx:VBox>

                </s:BorderContainer>

       

      FYI, I am using Flex 4.1.0 SDK with Cairngorm module library.

       

      Please help me.

       

      Regards,

      Purush