Article View: borland.public.cppbuilder.nativeapi
Article #11799Re: Pixel size of text
From: Malcolm Smith
Date: Thu, 15 Jan 2004 07:01
Date: Thu, 15 Jan 2004 07:01
39 lines
2430 bytes
2430 bytes
Thanks for the extra info. My biggest problem is the fact the printer canvas that I have from the VCL is not valid until BeginDoc() is called. Since I'm doing a preview this was the cause of my problem. For now, a rough scaling factor (preview canvas size / printer canvas size) is good enough for my needs. -- --- Malcolm Smith MJ Freelancing http://www.mjfreelancing.com Borland Technology Partner "Bob Gonder" <notbg@notmindspring.invalid> wrote in message news:c0dc00hj5q7r3aqhbbvh1f7s7mbdmkdapd@4ax.com... > 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:
<40063ac3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!peernews-us.colt.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> <c0dc00hj5q7r3aqhbbvh1f7s7mbdmkdapd@4ax.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 Reply-To: "Malcolm Smith" <mjfreelancing@optusnet.com.au> From: "Malcolm Smith" <mjfreelancing@optusnet.com.au> Newsgroups: borland.public.cppbuilder.nativeapi References: <400524f6$1@newsgroups.borland.com> <es1b005mlgdh2ahu2k1641mdku5tuflukq@4ax.com> <4005cf4e$1@newsgroups.borland.com> <c0dc00hj5q7r3aqhbbvh1f7s7mbdmkdapd@4ax.com> Subject: Re: Pixel size of text Date: Thu, 15 Jan 2004 18:01:41 +1100 Lines: 41 Organization: MJ Freelancing X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 211.30.147.112 Message-ID: <40063ac3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1074150083 211.30.147.112 (14 Jan 2004 23:01:23 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!peernews-us.colt.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