Setting the font of a UITextField control

I am using a UITextField control to create text offscreen, then I'm using ImageSnapshot to get a bitmap and draw it on the screen using graphics methods. It's working fine, except for one thing: for the life of me I cannot change the font used from Times Roman.
I've scoured the internet and tried many things, such as using a style (stylename=, not setStyle), trying the setTextFormat function, but nothing works.
I have a work-around using a label control that is part of the parent container with visible=false, but it is not correctly autosizing as I'd like and there are other issues that crop up in this approach.
Does anyone know how to how to set the font and get it to be used? Here is a snippet of code:
                    var sizeText : UITextField = new UITextField();
                    sizeText.autoSize = TextFieldAutoSize.LEFT;
                    sizeText.background = true;
                    var textFormat : TextFormat = new TextFormat( "Arial", 13, 0xAAAAAA );
                    sizeText.setTextFormat( textFormat );
                    sizeText.text = "blah";
                    var textBitmapData:BitmapData = ImageSnapshot.captureBitmapData( sizeText );
                    var coef:Number = Math.min( sizeText.measuredWidth / textBitmapData.width, sizeText.measuredHeight / textBitmapData.height );
                    sizeMatrix = new Matrix(coef, 0, 0, coef);
                    textBitmapData = ImageSnapshot.captureBitmapData( sizeText, sizeMatrix );
Thx in advance, d.

Maybe but doubtful.  Now that you are using TextField, you must next decide on whether you are using embedFonts or not and set that property correctly.  Next, I would set defaultTextFormat to the same TextFormat you are using for setTextFormat.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui

Similar Messages

  • Setting the font of the titlebar of JInternal Frames??

    hi all,
    i am trying to change the font of the titles of JinternalFrames..
    i have tried it but cant p*** compilation..
    i have done.. title.setFont(X,X,X);
    is it possible to set the fonts of titlebars of frames?
    If i cant do it like this, is there another way around this?
    thank u ..

    If you tried it and it doesn't work, then that likely means they work the same as JFrames, where the title bar is rendered by the operating system and not by Java. If you are using Windows, that means you have to go into the Control Panel and adjust the Display properties to change the font.

  • How can I set the font size of a form field in the fdf file?

    I need to dynamically set the font size of a field to accommodate text of varying length, automatic font size won't work in this case. It seems like this can be done in the FDF but I have tried several variants without success. Could someone help out with a real example of what the syntax in the fdf should look like.
    I am using Acrobat Professional 8.1 but the created fdf will need to work with Reader also.

    I think that the font size has to be set in the form itself, not the FDF.

  • How do I set the font in firefox 4.0 using ubuntu?

    The zoom feature is OK but I want to permanently set the font size on my firefox pages using the Ubuntu operating system. I don't see anything under Tools and there doesn't seem to be a lot of questions previously asked in the Help area about Firefox in Ubuntu.

    It's difficult to set a single font size without wrecking the display of most web sites. One alternative would be to store your preferred zoom level and apply that to all sites. This requires an add-on such as:
    * [https://addons.mozilla.org/en-US/firefox/addon/6965/ Default FullZoom Level]
    * [https://addons.mozilla.org/en-US/firefox/addon/2592/ NoSquint]
    Does that work for you?

  • Formatting issues: when I open a msg, the font is sooo small you need a magnifier to read it. How can I set the font size to one I can easily read?

    == Issue
    ==
    I have another kind of problem with Firefox
    == Description
    ==
    I have various formatting issues:
    a. When I open a msg from my web browser (Cablevision), the font is sooo small I need a magnifier to read it. How can I set the font to a size I can easily read?
    b. When I forward msgs, the text gets all distorted and I need to clean it up (some symbols, lots of spaces between words). How can this be fixed?
    c. When I want to tell someone about a website, I cannot type the URL in so that all they have to do is click on it. How can this be fixed?
    d. When I open messages, the text opens in a small window and covers the "Show Images" button. Why?
    == This happened
    ==
    Every time Firefox opened
    == Ever since I started using Firefox (a few months ago)
    ==
    '''Troubleshooting information'''
    I didn't find any results
    == Firefox version
    ==
    3.6.3
    == Operating system
    ==
    Windows 7
    == User Agent
    ==
    Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
    == Plugins installed
    ==
    *-nphpclipbook
    *Office Plugin for Netscape Navigator
    *The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
    *Default Plug-in
    *Adobe PDF Plug-In For Firefox and Netscape "9.3.2"
    *NPRuntime Script Plug-in Library for Java(TM) Deploy
    *The Hulu Desktop Plugin allows Hulu.com to integrate with the Hulu Desktop application.
    *Shockwave Flash 10.0 r45
    *Adobe Shockwave for Director Netscape plug-in, version 11.5
    *iTunes Detector Plug-in
    *3.0.40624.0
    *NPWLPG
    *Next Generation Java Plug-in 1.6.0_20 for Mozilla browsers

    The text editor is the text area that you use on the webmail (Yahoo, Hotmail) website to create a new mail.
    You can compare that with the ''Post new message'' text area that you use to create a new post on this forum.
    Just above the text area that you use to enter the message text there is usually a button bar with buttons that allows some text formatting like Bold and Italic and can also include a button to make a clickable hyperlink.
    Check the tooltip of each button by hovering with the mouse over each button.
    Make Link - https://addons.mozilla.org/firefox/addon/142

  • How do you set the font color for a specific entire row inside a JTable?

    How do you set the font color for a specific entire row inside a JTable?
    I want to change the font color for only a couple of rows inside a JTable.
    I've seen some ways to possibly do this with an individual cell.
    Clarification on changing the font color in an individual cell would be helpful too if
    there is no easy way to do this for a row.

    hai,
    Try out with this piece of code.Create your table and assign the renderer to each column in the table.
    CellColorRenderer m_CellColorRenderer = new CellColorRenderer();
    for(int i=0;i<your_JTable.getColumnCount();i++)
    your_JTable.getColumnModel().getColumn(i).setCellRenderer(m_CellColorRenderer);
    class CellColorRenderer extends JLabel implements TableCellRenderer
    CellColorRenderer()     
    setOpaque(true);     
    setHorizontalAlignment(LEFT);
    setVerticalAlignment(CENTER);
    setBackground(Color.white);
    setForeground(Color.black);
    protected void setValue(Object value)
         setText((value == null) ? "" : value.toString());
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected, boolean hasFocus, int row,int column)
         if(isSelected == true)
              setForeground(Color.red);
         else
              setForeground(Color.black);
         setValue(value);
         return this;
    regards,
    bala

  • Setting the Font in Mail

    I'd like to set the font for outgoing mail to be Georgia. I'd like to have Mail format the message so when the recipient reads it, it is also formatted in Georgia. I would not like to do this for each message individually, I'd like to have this default for all outgoing message. Can anyone tell me how to do this is Mail on OS X Lion

    Hello,
    In Mail Preferences>Fonts & Colors, what is the Message Font set to?

  • How to set the font of a table header?

    Hi,
    Is there a way to set the font of a table header? I do not mean how to change the header word but the font.
    Thanks
    Stephen

    Hi,
    for combobox in a table (I assume the combobox is shown un column 2, thus the index 1)
    oracle.jbo.uicli.jui.JUTableLOVEditor lovCellEditor = (oracle.jbo.uicli.jui.JUTableLOVEditor) jTable1.getColumnModel().getColumn(1).getCellEditor();
    lovCellEditor.getComponent().setFont(new Font("Arial",Font.BOLD,13));
    For the LOV panel this is a bit more complicated because you need to create a custom LOV panel as described in http://www.oracle.com/technology/products/jdev/howtos/10g/jclientlov/customadfjclientlovpanel.html
    I filed a bug today to expose the component on a LOV to public so they can be modified
    Frank

  • How to set the Font size of Label?????

    Hello everyone.
    I want to knoe how to set the Font size of the Label???
    Please help..
    Thanks a lot.
    Gloria

    Label myLabel = new Label("Hello World");
    //Font(String name, int style, int size)
    myLabel.setFont(new Font("Arial", Font.PLAIN, 12));

  • How do I set the font size in a call out (box) tool

    How do I set the font size in a call out (box) tool ?

    Good Morning Mr. Alheit,
    Thanks for this bit of apparently obscure knowledge...  <<ctrl +e>>
      - I'll bet there is more user functions in  Adobe Acrobat 9 that I'm not
    aware of, too...
      - What reference source do your use?
    M/G

  • Setting the font

    I am trying to figure out how to set the font and this is what I have come up with up so far:
    AIFontKey fontKey;
    error = sAIFont->FindFont( "Arial", kAIAnyFontTechnology, kRomanAIScript, true, &fontKey );
    if (error) throw (error);
    FontRef fontRef;
    error = sAIFont->FontFromFontKey( fontKey, &fontRef );
    if (error) throw (error);
    IFont iFont( fontRef);
    features.SetFont( iFont);
    I am not sure if I am doing this correct. I took most of this code form another post, but was  not sure how to implement the code.
    I am trying to set the font and am using the below code to set the font size and the position of the text:
    ATE::IParaFeatures justif;
    ATE::ICharFeatures features;
    justif.SetLeadingType(ATE::kRomanLeadingType);
    justif.SetStartIndent(kAIRealZero);
    justif.SetFirstLineIndent(kAIRealZero);
    features.SetTracking(kAIRealZero);
    //Justification.
    justif.SetJustification(kCenterJustify);
    //Size
    features.SetFontSize(10);
    AIArtHandle artGroup = NULL;
    error = sAIArt->GetFirstArtOfLayer(NULL, &artGroup);
    aisdk::check_ai_error(error);
    // Add the new point text item to the layer.
    AITextOrientation orient = kHorizontalTextOrientation;
    AIRealPoint anchor = {this->fEndPoint.h,this->fEndPoint.v-4};
    AIArtHandle textFrame = NULL;
    error = sAITextFrame->NewPointText(kPlaceAboveAll, artGroup, orient, anchor, &textFrame);
    aisdk::check_ai_error(error);
    // Set the contents of the text range.
    TextRangeRef range = NULL;
    error = sAITextFrame->GetATETextRange(textFrame, &range);
    aisdk::check_ai_error(error);
    ITextRange crange(range);
    crange.SetLocalCharFeatures(features);
    crange.SetLocalParaFeatures(justif);
    crange.InsertAfter("X");
    Any help would help thanks daniel

    Okay, here is what I decided to do...it is lame, but it works. Thanks for the help. : )
    char buf[250], fonttext[500];
    short forfont;
    long fontCount = 0;
    int font_value;
    error = sAIFont->CountFonts(&fontCount);
    //char buffer[sizeof(long)*8+1];
    //MessageBox(NULL, ltoa(fontCount, buffer, 10), "Font Num", 0);
    aisdk::check_ai_error(error);
    for (int i = 0; i < fontCount; i++)
    // Report each font name to the log.
    AIFontKey fontKey = NULL;
    error = sAIFont->IndexFontList(i, &fontKey);
    aisdk::check_ai_error(error);
    error = sAIFont->GetUserFontName(fontKey,fonttext,forfont);
    if(strcmp(fonttext, "Arial Bold") == 0)
    font_value = i;
    break;
    else
    font_value = -1;
    aisdk::check_ai_error(error);
    FontRef fontRef;
    AIFontKey fontKey = NULL;
    //For instance, 10 is a number of the font in the font list.
    error = sAIFont -> IndexFontList(font_value, &fontKey );
    error = sAIFont -> FontFromFontKey ( fontKey, &fontRef );
    ATE::IFont iFont( fontRef );
    features.SetFont( iFont );

  • Setting the font of the titlebar on JInternalFrames

    hi all,
    i am trying to change the font of the titles of JinternalFrames..
    i have tried it but cant pass compilation..
    i have done.. title.setFont(X,X,X);
    is this possible to set the fonts of titles of frames?
    If i cant do it like this, is there another way around this?
    thank u ..

    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2BJTabbedPane+%2Btab+%2Bfont&col=javaforums

  • Setting the Font of Selected Tab in JTabbed Pane

    Hi,
    i have A JTabbedPane , I want to set the font of the selected tab to be bold. Can anyone please tell me how can i do that...
    waiting for reply ,
    Bye
    Sanjeev

    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2BJTabbedPane+%2Btab+%2Bfont&col=javaforums

  • Need to set the tab order in HTMLB controls

    I readed in another thread that it was not possible to set the tab order in HTMLB controls on BSP forms.
    However it was possible to do a little workaround, by setting the tooltip property, and put in the tabindex in that. Because Browsers do understand the property tabindex.
    Examble:
    <htmlb:inputField id="authorfname1"
    tooltip='tooltip1" tabindex="2'
    value = "<%= authorfname %>" />
    HTML Output would be like this:
    <input title="tooltip1" tabindex="2" class="sapEdfTxtEnbl"
    size="20" name="authorfname1" id="authorfname1" value="">
    <b>It works a little bit differently in my HTMLB controls.</b> Output is like this:
    <input title="tooltip1&quot; tabindex=&quot;2" class="sapEdfTxtEnbl"
    size="20" name="authorfname1" id="authorfname1" value="">
    <i>It doesn't work. " becomes &quot; <b>How do I solve this?</b></i>

    thanks for sharing the info.
    to handle your issue you could do the following
    <% data: replace_string type string .
    clear replace_string .
    replace_string = `<input  tabindex="2"`.
                  %>
                  <bsp:findAndReplace find    = "<input"
                                      replace = "<%= replace_string                  %>" >
                   <htmlb:inputField id="authorfname1"
    tooltip="tooltip1"
    value = "<%= authorfname %>" />
                  </bsp:findAndReplace>
    Hope this helps.
    Regards
    Raja

  • How to set the font size on only one object!

    I wonder how i could programmatically set the font size on only one object?
    Igor Stojčević

    Hello,
    You can use the builtin SRW.SET_FONT_SIZE
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/builtins/srw/srw_set_font_size.htm
    in the Format trigger
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwrefex/plsql/triggers/tr_format_trigger.htm
    Regards

Maybe you are looking for

  • Exporting to PDF right hand text trunctation when using ForceLargerFonts.

    Hi, We are using Crystal Reports Basic .NET 2008 SP0 (10.5.3700.0) under ASP.NET.  We have decided to use the PDF printing option instead of ActiveX which works fine except for the font sizing issues.  After reading a few articles we resolved the fon

  • FINDER keeps crashing on Mavericks 10.9

    FINDER keeps crashing since upgrading to Mavericks 10.9 even after downloading the os critical updates. Even  using "Right click + Option" to relaunch Finder does not work. Thus far the only solution is to close down all apps and do a Restart. Unplea

  • Emergency Reponse Error on IP communicator CCM v7

    I am seeing many of my Ip communicator users receive Emergency response errors when they first launch the application. this has never happened before we upgraded to ccm 6 then 7 a few months back. How do I troubleshoot this problem?

  • Dashboard Stock Widget graphs affected by DST

    I noticed this problem last year, but didn't really put two and two together until recently... All the daily graphs for the stock exchange on Apple's default Stocks widget are correct during daylight saving time, but when on standard time during the

  • ITunes Crashes 100%

    I am running iTunes 12.0.1.26 - iTunes works well, that is until I try to sync it. The minute I try to sync my iPhone - wirelessly or by usb, it kills it. this has only started in the last day. I just now tried to replicate the problem and it complet