Embedded font with multiple typefaces in Flex4


 

Embedded font with multiple typefaces in Flex4

In this example you can see how we can use a type faces font in multiple form.

In this example you can see how we can use a type faces font in multiple form.

Embedded font with multiple typefaces in Flex4:

In this example you can see how we can use a type faces font in multiple form. In this example we use a three font file: simple, bold and italic 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">

<!-- Embedded font using multiple faces -->

<fx:Style>

@font-face {

src:url("MyriadWebPro.ttf");

fontFamily: fontfamily1;

embedAsCFF: true;

}

@font-face {

src:url("MyriadWebPro-Bold.ttf");

fontFamily: fontfamily1;

fontWeight: bold;

embedAsCFF: true;

}

@font-face {

src:url("MyriadWebPro-Italic.ttf");

fontFamily: fontfamily1;

fontStyle: italic;

embedAsCFF: true;

}

.plainStyle {

fontSize: 30px;

fontFamily: fontfamily1;

color:red;

}

0

.boldStyle {

fontSize: 30px;

fontFamily: fontfamily1;

1

fontWeight: bold;

color:green;

}

2

.italicStyle {

fontSize: 30px;

fontFamily: fontfamily1;

3

fontStyle: italic;

color:blue;

}

4

</fx:Style>

<s:Panel title="Embedded font with multiple faces Example" width="297" height="164">

<s:VGroup x="12" y="13">

5

<s:Label text="This is a Plain Text" styleName="plainStyle"/>

<s:Label text="This is a Bold Text" styleName="boldStyle"/>

<s:Label text="This is a Italic Text" styleName="italicStyle"/>

6

</s:VGroup>

</s:Panel>

</s:Application>

7

Output:

Running Application:

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

Download this code

Ads