Andriy,
The new Flex Builder 3 beta 2 on adobe labs has a CSS Design View that
writes the code for you to embed fonts. You have to first create a css file
and then create a new style for it with the fonts you want. They will then
be embedded in the swf and you reference them by the alias you give them.

On 10/4/07, Daniel Freiman <[EMAIL PROTECTED]> wrote:
>
>   TextFields (which is the class that renders text in a Text class),
> either displays embeded fonts, or device fonts, but not both at the same
> time.  By default they use device fonts.  So when you set the htmltext, it
> looks for a device font to render the text.  If it can't find one, it uses a
> default device font.  When you set the fontFamily style, the Text control
> checks to see if that font is embeded, and when it finds that it is, it
> switches the rendering engine of it's TextField over to embeded fonts, which
> is why embeded fonts then work.
>
> - Dan Freiman
>
>
> On 10/4/07, Andriy Panas <[EMAIL PROTECTED]> wrote:
> >
> >   Hi all,
> >
> > My setup to load embedded fonts into Flex 2.0.1 based app is as follows:
> >
> > I declare 3 fonts that I want to embed in <mx:Style> tag:
> >
> > <mx:Style>
> >
> > @font-face {
> > src:url("assets/fonts/arial.ttf");
> > fontFamily: Arial;
> > }
> > /* CSS file */
> > @font-face {
> > src:url("assets/fonts/pala.ttf");
> > fontFamily: Palatino;
> > }
> >
> > /* CSS file */
> > @font-face {
> > src:url("assets/fonts/trebuc.ttf");
> > fontFamily: Trebuchet;
> > }
> > </mx:Style>
> >
> > Later in the code, I use the following function to assign the HTML
> > tagged text to my mx:Text field instance 'textField':
> >
> > ----------------------------------------------------------
> > private function assignText() : void {
> > textField.setStyle("fontFamily", "Trebuchet");
> > textField.htmlText = "<TEXTFORMAT LEADING='2'>" +
> > "<P ALIGN='LEFT'><FONT FACE='Trebuchet'
> > SIZE='18' COLOR='#0B333C'
> > LETTERSPACING='0' KERNING='0'>Example line of text</FONT></P>" +
> > "<P ALIGN='LEFT'><FONT FACE='Palatino'
> > SIZE='18' COLOR='#0B333C'
> > LETTERSPACING='0' KERNING='0'>Example line of text</FONT></P>" +
> > "<P ALIGN='LEFT'><FONT FACE='Arial'
> > SIZE='18' COLOR='#0B333C'
> > LETTERSPACING='0' KERNING='0'>Example line of text</FONT></P>" +
> > "</TEXTFORMAT>";
> > }
> > ----------------------------------------------------------
> >
> > And it works! It works because I change the style 'fontFamily' for
> > Text textField.setStyle("fontFamily", "Trebuchet") prior to setting
> > value to the htmlText field!
> >
> > All 3 lines of text are correctly displayed using glyphs from 3
> > various embedded fonts, but if I remove the line
> > textField.setStyle("fontFamily", "Trebuchet") from the code, then the
> > text is displayed using device fonts, not embedded ones.
> >
> > Why is that?
> >
> > Why do I have change the style 'fontFamily' of Text component prior to
> > setting value of the 'htmlText' property of mx:Text in order to get
> > embedded fonts to be working?
> >
> > And the attribute value for the style "fontFamily" should the valid
> > identificator of any of 3 fonts successfully loaded - Trebuchet,
> > Palatino or Arial.
> >
> > --
> > Med venlig hilsen / Best regards
> > Andriy Panas
> > [EMAIL PROTECTED] <a.panas%40gmail.com>
> >
>
>  
>

Reply via email to