Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Text property, 'extent', not working properly
Date: Sun, 19 Jul 2009 20:00:02 +0000 (UTC)
Organization: Univeristy of Michigan
Lines: 8
Message-ID: <h3vu02$a9k$1@fred.mathworks.com>
References: <h3slb9$nsa$1@fred.mathworks.com> <h3t9g9$fe2$1@fred.mathworks.com> <2f4d4d0b-44d5-4ab2-b4bb-82d776a1655c@g31g2000yqc.googlegroups.com> <h3vn2p$2r2$1@fred.mathworks.com> <h3vrue$mvb$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1248033602 10548 172.30.248.38 (19 Jul 2009 20:00:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 19 Jul 2009 20:00:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1397212
Xref: news.mathworks.com comp.soft-sys.matlab:556660


"Matt Fig" <spamanon@yahoo.com> wrote in message <h3vrue$mvb$1@fred.mathworks.com>...
> I saw a similar issue before when trying to use centimeters.  
> 
> Even if one naively uses 1 inch = 2.54 cm.  Only a grid spacing of multiples of 2.53807 (MATLAB's conversion factor) will yield matching extent and position values.  

Thanks again, Matt.  You nailed it on the head when you said that it rounds to the nearest pixel.  I checked and it always reports the extent values to the nearest 72 pt/96 pix=0.8 pt/pix.  

I'm just going to write my own extent function that uses the position property to get the location of the center of the text (all text will be center and middle aligned), and uses the extent property to find the height and width.  The height and width will still round to the nearest 0.8 pt (on my computer), but their impact will be cut in half since I'm referencing from the center of the text.  Also, by using the position property, which doesn't seem to be subject to this nearest pixel rounding, I won't have the tolerance stackup issue, so that will reduce my error as well.  Worst case before was 0.8 pt off the location and 0.8 pt off in the width, leading to 1.6 pt off total.  Now, worst case will be 0.4 pt off.  That should be more manageable.