Print Page | Close Window

Precision (accuracy)

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=304
Printed Date: 12 May 24 at 1:13PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Precision (accuracy)
Posted By: Autodidact
Subject: Precision (accuracy)
Date Posted: 03 Feb 06 at 7:15PM

I've just started playing around with the library (DLL) and simply added one word 10 mm from the top edge and 10mm from the left edge. To my surprise it ended up only ~7 mm down.. - Why would that be?

I've been looking high and low for an obvious explanation (setting/margin or something), but didn't find any yet. SetPrecision don't make any difference, and I've yet to see another possibly relevant function to try..




Replies:
Posted By: DELBEKE
Date Posted: 04 Feb 06 at 12:31AM
Not sure of that, but perhaps the mesurements are for the base line of the text. Try with differents font size


Posted By: Autodidact
Date Posted: 04 Feb 06 at 4:44AM

Indeed it is.. And it's actually stated so in the parameter description ("in tiny writing" ;). How could I miss that. By trying another font (and smaller size) it shows clearly that it is the baseline point that ends up at 10 mm since the top of the word "changes location".

Thank you very much for your suggestion!



Posted By: Autodidact
Date Posted: 04 Feb 06 at 8:08AM

Doing some homework, and posting it for the sake of easy learning for others;

The [DrawText] Y-position refers to the baseline of the text. The baseline is the imaginary line upon which a line of text rests. It is also the point from which other elements of type are measured including x-height and leading.

To reference the top-left location of the word (font), one can use the following two ways:

  • Find the difference between [GetTextHeight] and [GetTextBound] (top) and then substract the difference from the returned [GetTextBound] value and use it for positioning.

Or.. the easier and probably (slightly) more accurate(?) way:

  • Use [GetTextAscent] to retrieve the height from the baseline to the top, not counting in any accents, and applying it to the measure; Ypos + Ascent value.



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