Possible to use embedded font in TLFTextField, with TextFormat?

I want to be able to dynamically change the font in a TLFTextField to an embedded font (not a device font).  I'm using Flash CS5.
The only way I've found a TLFTextField will use an embedded font is if the on-stage TLFTextField has been set to use that font through the Flash UI.  The example code I've found online (Font.registerFont etc) all works fine for a TextField, but not TLFTextField.
Below is a very simple piece of code that I expected to work.  I have a font (Earwig Factory) embedded in my library (as DF4, linkage "Earwig"), and the isFontCompatible trace call prints "true", but still it is using the device font - if I remove the system font from my machine (or view the SWF on another machine) it falls back to Times New Roman.
Can anyone give a very simple example of a TLFTextField dynamically selecting an embedded font?  Eventually I would like to store my fonts in a separate SWC / SWF, but for now just working out of the Library would be a good start.
Thanks,
Grant
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.text.FontStyle;
import fl.text.TLFTextField;
import flash.text.engine.FontLookup;
var format:TextFormat = new TextFormat();
format.font = "Earwig Factory"
trace("Earwig Factory isFontCompatible: " + tf.isFontCompatible("Earwig Factory", FontStyle.REGULAR) );
tf.defaultTextFormat = format;
tf.embedFonts = true;
//tf.antiAliasType = AntiAliasType.ADVANCED;
tf.setTextFormat(format);
//tf.textFlow.fontLookup = FontLookup.EMBEDDED_CFF;

Ok, I have some success - I can get an on-stage TLFTextField to dynamically use an embedded font.  However, this is quite complex, and doesn't use a TextFormat.  And is this seriously the way Adobe intends us to do it - if so perhaps this should be documented better?
import fl.text.TLFTextField;
import flashx.textLayout.formats.TextLayoutFormat;
import flashx.textLayout.elements.TextFlow;
import flash.text.TextFormat;
import flash.text.AntiAliasType;
import flash.text.FontStyle;
import flash.text.Font;
import flash.text.engine.FontLookup;
import flashx.textLayout.edit.ISelectionManager;
import flashx.textLayout.edit.EditManager;
import flashx.textLayout.edit.SelectionState;
var updateTF:TLFTextField = stageTF;
var applyFont:Font = new Earwig();
updateTF.embedFonts = true;
var tlfFormat:TextLayoutFormat = new TextLayoutFormat();
tlfFormat.fontFamily = applyFont.fontName;
tlfFormat.fontLookup = FontLookup.EMBEDDED_CFF;
updateTF.textFlow.invalidateAllFormats();
updateTF.textFlow.hostFormat = tlfFormat;
var prevManager:ISelectionManager = updateTF.textFlow.interactionManager;
var editManager:EditManager = new EditManager();
var sel:SelectionState = new SelectionState(updateTF.textFlow, 0, updateTF.text.length);
updateTF.textFlow.interactionManager = editManager;
editManager.applyLeafFormat(tlfFormat, sel);
updateTF.textFlow.interactionManager = prevManager;
updateTF.textFlow.flowComposer.updateAllControllers();

Similar Messages

  • Is it possible to use the fonts I have in my Mac Font Book with Creative Cloud software, such as Illustrator and Photoshop?

    Is it possible to use the fonts I have in my Mac Font Book with Creative Cloud software, such as Illustrator and Photoshop?

    Hi Kyley,
    Syncing fonts from CC is a feature of Typekit. However, fonts that you've installed manually on your system will be available in all your apps. You won't need to sync them.
    I hope that helps. Let me know if you have any further questions.
    Cheers,
    Benjamin

  • This component requires that the embedded font be declared with embedAsCFF=false.

    I'm getting the following warning for my project.
    "warning: incompatible embedded font 'MyFont' specified for views::MyViewInnerClass0 (MyViewInnerClass0_61) . This component requires that the embedded font be declared with embedAsCFF=false."
    Here's what I have in my style.css file.
    /* CSS file */
    @namespace s "library://ns.adobe.com/flex/spark";
    @namespace supportClasses "spark.globalization.supportClasses.*";
    @namespace views "views.*";
    @font-face {
              src: url("assets/MyFont.ttf");
      fontFamily: "MyFont";
      advancedAntiAliasing: true;
      embedAsCFF: true;
    @font-face {
              src: url("assets/MyFont.ttf");
      fontFamily: "MyFont";
      advancedAntiAliasing: false;
      embedAsCFF: false;
    The 2nd font section I have is what is suggested as the fix in most places but that isn't working out for me. I wonder if I'm missing something else.

    I tried changing the name and it didn't work. Tried all sort of combinations too and none worked. Tried a different font and that didn't work too.
    Turns out the problem wasn't in the declaration of the fonts but where I was using it.
    I initially had the font declared globally
    global
       fontFamily: DroidSansMono;
    I saw that, in your comment you had mentioned "..then apply it to the component" so I applied the font to the label component
    s|Label
      fontFamily: DroidSansMono;
    and boom.. no warning. Problem solved.
    Thanks so much.

  • How to use embedded font

    Hi all,
    I have a flex application where i want to rotate the textarea.I have a mxml file and a .as file.I want to use the embedded font in my application.But I don't know anything.Please advice me details and also how to proceed to create embedded font,how to create the ttf file?I am not using any package and not using library path.
    Please help me.Thanks in advance.

    FangAvatar,
    looks like the same question as the other one we are talking about. The Live docs page
    http://www.adobe.com/livedocs/flex/3/html/help.html?content=fonts_04.html
    has ane xample with rotated labels just oevr half way down the page.
    If you are having trouble navigating with this link, just go to the root
    http://www.adobe.com/livedocs/flex/3/html/help.html
    then in the contents bar on the left open up
    User interfaces
    ...using fonts
    ......using embedded fonts
    the section is just above the heading "Using advanced anti-aliasing"
    Richard

  • This component requires that the embedded font be declared with embedAsCFF=true.

    Hey all,
    I fall into a small problem with fonts embedding. In my application I have embedded over 50 fonts and all expect one works as expected.
    That one shows an error "warning: incompatible embedded font 'Algerian-CFF' specified for spark.components::RichEditableText (RichEditableText310) . This component requires that the embedded font be declared with embedAsCFF=true."
    I have been looking all over the internet for similar problem, without success. Why this font is not working while all the rest does? Any clues?
    /* CSS file */
    @namespace s "library://ns.adobe.com/flex/spark";
    /* embedded font */
    @font-face {
    src: url("ttf/ALGER.ttf");
    fontFamily: Algerian-CFF;
    Thanks.

    Thanks,
    My issue is not to embed a font twice. Let me describe the issue so this will helpful.
    I have embed a fonts like below code.And apply LucidaBlackletterSpark font for spark component but it gives me error like
    "warning: incompatible embedded font 'LucidaBlackletterSpark' specified for spark.components::RichEditableText (RichEditableText2301) . This component requires that the embedded font be declared with embedAsCFF=true".
    But Font have already embedAsCFF property true. I am not able to find the solution why it is give me this warning.Due to that i am not able to embed a font.
    @font-face {
              src: url("assets/fonts/LucidaBlackletter.ttf");
              fontFamily: LucidaBlackletterSpark;
              embedAsCFF: true;
    @font-face {
              src: url("assets/fonts/LucidaBlackletter.ttf");
              fontFamily: LucidaBlackletterMX;
              embedAsCFF: false;

  • [svn:fx-trunk] 10545: Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts

    Revision: 10545
    Author:   [email protected]
    Date:     2009-09-23 13:33:21 -0700 (Wed, 23 Sep 2009)
    Log Message:
    Make DataGrid smarter about when and how to calculate the modulefactory for its renderers when using embedded fonts
    QE Notes: 2 Mustella tests fail:
    components/DataGrid/DataGrid_HaloSkin/Properties/datagrid_properties_columns_halo datagrid_properties_columns_increase0to1_halo
    components/DataGrid/DataGrid_SparkSkin/Properties/datagrid_properties_columns datagrid_properties_columns_increase0to1
    These fixes get us to measure the embedded fonts correctly when going from 0 columns to a set of columns so rowHeight will be different (and better) in those scenarios
    Doc Notes: None
    Bugs: SDK-15241
    Reviewer: Darrell
    API Change: No
    Is noteworthy for integration: No
    tests: checkintests mustella/browser/DataGrid
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-15241
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/DataGrid.as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridBase .as
        flex/sdk/trunk/frameworks/projects/framework/src/mx/controls/dataGridClasses/DataGridColu mn.as

    Hi Matthias,
    Sorry, if this reply seems like a products plug (which it is), but this is really how we solve this software engineering challenge at JKI...
    At JKI, we create VI Packages (which are basically installers for LabVIEW instrument drivers and toolkits) of our reusable code (using the package building capabilities of VIPM Professional).  We keep a VI Package Configuration file (that includes a copy of the actual packages) in each of our project folders (and check it into source code control just as we do for all our project files).  We also use VIPM Enterprise to distribute new VI Packages over the network.
    Also, as others have mentioned, we use the JKI TortoiseSVN Tool to make it easy to use TortoiseSVN directly from LabVIEW.
    Please feel free to contact JKI if you have any specific questions about these products.
    Thanks,
    -Jim 

  • Is it possible to use fullscreen and exclusive mode with a jfilechooser?

    is there a way to use them together? while in fullscreen exclusive mode the jfilechooser doesn't attach to fullscreen window and it halts the program.. I've tried setting the parent frame as the fullscreen frame but it's all glitched.. am I missing something?
    thank you,
    best regards,
    Jacopo

    For reference, the cross-post can be found here:
    Is it possible to use network devices (cDAQ-9188) with a PXI Real Time system?
    Jayme W.
    Applications Engineer
    National Instruments

  • Is it possible to use a new iMAC 2011 (with thunderbolt port) as a passive screen with a Macbook (MacBook5,1 - End 2008) ?

    s it possible to use a new iMAC 2011 (with thunderbolt port) as a passive screen with a Macbook (MacBook5,1 - End 2008) ?

    No, you would need to upgrade the MacBook to a 2011 MacBook Pro that also has Thunderbolt.
    Roger

  • Trouble with Preview not using embedded fonts in a PDF

    I have a client I'm working with that is generating PDF reports for various organizations in various languages. They are using an Arial Unicode font but are using different encoding for some of the more unique languages. To ensure the report will be viewable regardless of installed fonts, they are embedding the font.
    Most of the languages are showing up fine in preview, but three languages are giving me trouble. Specifically Greek, Russian and Thai which are using encoding EL8MSWIN1253, CP1251, and TH8TISASCII.
    Basically the question is whether there is some toggle that will tell Preview to use the embedded font? Or something we can put into the PDF (the pdf is created using FPDF) that will allow a user to know which font/encoding they'll need to install in order to properly view the document? (I'm actually trying to figure that out myself...which font I need to install to get preview to view the document properly).
    Thanks in advance for any help.

    Actually, I got that example to work... here are the changes
    I made...
    <mx:htmlText>
    <![CDATA[You can vary the <font size='20'>font
    size</font>,<br><font
    color="#0000FF">color</font>,<br><font
    face="Courier New">face</font>, or<br><font
    size="18"color="#FF00FF"face="Times New Roman">any combination
    of the three.</font>]]>
    </mx:htmlText>
    As I said above, I have found errors in the code of the help
    docs... this is yet another one of them. Usually its spaces in the
    wrong place, or no space at all, or missing ) or ], or a case
    sensitivity issue.
    If you got your custom font to display, that should work...
    but then again.. what should work, doesn't always.

  • How to use embedded font (CFF) for Flash CS4?

    Hi,
    I am trying to embed "Arial Unicode MS" for use by TLF in my Flash CS4 project. As I googled around, I am using the "Flex SWC" approach, only not having any luck. Here is what I got:
    //Code in Flex ActionScript project:
    package
        public class FontEmbeds
            [Embed(source='C:/Windows/Fonts/ARIALUNI.TTF',
                    fontFamily='ArialUnicodeMS',
                    embedAsCFF='true'
            public const Font1:Class;
    When I am trying to instantiate this class, I have AS code in my Flash main timeline:
    var font:Font = new FontEmbeds_Font1();
    Flash compiler says: "1067: Implicit coercion of a value of type FontEmbeds_Font1 to an unrelated type flash.text:Font."
    Ok. Now after I changed it to:
    var font:FontEmbeds_Font1 = new FontEmbeds_Font1();
    Flash gives 3 errors:
    "VerifyError: Error #1014: Class mx.core::FontAsset could not be found.
    ReferenceError: Error #1065: Variable TextLayout is not defined.
    ReferenceError: Error #1065: Variable MainTimeline is not defined."
    I am assuming I have to create a Font1 object in order to use the embedded font. Is this assumption correct? As I've tried to use the "fontFamily" directly but Flash didn't seem to find the font at all:
    charFormat.fontFamily = "ArialUnicodeMS";
    Thanks.

    Hi Eric,
    Thanks for the info.
    I've tried to use the "fontFamily" directly but Flash didn't seem to  find the font at all:
    charFormat.fontFamily = "ArialUnicodeMS";
    In one fla where I used pure TFL, nothing gets rendered at all in the container Sprite. Flash doesn't throw any errors either. In another fla where I used a ComboBox, etc. along with TFL, it throws an error says it can't compile since "there is no ActionScript found" and I got a screen where all the Flash components were  flickering. After several attempts, Flash crashed.
    Also as a side note, the swc gets generated by Flash Builder Beta 2, at first it was 18mb and the second time I complied it become 9mb and stayed 9mb afterwards. Not sure if that's a concern.
    Geng

  • Using embedded fonts

    Hi,
    I've embedded font into an SWF in the following manner:
    package resources.fonts
    import flash.display.Sprite;
    public class _Arial extends Sprite
    [Embed(source='c:/windows/fonts/Arial.ttf',
    fontName='_Arial')]
    public static var _Arial:Class;
    Now when I try to load it in my AIR app, I get "IFlexAsset
    could not be found" error when the file gets loaded. Any
    ideas?

    @Flex, thanks. I have tried, and succeeded in making swf containers for fonts in various ways including using the fontswf app but they never seem to be used after I have loaded them in the main application. I have asked a couple of questions here:
    http://stackoverflow.com/questions/12846752/embedded-font-flash-text-engine There doesn't seem to be any error message, the font just 'silently' isn't used. Do you think that it just isn't possible? The documentation I've been able to dig up all seems to indicate that it should be; including the sentence I quote above.

  • Embedding fonts in AS3 with absolute paths

    I'm having difficulty embedding fonts in AS3. For instance,
    using absolute paths:
    [Embed(source="C:\WINDOWS\Fonts\CONSOLA.TTF",
    fontName="Consolas", mimeType="application/x-font-truetype")]
    ... I get the error message: "Error: unable to resolve
    'C:WINDOWSFontsCONSOLA.TTF' for transcoding.
    I'm hoping the backslashes are missing from the error just
    because the compiler doesn't return them, and not that it's losing
    them. I've tried various TTFs with the same result. Even tried
    copying code from the AS3 Cookbook letter for letter. :)
    Thoughts?

    I have a similar issue happening. I am using AS3 and have
    this code in my file:
    // package, import statements etc...
    // the line below is the problematic line
    [Embed(systemFont="..\\..\\..\\fonts\\arial.ttf",
    fontName="Arial (True Type)",
    mimeType="application/x-font-truetype")]
    // now declare my class
    public class ImageRotator extends UIComponent
    // etc.
    The class compiles fine but when I try to run it I get the
    following runtime error:
    "Error: Error #2136: The SWF file
    file:///C:/projects/photogallery_screensaver/bin/photogallery_screensaver.swf
    contains invalid data."
    I've tried several things including changing the location of
    the font file, using a different font file, embedding a systemFont.
    But I always get the same error.
    Help please!
    Thanks,
    Dan

  • Using embeded fonts in loaded swf.

    I have a .Swf, which has 3 fonts embedded in it, they are all exported in frame 1 for AS.  This swf loads any number of external .swfs which have dynamically generated textfields inside of them.  This text must be embedded text because effects may be applied to them.  I do not want to embed the three fonts into every external swf, and do not think I should have to.  The font exists in the Loading swf and I have registered the fonts to the global font list.  If I print this list from the loaded swf, all three fonts are present, but when I try to use any of them, my textfiels are empty.
    My question is how do I utilize a font which is embedded in a swf, from a swf which has been loaded into that swf?
    From my external swf, this code:
    [PHP]var embeddedFonts:Array = Font.enumerateFonts(false);
    embeddedFonts.sortOn("fontName", Array.CASEINSENSITIVE);
    trace(embeddedFonts);[/PHP]
    produces the following:
    [PHP][object CenturyBook],[object MyriadProRegular],[object MyriadProItalic][/PHP]
    which are the three fonts that are embedded in the loading swf, So I assume the LOADED swf has access to these fonts.
    When I apply this code to the externally loaded swf:
    [PHP]var FontClass:Class = getDefinitionByName("MyriadProRegular") as Class;
    trace("FontClassInstance -> " + FontClass.toString());
    var linkedFont: Font = new FontClass();
    trace("Font name: " + linkedFont.fontName);
    var textFormat: TextFormat = new TextFormat(linkedFont.fontName, 14);
    //... The next lines set up the text box and apply the format.  I am sure this is done correctly.
    [/PHP]
    I get the following output:
    [PHP]FontClassInstance -> [class MyriadProRegular]
    Font name: Myriad Pro[/PHP]
    which is exactly what I would expect.  Yet, my text box is still blank.  I have embedText = true on the text box, and have applied a string to the "text" property, so it's nothing silly liek that.
    Any help would be appreciated...

    You may also want to look at the various embedded font format issues. Many of the Flex 4 components use a newer embedded font fortmat, which is not the same as the one generally used in Flash. So even if ther Flash font gets registered properly, it still may not work with some of the spark components.
    You should be able to create a swf using Flex that contains fonts embedded in either format, which can then be used in the way you describe, though, since Flex 4 suports both font formats.
    Hopefully, someone else will jump in here if I got some of this wrong.
    -JM

  • Is it possible to use the Apple wireless keyboard with the iPhone 6? Will the Magic Mouse work with iMovie on iPhone6 Plus?

    iPhone 6 page says that iMovie is a (free) application available for iPhone 6. When I use it on the desktop I need a mouse. Should I expect all controls to be touch-sensitive, or is it possible to use the wireless Magic Mouse? Similarly, if I want to type an email or a long document, is it possible to use the Mac wireless keyboard to enter text? With the iPhone 6 Plus taking over for laptops (phablet), it seems to me that input tools are relevant. Maybe what I'm asking is whether the iPhone6 (OS8) has drivers for these devices. Please advise.

    Apps that are designed for iOS devices such as the iOS version of iMovie are intended to be used entirely by touch. It's worth noting that iMovie for iOS is not absolutely identical to iMovie for Mac OS.

  • (How) can I use Embeded Fonts in Flex 3.3

    If I understand correctly, I need to transcode/embed the fonts in Flex 4 / CS 4, but is there any way to then get those embeded fonts into a Flex 3.3 application?

    Support for DefineFont4 (the cff property) is new in Flex Gumbo. It is not available in Flex 3.X. That said – I do have a solution for you. Create a separate Flex Gumbo project and use the cff property to embed the font you need into that SWF. Then embed the font SWF that you just created in Gumbo into your Flex 3.3 application.
    Check out the “Building a Font SWF for use in any Flash Application” section in my DefineFont4 blog post:
    http://blogs.adobe.com/tlf/2008/11/embedded_font_subsetting_using.html
    Here is an article on embedding a SWF in Flex:
    http://blog.flexexamples.com/2007/10/25/embedding-fonts-from-a-flash-swf-file-into-a-flex- application/
    Hope this helps!

Maybe you are looking for

  • Error in transformation in OSB

    Hi all, I am getting following error in transformation in OSB console: <con:reason>     OSB Assign action failed updating variable "PaymentRequestsPCMToEBS": com.bea.wli.common.xquery.XQueryException: Error parsing XML: {err}XP0006: "element {http://

  • How to work seperately with 2 MobileMe addresses in Mail?

    Hello! I have several MobileMe addresses I'd like to add to Mail. I'm already working with one (private), but would like to add a second one (business). I don't want the mails to show up together, but keep both adresses seperate in Mail. Can anyone t

  • Why System.in is blocking other IO call

    I was trying this simple program to run some test... package com.jpmc.ibtech.hycee.base; import java.io.IOException; public class TestThread {       * @param args       * @throws IOException      public static void main(String[] args) throws IOExcept

  • Complex datatype in Web Services

    The work involved in handling complex datatype as part of the Web Services (JDev 9.0.3) seems to be very complex and not very well documented. (as far as I can tell). Is there an easy way for a Java client to bypass the deserialization altogether and

  • Text determination for billing document

    pls tell me text determination for billing document.pls tell me each and every phace for text determination for header billing document; when am creting text determination am getting so many problems, i saw in text form in header text,but i didnot ge