Skip to main content
Participating Frequently
July 9, 2009
Question

Font Embedding and Dynamic font size change in TLF

  • July 9, 2009
  • 1 reply
  • 2118 views

Hi ,

      I m using TextLayout Frame work for my application to load content. here i need to use embed font and this

font size need to increase and decrease dynamically after the content loaded. may i how to achive this in TLF.

for TextField i did it this in a easy way ..

any idea?

Regards,

sundarapandian.k

This topic has been closed for replies.

1 reply

Adobe Employee
July 10, 2009

It depends a bit on your content and your use case.

If your content has no overrides on fontSize in the model you can simply adjust textFlow.fontSize, for example:

textFlow.fontSize = textFlow.computedFormat.fontSize + 2;

and then recompose.

If there are overrides to fontSIze on your paragraphs or spans you can loop through the LeafElements and adjust them all like this:

var leaf:FlowLeafElement = textFlow.getFirstLeaf();

while (leaf)

{

   leaf.fontSize = leaf.computedFormat.fontSize + 2;

   leaf = leaf.getNextLeaf();

}

and then recompose

Regards,

RIchard

Participating Frequently
July 10, 2009

Hi,


thnks for ur solution. it s helpful.. but still i have one issue that. how to embed fonts and change from style .. like textfield.


                if (label.toUpperCase() == "SMALL")
                {
                    StyleManager.getStyleDeclaration(".heading").setStyle("fontSize", 21);

                      StyleManager.getStyleDeclaration(".subheading").setStyle("fontSize", 17);
                }
                else if (label.toUpperCase() == "MEDIUM")
                {
                    StyleManager.getStyleDeclaration(".heading").setStyle("fontSize", 23);
                    StyleManager.getStyleDeclaration(".subheading").setStyle("fontSize", 19);
              
                }
                else if (label.toUpperCase() == "LARGE")
                {
                    StyleManager.getStyleDeclaration(".heading").setStyle("fontSize", 25);
                    StyleManager.getStyleDeclaration(".subheading").setStyle("fontSize", 21);
                }         


i need to to like this way  in TextLayout framework... any possiblity ..


pls let me know...


regards,

sundarapandian.k

Participating Frequently
July 10, 2009

Hi,

Please look at http://blogs.adobe.com/tlf/2008/11/ for font embedding (Note that the 'cff' transcoding paramter is called 'embedAsCFF' if you are using Flex Gumbo build 7972 or higher).

I don't know anything about StyleManager, but you can take a look at the SimpleEditorWithCSS example which shows how you can use styling in conjunction with TLF.

Hope that helps,

Abhishek

(Adobe Systems Inc.)