🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #551

Re: OUTLINE FONT METRICS

#551
From: David DesRoches
Date: Wed, 29 Jul 1992 04:31
52 lines
2886 bytes
harris@garfield.catt.ncsu.edu (Michael Harris) writes:

>daveb@netcom.com (Dave Briccetti) writes:

>>ddesroch@oracle.uucp (David DesRoches) writes:
>>OK, so I've chosen this really cool OUTLINE font that I want to scale to say,
>>32 points.  I compute the necessary character cell dimensions, call
>>GpiSetCharBox() and GpiSetCharSet() to select my new logical font.
>> 
>>QUESTION: How do I get the metrics for this font AT THE SELECTED POINT SIZE?
>>Calling GpiQueryFontMetrics() at this point returns the same metrics structure
>>I got back from my initial font query, with metrics designed around a 12 point
>>font or so.
>>
>>My only current idea is to compute the ratio of logical.lMaxBaselineExt to
>>physical(base).lMaxBaselineExt and multiply the metrics by this ratio to
>>scale them (ascent, descent, maxwidth) to the point size I'm using.  This
>>seems bogus and prone to round-off error.
>> 
>>Am I missing something?

>Alternatively, you could query *some* of the info via GpiQueryTextBox.
>______________________________________________________________________________
>     Michael Harris - harris@catt.ncsu.edu or harris@carvm3.vnet.ibm.com
> System Administrator, Computer & Technologies Theme Program, NC State Univ.
>(My opinions are my own and do not represent those of NCSU or IBM Corporation)

Well, I must have been on drugs the first time through.  My testing was
not thorough.

Bottom line is, if you do:

GpiQueryFonts()
- select the outline font you want -
GpiCreateLogFont()
GpiSetCharSet()
* GpiSetCharBox() *
and finally
GpiQueryFontMetrics()

you *will* receive the scaled font metrics for the new character cell size.

I guess I was missing the SetCharBox() step before.  My thinking was that
I set lMaxBaselineExt and lAveCharWidth in the FATTRS before I called
GpiCreateLogFont(), so I was creating a logical font OF THE SIZE I WANTED.
Not so.  Looks like creating a logical font from an outline font ignores those
fields in FATTRS.  The outline font takes its size from the current 
character cell dimensions.

(Thanks to Scott from Adobe for pointing me in this direction!)

Dave
Technical Details
Message-ID: <ddesroch.712384265@mailseq>
Path: arc1-ca.pugleaf.net!sparky!uunet!oracle!unrepliable!bounce
References: <ddesroch.711989648@mailseq> <t2km8fn.daveb@netcom.com> <harris.712181819@garfield.catt.ncsu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!oracle!unrepliable!bounce
Newsgroups: comp.os.os2.programmer
From: ddesroch@oracle.uucp (David DesRoches)
Subject: Re: OUTLINE FONT METRICS
Message-ID: <ddesroch.712384265@mailseq>
Sender: usenet@oracle.us.oracle.com (Oracle News Poster)
Nntp-Posting-Host: mailseq.us.oracle.com
Organization: Oracle Corp., Redwood Shores CA
References: <ddesroch.711989648@mailseq> <t2km8fn.daveb@netcom.com> <harris.712181819@garfield.catt.ncsu.edu>
Date: Wed, 29 Jul 1992 04:31:05 GMT
X-Disclaimer: This message was written by an unauthenticated user
              at Oracle Corporation.  The opinions expressed are those
              of the user and not necessarily those of Oracle.
Lines: 53