You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flex.apache.org by "Dudda (JIRA)" <ji...@apache.org> on 2014/04/01 09:31:16 UTC

[jira] [Updated] (FLEX-34197) Text Layout Framework: change embedded fontFamily works in AIR doesn't work in FLEX(WEB)

     [ https://issues.apache.org/jira/browse/FLEX-34197?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dudda updated FLEX-34197:
-------------------------

    Description: 
i have a sample code, if you run it as an AIR windowedApplication it works, if you run it as a web page (s:Application) it doesn't.
I have AIR 3.8 and flex 4.6.0
The problem is the embedded font: in desktop application i can see the text changes in the textarea using TLF, in web it falls in the default font, but the font is there, since the other textarea displays it, so the problem seems to be the TLF.... but i can't understand what is wrong in the code.
 
the following is the code for AIR desktop application, to test the problem just create a  web application for flashplayer and replace windowedApplication with Application in the code
(you'll need also to have TopSecret.ttf, or another ttf font changing the referenced name accordingly in the code, in the main folder):

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                                     xmlns:s="library://ns.adobe.com/flex/spark" 
                                                     xmlns:mx="library://ns.adobe.com/flex/mx">
          <fx:Script>
                    <![CDATA[
                              import flashx.textLayout.formats.TextLayoutFormat;
                              import mx.events.FlexEvent;
                              import spark.events.IndexChangeEvent;
                              protected function fontDDL_changeHandler(event:IndexChangeEvent):void
                              {
                                        var txtLayFmt:TextLayoutFormat = dynamicArea.getFormatOfRange(null,
                                                  dynamicArea.selectionAnchorPosition,
                                                  dynamicArea.selectionActivePosition);
                                        txtLayFmt.fontFamily = fontDDL.selectedItem;
                                        dynamicArea.setFormatOfRange(txtLayFmt,
                                                  dynamicArea.selectionAnchorPosition,
                                                  dynamicArea.selectionActivePosition);
                              }
                    ]]>
          </fx:Script>
          <fx:Style>
                    @namespace s library://ns.adobe.com/flex/spark;
                    @namespace mx library://ns.adobe.com/flex/mx;
                    @font-face {
                              src: url(TopSecret.ttf);
                              fontFamily: TopSecret;
                              embedAsCFF:true;
                    }
          </fx:Style>
          <s:VGroup>
                    <s:TextArea text="this is a font Arial Text" fontFamily="Arial"/>
                    <s:TextArea text="this is a font TopSecret" fontFamily="TopSecret"/>
                    <s:TextArea id="dynamicArea" text="select this text and change font"/>
                    <s:DropDownList id="fontDDL" width="150" change="fontDDL_changeHandler(event);">
                              <s:dataProvider>
                                        <s:ArrayList id="fontList" source="[TopSecret, Arial, Courier New, Times, Verdana]" />
                              </s:dataProvider>
                    </s:DropDownList>
          </s:VGroup>
</s:WindowedApplication>

  was:
i have a sample code, if you run it as an AIR windowedApplication it works, if you run it as a web page (s:Application) it doesn't.
I have AIR 3.8 and flex 4.6.0
The problem is the embedded font: in desktop application i can see the text changes in the textarea using TLF, in web it falls in the default font, but the font is there, since the other textarea displays it, so the problem seems to be the TLF.... but i can't understand what is wrong in the code.
Can anyone help me to find a solution please?
or is it a known bug that i didn't find on the web?
 
the following is the code for AIR desktop application, to test the problem just create a  web application for flashplayer and replace windowedApplication with Application in the code
(you'll need also to have TopSecret.ttf, or another ttf font changing the referenced name accordingly in the code, in the main folder):

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                                                     xmlns:s="library://ns.adobe.com/flex/spark" 
                                                     xmlns:mx="library://ns.adobe.com/flex/mx">
          <fx:Script>
                    <![CDATA[
                              import flashx.textLayout.formats.TextLayoutFormat;
                              import mx.events.FlexEvent;
                              import spark.events.IndexChangeEvent;
                              protected function fontDDL_changeHandler(event:IndexChangeEvent):void
                              {
                                        var txtLayFmt:TextLayoutFormat = dynamicArea.getFormatOfRange(null,
                                                  dynamicArea.selectionAnchorPosition,
                                                  dynamicArea.selectionActivePosition);
                                        txtLayFmt.fontFamily = fontDDL.selectedItem;
                                        dynamicArea.setFormatOfRange(txtLayFmt,
                                                  dynamicArea.selectionAnchorPosition,
                                                  dynamicArea.selectionActivePosition);
                              }
                    ]]>
          </fx:Script>
          <fx:Style>
                    @namespace s library://ns.adobe.com/flex/spark;
                    @namespace mx library://ns.adobe.com/flex/mx;
                    @font-face {
                              src: url(TopSecret.ttf);
                              fontFamily: TopSecret;
                              embedAsCFF:true;
                    }
          </fx:Style>
          <s:VGroup>
                    <s:TextArea text="this is a font Arial Text" fontFamily="Arial"/>
                    <s:TextArea text="this is a font TopSecret" fontFamily="TopSecret"/>
                    <s:TextArea id="dynamicArea" text="select this text and change font"/>
                    <s:DropDownList id="fontDDL" width="150" change="fontDDL_changeHandler(event);">
                              <s:dataProvider>
                                        <s:ArrayList id="fontList" source="[TopSecret, Arial, Courier New, Times, Verdana]" />
                              </s:dataProvider>
                    </s:DropDownList>
          </s:VGroup>
</s:WindowedApplication>


> Text Layout Framework: change embedded fontFamily works in AIR doesn't work in FLEX(WEB)
> ----------------------------------------------------------------------------------------
>
>                 Key: FLEX-34197
>                 URL: https://issues.apache.org/jira/browse/FLEX-34197
>             Project: Apache Flex
>          Issue Type: Bug
>          Components: Embedded Fonts
>    Affects Versions: Adobe Flex SDK 4.6 (Release)
>         Environment: every platform (linux not tested)
>            Reporter: Dudda
>              Labels: embedded-fonts, flex, tlf
>             Fix For: Adobe Flex SDK 4.6 (Release)
>
>
> i have a sample code, if you run it as an AIR windowedApplication it works, if you run it as a web page (s:Application) it doesn't.
> I have AIR 3.8 and flex 4.6.0
> The problem is the embedded font: in desktop application i can see the text changes in the textarea using TLF, in web it falls in the default font, but the font is there, since the other textarea displays it, so the problem seems to be the TLF.... but i can't understand what is wrong in the code.
>  
> the following is the code for AIR desktop application, to test the problem just create a  web application for flashplayer and replace windowedApplication with Application in the code
> (you'll need also to have TopSecret.ttf, or another ttf font changing the referenced name accordingly in the code, in the main folder):
> <?xml version="1.0" encoding="utf-8"?>
> <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
>                                                      xmlns:s="library://ns.adobe.com/flex/spark" 
>                                                      xmlns:mx="library://ns.adobe.com/flex/mx">
>           <fx:Script>
>                     <![CDATA[
>                               import flashx.textLayout.formats.TextLayoutFormat;
>                               import mx.events.FlexEvent;
>                               import spark.events.IndexChangeEvent;
>                               protected function fontDDL_changeHandler(event:IndexChangeEvent):void
>                               {
>                                         var txtLayFmt:TextLayoutFormat = dynamicArea.getFormatOfRange(null,
>                                                   dynamicArea.selectionAnchorPosition,
>                                                   dynamicArea.selectionActivePosition);
>                                         txtLayFmt.fontFamily = fontDDL.selectedItem;
>                                         dynamicArea.setFormatOfRange(txtLayFmt,
>                                                   dynamicArea.selectionAnchorPosition,
>                                                   dynamicArea.selectionActivePosition);
>                               }
>                     ]]>
>           </fx:Script>
>           <fx:Style>
>                     @namespace s library://ns.adobe.com/flex/spark;
>                     @namespace mx library://ns.adobe.com/flex/mx;
>                     @font-face {
>                               src: url(TopSecret.ttf);
>                               fontFamily: TopSecret;
>                               embedAsCFF:true;
>                     }
>           </fx:Style>
>           <s:VGroup>
>                     <s:TextArea text="this is a font Arial Text" fontFamily="Arial"/>
>                     <s:TextArea text="this is a font TopSecret" fontFamily="TopSecret"/>
>                     <s:TextArea id="dynamicArea" text="select this text and change font"/>
>                     <s:DropDownList id="fontDDL" width="150" change="fontDDL_changeHandler(event);">
>                               <s:dataProvider>
>                                         <s:ArrayList id="fontList" source="[TopSecret, Arial, Courier New, Times, Verdana]" />
>                               </s:dataProvider>
>                     </s:DropDownList>
>           </s:VGroup>
> </s:WindowedApplication>



--
This message was sent by Atlassian JIRA
(v6.2#6252)