Home Tutorial Flex Flex4 Components Embedded Font in Flex4

 
 

Embedded Font in Flex4
Posted on: June 23, 2010 at 12:00 AM
You can embedded the font in your application. There are some file type of fonts:

Embedded font in Flex4:

You can embedded the font in your application. There are some file type of fonts:

1. True Type fonts (*.ttf)
2. Open Type fonts (*.otf)
3. True Type Collection (*.ttc)
4. Mac Data Fork Fonts (*.dfont)

Syntax of embedded font  is:

@font-face {
src: url("location");
fontFamily: alias;
[fontStyle: normal | italic | oblique] ;
[fontWeight: normal | bold | heavy] ;
[embedAsCFF:true | false] ;
[advancedAntiAliasing: true | false];
}

In this example you can see how we can embedded a font in your application.
In this example we use a MyriadWebPro.ttf  font.

Example:

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s="library://ns.adobe.com/flex/spark"

xmlns:mx="library://ns.adobe.com/flex/mx"

minWidth="955" minHeight="600">

<!-- Using Embedded fonts -->

<fx:Style>

@namespace s "library://ns.adobe.com/flex/spark";

@font-face {

src:url("MyriadWebPro.ttf");

fontFamily: fontFamily1;

embedAsCFF: true;

}

s|VGroup{

font-family: fontFamily1;

font-size: 20;

}

</fx:Style>

<s:Panel title="Embedded Font Example" width="268" height="145">

<s:VGroup x="12" y="24" width="241" height="48">

<s:Button label="Submit"/>

<s:Label text="This is a Embedded font."/>

</s:VGroup>

</s:Panel>

</s:Application>

Output:

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

Related Tags for Embedded Font in Flex4:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.