How to set fontFamily with an embedded font of a textFlow ?

Hy,
When I create a TextFlow without use any component of the flex SDK (4.0.13827) and then I try to change or apply a FontFamily of an embedded font, it doesn't work. Whereas when I use a component like RichEditableText or Label, it works.
Bellow the code I wrote for my test :
<?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"
                            creationComplete="creationCompleteHandler(event)"
                            width="800" height="600"
                            >
     <fx:Style>
          @namespace s "library://ns.adobe.com/flex/spark";
          @namespace mx "library://ns.adobe.com/flex/mx";
          @namespace local "*";
          @font-face {
               src:                         url("assets/Fonts/arial.ttf");
               fontFamily:                  ArialEmbedded;
               advandedAntiAliasing:      true;
               cff:                              true;
               unicodeRange:                U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+00A1-U+00FF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183;
          @font-face {
               src:                         url("assets/Fonts/cour.ttf");
               fontFamily:                  CourierEmbedded;
               advandedAntiAliasing:      true;
               cff:                              true;
               unicodeRange:                U+0020-U+002F,U+0030-U+0039,U+003A-U+0040,U+0041-U+005A,U+005B-U+0060,U+0061-U+007A,U+007B-U+007E,U+00A1-U+00FF,U+2000-U+206F,U+20A0-U+20CF,U+2100-U+2183;
          s|WindowedApplication
     </fx:Style>
     <fx:Script>
          <![CDATA[
               import flash.text.Font;
               import flash.text.engine.FontLookup;
               import flashx.textLayout.container.ContainerController;
               import flashx.textLayout.conversion.TextConverter;
               import flashx.textLayout.edit.EditManager;
               import flashx.textLayout.edit.IEditManager;
               import flashx.textLayout.elements.TextFlow;
               import flashx.textLayout.events.SelectionEvent;
               import flashx.textLayout.formats.TextLayoutFormat;
               import flashx.undo.UndoManager;
               import mx.collections.ArrayCollection;
               import mx.events.FlexEvent;
               import spark.core.SpriteVisualElement;
               import spark.events.IndexChangeEvent;
               private var dynTextFlow : TextFlow;
               private var ctTextFlow : TextFlow;
               protected function creationCompleteHandler(event:FlexEvent):void
                    controlBarVisible=false;
                    dynTextFlow = TextConverter.importToFlow("Hello World", TextConverter.PLAIN_TEXT_FORMAT);
                    drawTextBloc(dynTextFlow);
                    dynTextFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, selectionChangeListener);
                    dynTextFlow.fontFamily = "ArialEmbedded";
                    dynTextFlow.fontLookup = FontLookup.EMBEDDED_CFF;
                    dynTextFlow.fontSize = 24;
                    dynTextFlow.interactionManager = new EditManager(new UndoManager());
                    dynTextFlow.flowComposer.updateAllControllers();
                    dynTextFlow.invalidateAllFormats();
                    dynTextFlow.flowComposer.updateAllControllers();
               protected function cbFont_creationCompleteHandler(event:FlexEvent):void
                    var fonts:ArrayCollection=new ArrayCollection(Font.enumerateFonts());
                    cbFont.dataProvider=fonts;
               protected function cbFont_changeHandler(event:IndexChangeEvent):void
                    var cf : TextLayoutFormat = new TextLayoutFormat();
                    cf.fontLookup = FontLookup.EMBEDDED_CFF;
                    cf.fontFamily = ComboBox(event.currentTarget).selectedItem.fontName;
                    IEditManager(ctTextFlow.interactionManager).applyLeafFormat(cf);
                    ctTextFlow.interactionManager.setFocus();
               private function drawTextBloc(txt : TextFlow) : void
                    var container : SpriteVisualElement = new SpriteVisualElement();
                    var controller : ContainerController = new ContainerController(container, 300, 200);
                    addElement(container);
                    txt.fontLookup = FontLookup.EMBEDDED_CFF;
                    txt.fontFamily = "ArialEmbedded";
                    txt.flowComposer.addController(controller);
               private function selectionChangeListener(event : SelectionEvent) : void
                    ctTextFlow = event.currentTarget as TextFlow;
               protected function txt_selectionChangeHandler(event:FlexEvent):void
                    ctTextFlow = (event.currentTarget as RichEditableText).textFlow;
          ]]>
     </fx:Script>
     <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <s:layout>
          <s:VerticalLayout paddingLeft="10" paddingTop="10"/>
     </s:layout>
     <s:RichEditableText x="10"
                              y="10"
                              selectionChange="txt_selectionChangeHandler(event)"
                              paddingTop="5" paddingLeft="5" paddingRight="5" paddingBottom="5"
                              id="txt"
                              fontFamily="CourierEmbedded"
                              text="RichEditableText"
                              height="200"
                              width="350"/>
     <s:ComboBox id="cbFont"
                    labelField="fontName"
                    creationComplete="cbFont_creationCompleteHandler(event)"
                    change="cbFont_changeHandler(event)"
                    />
     <s:Label text="TEST" fontFamily="CourierEmbedded" fontSize="22" rotation="45"/>
</s:WindowedApplication>
Please, help me...
Thank you very much...

Thank you very much,
I finally found the solution using the swfContext :
use namespace mx_internal;
myTextFlow.swfContext = ISWFContext(getFontContext("myFontName", false, false, FontLookup.EMBEDDED_CFF));
It works fine both with a dynamic component like RichEditableText or a dynamic textflow with a ContainerController.
Thanks

Similar Messages

  • How use set up with office 2011 for mac as I did keep tried put download but it's always 'update' download. I want get start set up new office 2011 for mac? please help me

    how use set up with office 2011 for mac as I did keep tried put download but it's always 'update' download. I want get start set up new office 2011 for mac? please help me

    You must be using an update CD.  You need the software that has the full version first - install that, then you can use the update one if needed. I know, cuz I made the same mistake - lol

  • How to set up a pdf embeded with different code so that people can get different excess code after they paid on-line?

    For example, I want to set up a pdf embeded with code, and send it on-line. People who want it should pay for it first and get the access code. I need to set different access code in order to avoid people A give the access to people B.

    Unless you use a very expensive DRM protection measure, I don't see how it's possible. How can you prevent someone from sending a file with the password to someone else?

  • How can embed fonts into a PDF? Additionally, how can I make so that the PDF then opens with the embedded font?

    I need to embed a standard font (such as Times New Roman) and make it so that the document opens with this font presented. I see information on embedding fonts, but nothing related to the second part of my question. Thanks.

    The second part is automatic. If you manage to embed a font (for example with Preflight in Acrobat Pro), then a PDF viewer should use that. In some cases a locally installed font of the SAME NAME might take preference, which is only a difficulty if a private edited font is used.

  • Using HTML text with an embedded font in Flex 4

    I have spent a day searching the interwebs and have not found a working example of how to use an embedded font with html formatting.
    Anybody know if it can even be done??

    Should be doable, but all fonts used in the html have to be embedded, and
    one of the fonts should be specified as the fontFamily for the component.

  • How-To Set Up with Uverse Gateway with Airport Extreme

    I just spent hours figuring this out so I thought it would be helpful to someone. Maybe, maybe not. My goal was to get Back to My Mac turned on...but this should also be how you set up your wireless network if you have both an Airport Extreme and a Uverse Gateway.
    As I was trying to setup BTMM, I got a "double NAT" error. To use BTMM, you have to use either Time Capsule or Airport Extreme, so that NAT has to be enabled. That meant I had to figure out how to turn off U-verse's. I looked through the settings but saw nothing about it. Several hours of research--and a useless support call to AT&T--I finally figured it out. Here's the configuration you need, in brief.
    On the Airport Extreme, under Internet > Internet Connections, Connection Sharing must be set to "Share a public IP address". Then under the NAT button, Enable NAT Port Mapping Protocol must be checked.
    Now, unless you doe rest of this configuration, you will get a double DHCP error. So, in the Uverse Gateway settings, you must do this:
    1. Under Wireless, click the option to DISABLE wireless. Click Save.
    2. Under Firewall, click the option with DMZ in the name. On this page, choose your Airport Extreme (whatever you named it). Then scroll down and choose the option that says "Allow All Applications (DMZPlus Mode)". Save that configuration. DO A HARD RESET ON THE AIRPORT EXTREME. Then that should enable a single NAT protocol and BTMM will be on its way. And your wireless network will be set up properly.

    Will the above method work on a set up with a Verizon Modem to a DLink wireless router to a Time Capsule?
    I know of no reason why it would not. Whenever there is another router ahead of the Time Capsule, the Time Capsule must be configured in Briddge Mode. My network has 4 routers. The "main" router is setup to handle DHCP and NAT and the other 3 routers are setup in Bridge Mode. No problems.
    Weird thing is Air Video set up tells me I have a double NAT
    Double NAT occurs when you have two routers on a network both set up to handle DHCP and NAT services. Your Verizon "modem" may be a gateway....a combination modem/router on the same chassis. If that's the case, then every other router on the network must be confgured as a "Bridge".
    If you have the "main" router on the network setup to handle DHCP and NAT, in theory, you can have multiple other routers on the network as long as they are all setup in Bridge Mode. In Bridge Mode, DHCP and NAT are turned off, so the other routers simply pass through the network information from the main router. It's by far the easiest way to configure multiple routers without having to go into special DMZ, port mapping, etc type of configurations.

  • Text display issues with htmlText, Embedded Font

    Hey All,
    I'm having an issue with the display of my hyperlinks in a
    textfield that is using embedded fonts. It offsets the hyperlinks
    to the left along the line they are on and the underline doesn't
    stretch all the way under the text field. The text display normally
    when I don't embed the font. For some reason I think this might
    have to do with the embedded character range so I opened it up.
    Does anyone know if this range is enough or if there are special
    characters flash uses that need to be embedded for their width even
    though they arn't displayed.
    Embedded range:
    [Embed(source='MyriadPro-Regular.otf', fontName='Myriad Pro',
    unicodeRange='U+0000-U+00fe')]
    Here's a link to the related code:
    http://pcpnew.privatepaste.com/a7eKaAuCTt

    Any ideas?

  • How to set encoding  with xmldom ?

    Hello !
    I have to build an xml file from a query.
    I need to have : <?xml version="1.0" encoding="ISO8859-1"?> on the first line.
    I know how to set the version --> xmldom.setVersion(doc,'1.0'); ... but I don't know how to set the encoding.
    Is there a way to set it ?
    Thanks

    No. It is not possible. Here is an extract of a document I found on metalink :
    (XML Parser for PL/SQL FAQs)
    Q: Is it possible to dynamically set the encoding in the XML document?
    A: No, you must include the proper encoding declaration in your document, as
    per the specification. You cannot use setCharset(DOMDocument) to set the
    encoding for the input of your document. SetCharset(DOMDocument) is used
    with oracle.xml.parser.v2.XMLDocument to set the correct encoding for
    printing of the document.

  • How to set volume with AudioServicesPlaySystemSound?

    I got playing sound with AudioServicesPlaySystemSound working, its quite simple but theres no documentation on how to set volume at all. Is it possible and how?

    Did you ever find an answer to this? I need to do the same thing.

  • Refying PDF with subset embedded fonts fixes text extraction

    Hi All,
    I know it is not a good idea to (just) refry PDF files (PDF -> EPS -> PDF). Especially when the PDF contains subset embedded fonts. Chances are you will end up with a PDF file which does not contain valid (searchable) text.
    I did not know the apposite could also be true. The following zip file contains 2 PDF files echo containing two words: the original and the refried version.
    Refried.zip
    When selecting text from the original PDF (using acrobat 6 through X) file it contains incorrect text, in this case invalid capitals. If I try the same in the refried version the extracted text is correct.
    It seems strange to me that a process which only can result in loss of information "fixes" this text issue. Somewhere the correct text must be hidden in the original PDF file. Not only capitals seem to be effected but also random characters which seem to be fixed once refried.
    Could anyone think of an explanation?
    Is there a workaround without having to refry the PDF (refrying often results in loss of information). I have no influence on the PDF files I recieve, therefore I cannot embed the full fonts.
    I am using de C++ SDK for Acrobat to write plugins.
    Any pointers would be great!
    Kind regards,
    Robert

    Thanks again for your reply,
    Your explanation makes sense.
    I went ahead and removed the tounicode cmap just to see what would happen
           if (CosDictKnown (cosFont, ASAtomFromString ("ToUnicode")))
             CosDictRemove (cosFont,ASAtomFromString ("ToUnicode"));
    As you predicted this fixes some issues and introduces new ones.
    The results differed from the refry method, in some cases the refried PDF did not contain extractable  text, in other cases the PDF without "ToUnicode Cmap" had no extractable text.
    Maybe I could combine the information of different text extraction methods to make an educated gues which one (or combination of) is best :S
    I suppose looking at individual textruns (with all its complexity) would not help me either...
    Kind regards,
    Robert

  • How to set  dbURL with characterEncoding

    hi all,
    How can I add characterEncoding in my JDBC connection, do I need to do that inorder to insert and display Chiness character into mysql db?
    Thank you!

    Hi,
    BTITLE works a lot like TTITLE. See your other thread:
    how to set page number & current date in sqlplus result
    It's not considered nice to post (essentially) the same question more than once.
    If it happens by accident (which is easy to do on this site) then mark one of the duplicate threads as "Answered" right away.

  • Do embedded fonts work in TextFlow yet?

    Embedded fonts aren't working for me in TextFlow for SDK build 8537. I added the embedAsCFF: true thing, and the font does show up in Spark controls; it's just not working when I use it in TextFlow (defaults to Times). Non-embedded fonts are working fine though in TextFlow, the problem is only with the embedded ones. Is this a known issue at this time?

    Turns out this is because of the linkage setting to RSLs in the newer SDK builds, Adobe is looking at this. Check outhttp://forums.adobe.com/message/2121775#2121775 for details/workaround.

  • How to import images with path embedded in XML tag

    I have a website that has blogs with embedded images. I need to design an XML that can be imported in Indesign. I am able to import XML and lay it out in Indesign if I have only text. But I am not able to include or show the intermittent, embedded images in Indesign. Can this be done? -Thanks

    I can drag an image from, for example, the desktop, but if I delete that file on the desktop I won't be able to open that image in iPhoto, even if I've imported it
    That's an indication that you may have your library set up as a referenced library:
    Check the Advanced preferences in iPhoto to see if that checkbox is selected or not.  If it isn't checkec, check it and try importing agan. 
    To make sure all Photo Stream photos are automatically imported into your library set up iPhoto's PS preferences like this:
    You should read this User Tip by Terence Devlin which is the best treatise on how to access photos (for use outside of iPhoto):  How to Access Files in iPhoto
    OT

  • How to set up with cacheing DNS for local network?

    Our new Lion Server has a static IP Address pointed to over the internet by our registrar's zone file. Planning the Lion Server installation process with the intent of hosting Web, Mail and Open Directory services to a small number of users who are nearly all located off-site. I do also want Lion Server to be a caching DNS Server and DHCP authority on the local network to replace what dnsmasq does on our current Linux server.
    I am looking forward to offloading some of the lower level Linux administration tasks and putting myself in the hands of the Lion Server Setup Assistant and Server App :-) but at the same time don't understand some of  its assumptions and fear having to spend a lot of time experimenting and re-installing.
    So, specifically, I want the Server App to know that my Lion Server has a "Host Name for the Internet" but that the DNS it sets up will not be the DNS for my zone - I will be managing that through my registrar's interfaces.
    Second problem is my fnot understanding what name space devices on the local network will / should use. e.g.  The Linux server will be available for backups etc  on the local intranet (and optionally have a static ip address on the Internet) but MacBooks, PCs, iPads and iPhones will be served ip addresses by the Lion Server's DHCP. So will / should these dynamic devices have their machine names fully qualified by our domain name with RFC 1918 style ip addresses or something like .local?  How do I tell this to Lion's Server App / Setup Assistant? How easy is it to update these initial settings later?

    You do indeed need to have a master zone on lion server.  There's no way to get around that since Open Directory depends on Kerberos and Kerberos depends on the DNS.  LS scripts may see that the rDNS record exists, but I highly doubt that it'll auto configure everything for you... and given the number of possible variables, I bet that even if it worked something would need additional tweaking.
    Sounds like an interesting lab excersize.  You should try it on a test server!
    Again... you just need to folow the set up procedure that Lion Server presents you with. 
    It won't be smart enough to see your external records and use them to configure a key distribution center for your OD. 
    As far as your caching needs...  Could you set up your DHCP server to set the DNS server setting to show your internal server as the first hit, and your external as the second?  That way when the client requests a resolution it'll not get a hit on your local server but will from the external? 
    The question then is how long will it wait for a response from the first server?  Or will the first server respond with "I don't know" sending the client immediately to the second.
    The server set up that I have works similarly.  I have an internal master DNS that is replicated to a secondary.  The first DNS has an A record (community.server.com) that points to the INTERNAL ip address of the secondary server that's also running the web service.  The first server is running DHCP.  It tells the clients to use the first and second servers as it's DNS lookup. 
    Now...  Externally, my registrar hosts an A record for community.server.com that points to the external IP address of my router which then forwards the request to the proper port on the internal network.
    This way, the local clients internally look up and get a response locally when they go for community.server.com.  Externally, clients that look up community.server.com get the external connection to the router in my school.
    Yikes...  I fear that this is as clear as mud!
    -Graham

  • How to set the size of a Font in Pixel?

    Hi,
    i know how to get the screen resolution of the current monitor and I know how to use Fonts (and I know how to read the API, but that didnt help).
    Is there a way to set the size (or at least the height) of a Font in pixel rather then in points?
    All I actually need is how many pixels the height of my String will be when I print it on the screen.
    I use Swing and drawString(...) to draw my String (this information shouldnt matter, but just in case).
    thanx

    Hi,
    search doc about FontMetrics, you'll find infos about how to get the font height... If I remember well, you need to get the Graphics of the component, then call getFontMetrics() or getFontMetrics(font) to obtain the metrics, then call getHeight() to know the font height...

Maybe you are looking for