🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #14352

String Width and Height in pixels for any given Font

#14352
From: Rodolfo Frino
Date: Mon, 18 Aug 2003 02:56
16 lines
1433 bytes
Does anyone know how to obtain the text width and height in pixels,
accurately,
using API's?

For example

AnsiString S = "1234567890 AaBbCcWwXxYyZz";
(or the equivalent C string)

I have used GetTextMetrics(), but I don't know whether there is something
better or more accurate since with this API I can get the Average Char Width
and
Maximun Char Width but not the actual string width.

TIA
Rodolfo
Technical Details
Message-ID: <3f40405c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,4b951b439ffe2bcb,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-08-17 20:10:08 PST
From: "Rodolfo Frino" <rodolfofrino@yahoo.com>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: String Width and Height in pixels for any given Font
Date: Mon, 18 Aug 2003 12:56:43 +1000
Lines: 19
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: 203.206.18.128
Message-ID: <3f40405c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1061175388 203.206.18.128 (17 Aug 2003 19:56:28 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newsfeed.news2me.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail