Inconsistent font metrics

I am printing a report. For each page, I go through all the text that I want to print on that page using FontMetrics.stringWidth to determine how much space the string will take, and using this information to make decisions about spacing and layout. Then I make a second pass through all the Strings where I actually print them. I do a stringWidth on each String again in this second pass to make final decisions about placement.
And here's the strange part: When I do the second stringWidth, I sometimes get a different value than I did from the first stringWidth! Even though the difference is just one or two percent, this messes up my calculations, because I had this silly idea that the width of the String would be the same no matter how many times I ask.
Slightly subtracting from the strangeness: When I begin the page, I create all the Fonts I will need, and then I do a Graphics.getFontMetrics(font) to get a FontMetrics object for each, which I use in the first round of calculations. When I get to the second round of calculations, I have now done a setFont() of the appropriate font, and then I do a getFontMetrics with no parameter to get the font metrics for that font. So it's a different FontMetrics object, but its for the same Font on the same Graphics. Shouldn't they be identical? (I am quite sure that the Font is the same in both cases.)
I can work around the problem by saving the FontMetrics object I get the first time and just using it again the second time. (I suppose it would be better still to save the size and thus save the redundant calculation, but that would be a pain.) But I would like to understand what is going on. Any words of wisdom?

I've never been working much with font metrics however i'm aware drawing in java has some incoherencies, like if you draw a hollow circle and a filled circle with the same coords they won't have the same size, etc. you should keep the same values or access the font metrics the same way twice. otherwise, i can't see... you can just keep an array ndicating the size of each line, etc.

Similar Messages

  • Cannot Read Font Metrics Issue on Save As PDF

    Hi All
    On saving a document as PDF, the FrameMaker Console displays the message:
    The font file may be damaged.
    maker: Cannot read font metrics from font file named Tahoma-Bold.
    The PDF is created but it contains squares in place of letters.
    This only happens for one document within my book.
    I have removed and reinstalled Tahoma, with no effect.
    What has happened and what do I need to do to enable save to PDF for this document.
    I am using FrameMaker 9.0 installed as part of Technical Suite 2 and running on Windows 7 professional.
    Thank you for your help.
    Claire

    I'm on FrameMaker 10, installed about a month ago, and suddenly, yesterday, I started getting this exact error on PDFing a book I'd previously had no trouble with. Nothing apparently changed in my setup between everything working fine and getting these "the font file may be damaged" console errors. Interestingly, it's on exactly the same font as reported by Claire and MichaelH; Tahoma and Tahoma-Bold are listed as the troublesome fonts. These are not the commonplace Frame console "missing font" errors -- they totally mess up the PDF.
    Both these fonts work perfectly in Word. We tried reinstalling, with no change, and I was about to call Adobe support, as recommended by our IT desk, but checked this forum first.  A million thanks, Michael Müller-Hillebrand, for posting the exact solution to the problem. I cleared the Convert CMYK to RGB box and everything is fine now. Thank you SO much.
    Adobe, could you please fix this? First message on this thread was almost a year ago and my copy of Frame was purchased last month. The issue should have been fixed by now. This has cost me about three hours, plus the time of the IT desk reinstalling FrameMaker.

  • What is font metric ?? (HELP)

    hi, i am currently doing my project using java... 1 of the features in my system is the changing of font type and size of selected text... however my teacher wants me to make use of font metric (hope i never spelled wrongly)...
    can someone tells me wat is font metric ? and any examples to show??
    i appreciate all helps....

    The following code should get get the height and ascent of the font of any componant or object that inherits from componant. (I haven't compiled or run this code so it may contain errors)Componant yourComponant = new Componant();
    Font yourFont = yourComponant.getFont();
    FontMetrics yourFontMetrics = getFontMetrics(yourFont);
    int fontHeight = yourFontMetrics.getHeight();
    int fontAscent = yourFontMetrics.getAscent();fontHeight contains the height of a line of text in this font.
    fontAscent contains the the ascent of this font (from baseline to the top of most characters).
    Follow the link in the last post to see all the methods and what they do.

  • Font Metrics, Completely Wrong Values

    So what's the deal with font metrics?
    The values it gives are completely wrong.
    For example with a monospaced font i printed out every single
    character on screen (upper, lower, 0-9, symbols).
    The font metrics were:
    ascent: 17
    descent: 5
    height: 22
    leading: 0
    Im trying to find the correct ascent. The REAL ascent is only 10.
    The font metrics value is off by 70% and it usually is off by a lot for
    all the fonts ive tried. The descent is off by 2 which isnt bad i guess.
    Anyone know how to get the ACTUAL size?
    in this picture the ascent is high but in my experience it is much higher:
    http://www.devx.com/Java/Article/7932/1954?pf=true

    The Line and Font Metric units are pixels not points.
    That applet doesnt work.
    Any attempt to use the "patch" results in:
    Exception in thread "AWT-EventQueue-2" java.lang.NoSuchMethodError: gui.PatchFontMetrics.patch(Ljava/awt/FontMetrics;)Lgui/PatchFontMetrics;
         at test.FontInfo.describeFont(FontInfo.java:56)
         at test.FontInfo.handleEvent(FontInfo.java:77)

  • How to obtain font metric?

    Hi all,
    I want to obtain a font metric of each character in font (i.e. detph, height and width). Does anybody know how?
    thanks

    Hi Lukas,
    I think what you are looking for may be found in IFontInstance. Have a look at the SingleLineComposer sample in the SDK. Particularly SLCTextGlyphNode.cpp could have something that will suit your needs. While it's not as easy as something like GetFontHeight() would be, it should get you what you need after you have the right glyph ID.
    Best regards,
    Art

  • Inconsistent font behaviour between reflow and chrome

    Having seen previous threads regarding inconsistent font behavior caused by copied and pasted text containing hidden styling tags, I tried to find a way of quickly stripping out the tags.
    Copied client text from word.
    Used paste special - text only - to drop text into Dreamweaver CC design view. Entered code view and deleted invisible tags. Copied text from code view and pasted into Edge Reflow.
    Styled text in Reflow - paragraph breaks, shift returns and emboldened headings. Saved and previewed in Chrome - still not showing bold headings (arial).
    So, deleted text box in reflow, and redrew. Switched to Dreamweaver and copied text from code view with <p> and <br> tags as needed.
    Returned to reflow and pasted into text box. Immediately black screen and no way to do anything. Had to force quit and restart from saved reflow project file.
    Same thing happens upon repeating.
    What can I do to get the reflow typography to preview properly in chrome? Really frustrated by this issue.
    Many thanks in advance for any suggestions...

    Thanks very much for this bug. I can reproduce it on my end. I've filed it for our team to take a look at.
    I'll try and update if we find a fix.

  • Font metrics info

    Hi,
    I'm trying to develop a VI to format text for a report generator (trying
    to be better, than the one with LV5.1), for this VI, I need to get
    information (at run-time) about the size of the fonts (font metrics, I
    think) in order to be able to perform text formating.
    Does anybody know a way I can ask this information to Windows 9x, at
    run-time from Labview.
    Thanks,
    Leopoldo
    Sent via Deja.com http://www.deja.com/
    Before you buy.

    Here's some code based on jsalonen's suggestion. It prints the font if M and i are the same width.
       public static void main(String[] args) {
          GraphicsEnvironment ge=GraphicsEnvironment.getLocalGraphicsEnvironment();
          Font[] s=ge.getAllFonts();
          Canvas comp=new Canvas();
          for(int i=0;i<s.length;i++) {
             int f1=comp.getFontMetrics(s).charWidth('i');
    int f2=comp.getFontMetrics(s[i]).charWidth('M');
    if(f1==f2) System.out.println(s[i].getName());

  • Sapscript font metrics generate AFM file howto

    Hi scripters,
    I'm creating an 11pt font for HPLJ5SI.
    In SE73, I created new system fonts HELVE 110 normal, bold and so on.
    Then SE73 printer fonts for ZHPLJ5SI, same as system fonts. All other HELVE and TIMES fonts have AFM set for cpi. The fontmetrics are displayed as (i.e.( "sapLinkToAFM HPLJ5SI HELVE 100 false false".
    I created (also in SE73) new print controls; I derived the correct value comparing the respective HEX strings for 10 point and 12 point HELVE.
    I tried "sapLinkToAFM HPLJ5SI HELVE 110 false false" but this does not generate.
    Now I used the same definition as for 10 points. The output looks fine but I have doubts about the character spacing: It looks different from what I print from MS Word ARIAL.
    I remember there is a (DOS) program to generate font metrics but I forgot the details; Note 12462 does not really help.
    I would appreciate a step-by-step guide or a link to a good description.
    Best Regards,
    Clemens Li

    Hi,
    Are you trying to generate a PDF file or print to a printer. It is not a good idea to try adding HELVECYR to device type PDF1. You should create the PDF via a device type that supports Cyrillic characters like SAPWIN or SAPWIN5. Also you need to upload true type fonts that support the cyrillic charcters as described in SAP note 322998.
    Alternatively if you have a unicode system, you can use unicode device type PDFUC. It is still necessary to upload true type fonts that support the cyrillic charcters. See SAP note 999712.
    regards,
    Aidan

  • Obtaining/Exporting Font Metrics through a Script

    I have a Text Layer consisting of characters with varying font metrics (say Font Height, Typeface, Kerning, Leading etc). Am unable to export out the Font metrics through an AE script.
    I was able to get the Font Name, Height, Fill and Stroke properties of the first character from the Text Document.
    var textDoc = layer("sourceText") ;
    var textDef = textDoc.valueAtTime(0, false) ;
    I was able to get the Font Name, height, justification, fill and stroke properties from textDef.
    But, I have no clue about getting the other properties like Kerning,  Leading, Tracking etc.
    It will be ideal if I can get all the concerned font metrics of each character in the Text Layer (separately).
    Thanks in advance.

    Unity used to have this wonderful voting system for feature requests.  So users could simply spend votes on those things that they ageed were needed/desirable in future versions.
    This process is GREAT for end users, as we can all see what everyone else is thinking about... and have others see what we're thinking about in terms of features.
    If we're all similarly frustrated by something, we can publicly draw the attention of other users, and the developers, to that issue/desire/need.  And it gets done faster, more transparently, and everyone is happy.
    Adobe, being Adobe, doesn't want anyone to know what anyone else finds as limited, missing, necessary, desirable, etc... because they don't want to be held accountable for their products by their users.
    But I agree, access to text's metrics/properties is an essential next and incredibly logical step for AE. 
    However blindly hoping others will know where to look (in scripting) for the ability to look at text metrics to do something like create styles is really pulling the wool over the eyes of users.
    And... let's be honest... why does it matter what users want... they're already using AE.  The real voice is new potential users, someone that Adobe spends all their time telling that Illustrator and Indesign are optimised, rather than figuring out how to add common sense functionality to AE.
    Never mind...
    The world still turns.

  • Many inconsistent fonts.

    After converting a pdf to word, the inconsistency of fonts and sizes was many. How do you correct all this inconsistency and even after correcting everything one by one, there was a visual mismatch displayed in the document.

    Hi Barbara,
    Was your document a scanned file?  I've seen this type of behavior happen on scanned documents where the quality was a bit low (grainy/faded original or very low DPI scan).
    -David

  • Smooth Text causing inconsistent font thinkness.

    Using Adobe Acrobat 9 Pro Version 9.0.0, I have "Preferences -> Page Display -> Rendering -> Smooth Text" set to "For Laptop/LCD screens." This setting initially give me a beautifully rendered ArialMT/TrueType. This is the "Actual Font" used for Helvetica in a PDF I am reading. As I scroll through the document however, later pages render the font with a heavier line thickness, making them look bolder. I find that if I resize the program window then the thinkness returns to the initial width and looks good. I can repeat this cycle. In the end the work-around is for me to resize the program window for each page I read. This is a bit tedious. I don't have the behavior with Smooth Text turned off. I am running Vista with an ATI Mobility Radeon HD 2400 XT. The "Use 2D graphics acceleration" option does not affect the behavior so I don't know that the graphics card is a factor here.
    Has anyone else experienced this inconsistency with the line thinkness of the font smoothing? Is there a fix or something I should look at to debug?

    It seems that this problem is limited to a specific PDF file. This leads me to suspect that it is the font that causes the problem. Based on the Font properties reported by Acrobat it seems that it is using the standard Arial font which should work reliably. Is there a way to get more detailed information about the fonts being used by Acrobat for the file?

  • Inconsistent font style behavior on Edge Reflow CC (Preview) for Windows

    Adobe Edge Reflow CC Preview for Windows has wildly inconsistent behavior regarding font styles. Why is there no button for bold in the UI? Why do I have to type "bold" into the Weighting dialog text box to have my styled text render as such in Chrome? Why does text inside a box/div styled with the italics button render in Reflow but not in Chrome?

    Hey there,
    The font weight can be changed here:
    With CSS there are both text values such as "bold" and numerical values from 100-900 usually. We gave you the ability to use either.
    If you are seeing issues with a font rendering set to italic in Reflow and not in previewing properly in Chrome, can you let me know the typeface you are using? I'd like to check it out as well.

  • Extremely inconsistent font sizes--tiny on page and huge in textboxes

    Hello,
    I am running Firefox 23 on Slackware Linux. My computer is an ultrabook with an relatively small, high resolution screen, so I have had to set a high dpi (190) to get font sizes rendered appropriately. The value of 190 was obtained by calculating the proper value for my screen size and resolution (11.3 inches; 1900 x 1080), and in most circumstances, everything looks good.
    However, in Firefox, my fonts are extremely tiny. I have installed an add-on No-Squint to set the default zoom level of every page to 170 %, which works well. However, this results in normal (or even rather small) page fonts, while the fonts in textboxes (like password fields, select-some-value boxes, etc.) are enormous. It seems like the fonts in the textboxes are respecting my dpi value, while the rest of the fonts on the page are not. This means that when the page is zoomed in, the textbox fonts look huge.
    What I need is a way to make Firefox either respect my system dpi everywhere or nowhere. I have tried changing the values for layout.css.devPixelsPerPx, and it makes no difference.
    Thanks for any help.

    I just noticed you have the older zoom setting of remembering zoom level for the current tab rather than by the site. I'm not sure how that interacts with NoSquint.

  • How to deal with inconsistent font sizes?

    I sign every post at my blog (using the type tool).
    Even if I use the same fontsize in photoshop the result in actual size varies (I realize this has to do with cropping it in camera raw), Is there a way of getting a consistent font size (i.e size in pixels), without having to go down the path of having a customized signature brush?
    TIA.

    Problem seems to be fixed (though why still puzzles me).
    It appears as if a few images had in deed changed resolution. (My workflow had been as follows - open them up in CR, make adjustments - I had then on the troublesome photos made some adjustments in PS then saved them as .psd.) - for some unknown reason a few of them had been saved in 240 DPI as opposed to 300.
    When I was checking the resolution of my files to verify that they were all the same I had been looking at the various .NEF files. I feel like an idiot
    It was a case of not paying attention.
    Thanks again!

  • Inconsistent font character hieght Adobe CS5

    Hello all,
    See attached image below.
    I am mocking up a website via CS5 and I'm using Helvectiva Neue in the body.
    What I am noticing is that the character height seems to vary per each letter giving the font on my page a wave wonkly look.
    Does anyone know of a way to rectify or eliminate this issue?
    As you can imagine, when I show a mockup to my clients, I want the page to look as professional as possible.
    Any suggestions would be greatly appreciated.

    fonts, björn, scott,
    Unless three step reinstallation helps, you may wish to roll back from Yosemite and wait to see whether the issues will be solved and reported as such.
    Weeding out in older plugins seems to have helped some in some cases. It also seems that JAVA Runtime may be involved, for some it seems to help to roll back to an ealier version, for others to update to the newest.
    All the above is more or less hearsay so far, with no definite final confirmation.
    In any case, there is something to be sorted out by someone.

Maybe you are looking for

  • How to integrate BW with CRM?

    Dear All Experts, I need to integrate BW 7.0 with CRM 7.0. I have searched alot on forums regarding this. The more I search the more I got confused. some thread says that all CRM reporting is done from BW whereas some says standard crm reporting is d

  • Current and previous balance

    Hello everybody, I am SAP XI Architect. I am analyzing an interface for customer balances. I have a requirement to send the Current balance and Previous balance to 3rd party tool. The previous balance is till last transaction period (for example: til

  • Captivate 5.5 SLOW Saves

    FORUM POST Original project in Captivate 5 is 56.9 MB Save time: 18 to 30 seconds (depending on number of windows and other activity on system) Saved file size in Captivate 5.5 is 49.6 MB (opened CPT v5 file and "saved as" CPTX v5.5) Save time: 8 min

  • URGENT: Oracle 10g License Purchase Issue

    Dear All, I have a small environment of around 50 desktops with Compaq Proliant Server. The Server machines are normally coming with dual processor. Now I am looking for Oracle Processor Based license as we are going to deploy our in-house built appl

  • Business Objects XIR2 Materials

    <p>Hi,</p><p>I'm new to this forum and Business Objects XIR2. Can any one provide XIR2 material. It will be helpful for me.</p><p>Thanks,</p><p>Gopinath.</p>