Print Page | Close Window

Cambria TextHeight

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2211
Printed Date: 13 Aug 25 at 5:25PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Cambria TextHeight
Posted By: fargburger
Subject: Cambria TextHeight
Date Posted: 03 Apr 12 at 5:53PM
This is pretty screwy, but apparently a known problem.  Although I don't know why it's happening to me as I'm using Cambria and not Cambria Math.

http://stackoverflow.com/questions/8624229/cambria-math-big-top-and-bottom-margin

If you use the font called "Cambria" (not Bold or Italic) and call GetTextHeight, you'll get a number which is a bit larger than you might have expected.

---

The way I worked around this was to use AddSubsettedFont and just pass in the AnsiCharset, as this is all our reporting engine (technically) supports right now.  But I just wanted to know if there was some sort of work around, as we do a lot of calculations based on GetTextHeight.





Replies:
Posted By: Ingo
Date Posted: 03 Apr 12 at 9:33PM
Hi Farg!

I think GetTextHeight only make sense if you draw with different font heights on your new pdf.
If you add a truetype font to the pdf it can be used with any height.
I could imagine that on a page with headline, chaptertext and normal text there will be perhaps three different font heights.
So you have to extract the pagetext getting the real used fontheights?

Cheers and welcome here,
Ingo




Posted By: AndrewC
Date Posted: 04 Apr 12 at 4:05AM
Can you check to see what QP.GetTextAscent ()- QP.TextDescent() = ?  This might be more accurate.

Windows reports font heights different  to PostScript and other graphics libraries.  Windows returns the cell height by default and PDF  uses Ascent - Desent.

Andrew.


Posted By: fargburger
Date Posted: 13 Apr 12 at 6:13PM
Yeah, that GetTextAscent - GetTextDescent appears to actually give me the height of the text. Unfortunately, it still draws the text at the fairly screwy location.

Probably because we draw based on the Top/Left coordinates instead of using the baseline of the text.  (note: the code I'm using was all recently converted to QuickPDF from drawing directly to the canvas so it made more sense to draw using the top/left than the default functions the QuickPDF uses)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk