Article View: borland.public.cppbuilder.nativeapi
Article #11800Re: Pixel size of text
From: Bob Gonder
Date: Thu, 15 Jan 2004 06:53
Date: Thu, 15 Jan 2004 06:53
18 lines
1818 bytes
1818 bytes
Malcolm Smith wrote: >This isn't exactly what I need, since I need to determine the height based >on the current font - as opposed to producing text at a given height. GetTextMetrics() returns text height in LUs You probably want either tmHeight or tmAscent. OTOH, if you use SetTextAlign to TA_TOP, then you don't need to know the size of the font, just position the text to your desired 2mm below the graphic. SetTextAlign( PrinterDc, TA_TOP|TA_CENTER ); ExtTextOut( printerDC, Graphic.Left+Graphic.Width/2, Graphic.Bottom+2mm, ......); Then you can use GetDeviceCaps() to figure out how many DUs there are in 2mm. Something like VERTRES / VERTSIZE should give DU/mm.
Technical Details
Message-ID:
<c0dc00hj5q7r3aqhbbvh1f7s7mbdmkdapd@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<400524f6$1@newsgroups.borland.com> <es1b005mlgdh2ahu2k1641mdku5tuflukq@4ax.com> <4005cf4e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,68caf32dd13ae34 X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-01-14 23:09:25 PST From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Pixel size of text Date: Wed, 14 Jan 2004 22:53:29 -0800 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <c0dc00hj5q7r3aqhbbvh1f7s7mbdmkdapd@4ax.com> References: <400524f6$1@newsgroups.borland.com> <es1b005mlgdh2ahu2k1641mdku5tuflukq@4ax.com> <4005cf4e$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.31.179.1 X-Trace: newsgroups.borland.com 1074149611 67.31.179.1 (14 Jan 2004 22:53:31 -0700) Lines: 20 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail