Op 16/02/2011 19:53, Wyatt Biker schreef: > Is there a way to calculate the height of the font being used? > > For example, for Helvetica, 12. what would be the highest point of a font. See p68: "The font size isn't the height of any specific glyph; it's an indication of the vertical space used by a line of text."
If you want to know the height of a String in a specific font, you have a plethora of methods referring to the "ascent"/"ascender" and the "descent"/"descender" (search for those words in the BaseFont class). Subtract the descent from the ascent and you have the height. See: http://www.flickr.com/photos/itextinaction/4330322144/in/set-72157623995798377/ If you want to know the height in general, you need my_basefont.getFontDescriptor(BaseFont.ASCENT, my_fontsize) and my_basefont.getFontDescriptor(BaseFont.DESCENT, my_fontsize) where my_basefont is a BaseFont object and my_fontsize is your fontsize (e.g. 12). Again you need to subtract the descent from the ascent to get the height. ------------------------------------------------------------------------------ The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: Pinpoint memory and threading errors before they happen. Find and fix more than 250 security defects in the development cycle. Locate bottlenecks in serial and parallel code that limit performance. http://p.sf.net/sfu/intel-dev2devfeb _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
