Device Font in Flex4


 

Device Font in Flex4

You can specify any device font for the fontFamily property.

You can specify any device font for the fontFamily property.

Device font in Flex4:

You can specify any device font for the fontFamily property. Device font are not embedded in the SWF file. Flash player supports three device fonts:

1. _sans: The _sans device font is a sans-serif typeface; for example, Helvetica or Arial.
2. _serif: The _serif device font is a serif typeface; for example, Times Roman.
3. _typewriter: The _typewriter device font is a mono space font; for example, Courier.

In this example you can see how we can use a device font in your application.

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 Device fonts -->

<fx:Style>

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

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

s|VGroup{

font-family:Courier, "_typewriter";

font-size:18px;

color:blue;

font-weight:bold;

}

</fx:Style>

<s:Panel title="Device 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 Device 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

Ads