Calculate Font/Text Metrics

Hi all,
I need to calculate the width and height of a certain font with a specific text.
Short Example (values are fictitiouse):
Font="Arial" FontSize="10"
Text="acs" => width=30 & height=10
Text="acd" => width=30 & height=14
Text="acW" => width=38 & height=15
Text="gcW" => width=38 & height=22
Do somebody of you know a way how to do that? Fonts can't be embedded because list of fonts need to be device fonts...
Hope somebody can help me!
Thanks

Bumb and here is a sample code so you can try what I did so far
private function testToMeassureText(text:String):void {
     var font:String = "Times New Roman";
     var size:Number = 10;
     var myTextField:TextField = new TextField();
     myTextField.x = 0;
     myTextField.y = 0;
     myTextField.background = false;
     myTextField.wordWrap = false;
     myTextField.autoSize = TextFieldAutoSize.LEFT;
     myTextField.text = text;
     var newFormat:TextFormat = new TextFormat();
     newFormat.size = size;
     newFormat.font = font;
     newFormat.italic = false;
     newFormat.bold = false;
     myTextField.setTextFormat(newFormat);
     var metrics1:TextLineMetrics = myTextField.getLineMetrics(0);
     trace("------------------------------------------------------");
     trace("Metrics ascent is: " + metrics1.ascent.toString());
     trace("Metrics descent is: " + metrics1.descent.toString());
     trace("Metrics height is: " + metrics1.height.toString());
     trace("Metrics width is: " + metrics1.width.toString());
Also tried:
var bound:Rectangle = myTextField.getCharBoundaries(0);
trace("Char width is: " + bound.width);
trace("Char height is: " + bound.height);
Same Problem, the height always the same, doesn't matter if it is iE. an "a" "A" or "g"
Now I know, I am searching for the x-height of a font but I could not find a solution!
Any Ideas?
Message was edited by: frankhoff

Similar Messages

  • Can you calculate multiple text boxes to achieve a total value?  If so how is that done?  I am trying to create a order form where multiple items can be purchased but i would like the values of each item to calculate so I can achieve a total value.

    Can you calculate multiple text boxes to achieve a total value?  If so how is that done?  I am trying to create a order form where multiple items can be purchased but i would like the values of each item to calculate so I can achieve a total value.

    Hi sashby51,
    I've moved your discussion to the PDF Forms forum--the folks who visit this forum regularly should be able to point you in the right direction.
    Best,
    Sara

  • Apex 4.1 different font text in Reports Region and Interactive reporting

    Hi everybody,
    In my APEX 4.1 page, I have two regions using the same ''Reports region" Template but font text are different. Why The first region is an interactive reporting. The second it's a report. I know that each one has his own data for sure but the same region template .Spaces between colons are different. Is it normal ?  I want to have the same font text for the two regions.
    Thanks in advance. Bye.

    Apex4.0+HTML_DB1.6 wrote:
    Theme 13 is not an APEX 4.x theme ? How I can know that is one of this serie ?
    Legacy themes are flagged with a "*" in the theme gallery. Standards mode themes are not. (I don't have access to APEX 4.1 at present to be able to identify specific themes.)
    Properties of interactive report components, is it possible to take a look on this properties or it's a "black box" ?
    You can either look in the global APEX style sheet, or (probably more usefully) use a browser web inspector to examine the CSS properties of the IR components in the page.

  • On Pages 09. Error Message "Missing Font" - text on all my files/Documents has disappeared. I know it is still there from the word count - but it is invisible. Any clues Gratefully received.

    On Pages 09. Error Message "Missing Font" - text on all my files/Documents has disappeared. I know it is still there from the word count - but it is invisible. Any clues Gratefully received.

    What version of Pages '09?
    Have you updated it to the latest iWork '09 v4.3?
    Peter

  • How to use BOLD Fonts/text in Oracle?

    Hi guys,
    Im doing a package and part of this package has an email to a client. I just want some details of that email should be BOLD fonts/text like the Name or Title. Can anyone help me solve this problem?
    Im using Oracle Forms6i and Oracle9i for our database.
    Thank you.
    Lala

    Hi,
    How about using a [Rich Text Editor bean|http://forms.pjc.bean.over-blog.com/article-28390950.html] (in place of a text item / text area)?
    -Arun

  • Why does my font/text change when I switch from Classic 3D to Ray traced 3D in After Effects?

    My font/text changes when I switch from Classic 3D to Ray traced 3D. Why is it doing this? Also, I cant get the font/txt to look the same after I switch from Classic to Ray traced. How can I get it to look the same?

    I am pretty new to After Effects so I hope it's not my inexperience that's causing the problem. (It probably is)
    I just updated to the most current version of AE.
    I am on a mac pro late 2013 12GB 6 core. Running OSX 10.9.4
    Okay so after looking at it a little closer, I think the color is what mostly changes. The first screenshot is the what the text look like with Classic 3D and the second screenshot is what it looks like after I change it to Ray traced 3D. Also under the "Mode" section..the pull down that says "Normal" disappears. I'm wondering why the font color is changing?

  • Duplicated/blurred/overlapping fonted text in web view

    We are experiencing an annoying issue with fonted text in web view frames. See the screenshot below:
    Look closely at the headline and you'll notice that it seems to be duplicated on top of itself, as if there are two identical headlines on top of each other, a couple of pixels apart. This happening on ALL our HTML text story pages based on this template.
    The page is HTML supported by local web fonts, an extremely basic CSS and a jQuery to handle the zoom function (the blue buttons at the top). The idea is that readers of our DPS folio tap on a button on a page to reveal a state in an MSO that contains a web view frame showing the full text version of a story.
    The annoying thing is that the HTML looks absolutely fine in Safari and Chrome on my computer, nor in the desktop Content Viewer: the problem only arises in Safari and Chrome (and therefore DPS too) on the iPad 2 and 3.
    Has anyone here experienced the same issue? Did you manage to solve it?
    Ali

    Yes, I'm previewing as a raster folio - no zooming allowed. What made it curious is that when I put the same web files online and viewed them using the standard Safari browser and the Chrome browser on my iPad, I was seeing the same problem. So it seems to be an issue not directly related to DPS.
    However, I think I've solved it, thanks to your prompting to keep returning to how the fonts are being addressed. I added the following lines to the <style type="text/css"> section of my HTML header:
    h1
              font-family: Headline;
              font-weight: normal;
    I'm not sure why this did the trick: the 'Headline' style for the <h1> tag is already described and associated in the CSS and (I thought) referred to appropriately higher up in the HTML header, but there you go. Perhaps it needed a reminder, I dunno. The other styles didn't need this. I'm such a coding dimbo I haven't the faintest idea what's going on.
    Thanks for directing me to the right places!

  • Save as .psd text (metric vs. optical)

    When I open a .psd document in Fireworks, edit and save as .png and then save as .psd again, text gets transformed from metric to optical, is there any setting in Fireworks CS5 to change the display of text (metric to optical and vice-versa) like Photoshop has. This is a crucial reason my design team doesn't want to use Fireworks, because the text blocks got changed (kerning gets transformed slightly)
    thx

    Older software can be expected to run into compatibility problems when it is run on newer operating systems. You write it works in CS6 - why not update to CS6 then? If it is essential to your workflow and team, it seems a small price to pay.
    Alternatively, turn off every single other application and background service that you can afford to, and try again. Fireworks is known to have issues with certain newer system utilities under MacOs.

  • Text on path: How can I calculate the text length?

    Hi
    I have a text on path (spline item). Now I need the length of this text and the length of the spline item.
    I try to calculate the text length using IWaxLine::GetWidth(), but this is always 0.
    - How can I calculate the length of this text?
    - How can I calculate the length of the spline item?
    Thanks
    Hans

    It would be interesting if you could describe the purpose of your "length", but I don't have an answer anyway. Would the bounding box be sufficient?
    Considering that TOP may be combined with arbitrary spline paths, this could become an exercise in higher math. I haven't yet encountered a function that returns the mathematical length of such a spline.
    Otherwise it could be solved if you iterate and sum up the relevant points of the bounding box (ascender, descender, baseline?) of individual glyphs.
    Be warned that the whole TOP looks alien, as if it were a transplant from a different program. Experience also shows that documented and actually used interfaces / commands are completely different animals ...
    Dirk

  • Font text sizing bug

    I keep changing the font text size, and publish into folder
    but it never show the correct font size that I want.
    Is this a known bug?
    anyway to workaround it?
    does anyone have a full list of known bug that I can be aware of?

    What you see locally with Safari is what you'll see on line with Safari. Same with IE. What version of IE are you using? The old and unsupported Mac version. It's worthless as support for it was dropped over 5 years ago.
    Go get a web site to display correctly in IE requires considerable changes. See the following links for tips by Roddy on making an iWeb site compatible with IE:
    http://www.iwebformusicians.com/WebMusic/iWebandInternetExplorer.html
    http://discussions.apple.com/thread.jspa?threadID=1837981&tstart=0
    http://www.iwebformusicians.com/WebMusic/iWebTips.html
    http://discussions.apple.com/thread.jspa?messageID=9375447#9375447
    Some of the links may be duplicated.
    OT

  • Text Metrics

    Hello,
    I need to know how flash calculates the distance between text
    rows when using textField. What is the default leading?
    Documentation says it's undefined.. but what does undefined mean?
    0? Also I need to know what is the distance from the top of the
    textfield to the first line of text.
    I found out that by inserting a dynamic text on stage in
    flash and setting it's line spacing to -fontsize/3 pt gives me the
    result I am looking for. What is the relation between the pt used
    for line spacing and the values entered at leading property in
    TextFormat?
    The problem I am experiencing is that I try to generate a pdf
    based on information gathered in flash. Everything works except the
    text component. Text is rendered completely different and I can't
    find a pattern to figure out a formula for matching them. Different
    fonts have completely different line spacings.
    Fonts are embedded in flash. Could this be an issue?

    Bumb and here is a sample code so you can try what I did so far
    private function testToMeassureText(text:String):void {
         var font:String = "Times New Roman";
         var size:Number = 10;
         var myTextField:TextField = new TextField();
         myTextField.x = 0;
         myTextField.y = 0;
         myTextField.background = false;
         myTextField.wordWrap = false;
         myTextField.autoSize = TextFieldAutoSize.LEFT;
         myTextField.text = text;
         var newFormat:TextFormat = new TextFormat();
         newFormat.size = size;
         newFormat.font = font;
         newFormat.italic = false;
         newFormat.bold = false;
         myTextField.setTextFormat(newFormat);
         var metrics1:TextLineMetrics = myTextField.getLineMetrics(0);
         trace("------------------------------------------------------");
         trace("Metrics ascent is: " + metrics1.ascent.toString());
         trace("Metrics descent is: " + metrics1.descent.toString());
         trace("Metrics height is: " + metrics1.height.toString());
         trace("Metrics width is: " + metrics1.width.toString());
    Also tried:
    var bound:Rectangle = myTextField.getCharBoundaries(0);
    trace("Char width is: " + bound.width);
    trace("Char height is: " + bound.height);
    Same Problem, the height always the same, doesn't matter if it is iE. an "a" "A" or "g"
    Now I know, I am searching for the x-height of a font but I could not find a solution!
    Any Ideas?
    Message was edited by: frankhoff

  • How to calculate TLF Text Position for PHP

    Hi, we are using TLF Text for creating a simple application, to create PDF files from PHP.
    We tried with our TLF and Classic text difference for y Position. there we got 20% approx gap, from top, in TLF. Can anybody tell me? How to calculate Y position of TLF Text including line height for the new line text, for PHP?

    Holy cow... by the loop you just mentioned you're literally trying to make a TextField for every single character?! That's really unadvisable as an approach overall.
    I'm not sure how this suits your needs but finding a common medium is the best route here. Here's a couple route change suggestions and then at the end if you really still want to persue this method I'll let you know the method you want to use.
    One way is is to make a stylesheet that is re-usable between both TLFTextField and TextField. As long as the same classes are applied to both fields they will look "as close as possible" to identical as long as the same stylesheet is applied to both. Then it's just copying all the text from one field to another once.
    The other way which offers a bit less flexibility but still can work is to use HTML directly to style the text. Some attributes like line spacing and such are not supported directly in HTML without stylesheets but you can do a bit of common formtting (like color, font family, font size, bold, italic, etc). Then if you enable the classic TextField's .html property to true you can again just copy the text directly into it and it will format based on the HTML.
    If you can't persue either of these, the method you're looking for is this:
    http://help.adobe.com/en_US/FlashPlatform/beta/reference/actionscript/3/fl/text/TLFTextFie ld.html#getCharBoundaries()
    getCharBoundaries() returns a Rectangle which contains the x, y, width and height boundaries of the character index you supply. So in your loop you would do something like:
    txt.y = tlft.getCharBoundaries(i).y;
    The height and width would also be useful for you in certain cases where exotic formatting is used.

  • Please help! How can I change the font / text size for the checkout page? I asked Support and they sent me here- thanks in advance for your response.

    Hello everyone! I build an e-commerce shopping cart via BC and integrated it with a muse website as seen at sarahcosmetics .com
    Everything is great, but my clients clients are complaining they cannot see the text well once they're in the checkout page.
    I was able to enlarge the font in my Registration-Buy form in the Online Shop Layouts / Module Templates under the Site Manager. This helped enlarge the font size in the checkout form however my issue arrises on the next page when they have to enter their details like CC information name, address etc. the font is way too small and I'm not sure where to access the tools to enlarge that.
    If you could PLEASE help I would greatly appreciate it. I told my client I would handle it asap and I have no idea how to fix this.
    Thank you in advance for your help.
    Jessica

    This isn't possible yet in the current version of Fennec, but we are working on it. See https://bugzilla.mozilla.org/show_bug.cgi?id=590817 for details.

  • Find the Missing font text content in indesign document

    How to find and get the missing font content in the indesign documents by using the SDK. give a tips and techniques.
    Anybodys help me.

    It wont answer your question, but you could have this problem too:
    I have a problem in my current project where text frame having no text make the document report the usage of a font wich we dont want the project to use (times by exemple). The problem being that Indesign report usage of a font wich is in fact not applied to any text. Weird!
    The easy fix is to identify those items (text frame class + no text) and reassign them as "unassigned".

  • Motion 3 Quits Pasting Hiragino Font Text

    Motion 3.0.1
    Leopard
    Copy japanese text
    Paste into Motion 3
    Crashes every time
    Using the Hiagino Kaku Gothic ProN font, which I think is a system font with OS X.
    I can copy and paste Geneva or Arial, etc. without crashing. Unfortunately, this is a Japanese project.
    Domo!
    Scot

    OK, this has been fixed with today's update.

Maybe you are looking for

  • One user interface for multiple VIs

    I searched and searched for an answer to this so if it's out there please direct me to it. I have an application that has roughly 10 different VIs.  These VIs are virtually the same.  All they are doing is monitoring data for the operator for instanc

  • Can't get Windows XP Mode in Windows 7 to fill 27" screen

    I successfully installed Windows XP Mode on my Windows 7 OS running in Boot Camp and it works but the XP VM doesn't fill the 27" screen when I expand it to Full Screen. I get black bars on the left and right side of the XP OS, the top and bottom are

  • Excise duty & VAT need to print  seperately in PO printing

    We are able to print Value of ED & VAT combinly but the client requires it seperated. Any solution pls.

  • URGENT: Entering Chinese into Java Text Area

    Hi, This might be an FAQ question but some of the info I've gotten over the web so far is conflicting. How do I allow a user to enter Chinese text into a Java Text Area (using an english keyboard)? All my users have: English Windows 2000 with a multi

  • Reports thin client

    I have a Sun Solaris box which is my database server. I have a Linux box which serves as my 10g application server. My problem is: I need to execute batch reports from my Sun Solaris box. I'm told I can use the reports thin client in order to accompl