Home Tutorial Flex Flex4 Components Embedded font with multiple typefaces in Flex4

 
 

Share on Google+Share on Google+
Embedded font with multiple typefaces in Flex4
Posted on: June 24, 2010 at 12:00 AM
Advertisement
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;

}

.boldStyle {

fontSize: 30px;

fontFamily: fontfamily1;

fontWeight: bold;

color:green;

}

.italicStyle {

fontSize: 30px;

fontFamily: fontfamily1;

fontStyle: italic;

color:blue;

}

</fx:Style>

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

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

<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"/>

</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

Advertisement

Related Tags for Embedded font with multiple typefaces in Flex4:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: June 24, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com