[comp.lang.c] Need help with font manipulation using MSC 6.0

burkley@cod.NOSC.MIL (V. Joe Burkley) (02/03/91)

AHHHHHHHHHHHH!!!! This is driving me nuts!

I'm calm now.  In the program I am currently writing I am want
to give the user the ability to select between multiple fonts,
and also to be able to play with the size of the currently
selected font.  I want the user to be able to select fonts that
I have no knowledge of; basically I want them to be able to use
fonts that they might have around because of Windows.  I am 
currently using MS 'C' 6.0.

To this end there are two things that I definitely need to be able
to tell about a given font.  1)  The width in pixels that a given
string will take to display, and 2) the height in pixels of the
text in that font.  Answer to #1 is easy with the _getgtextextent
function.  Its answer number two which is speeding my hair loss.

The _getfontinfo function sounds like it is the answer to my 
pitifull pleading, but I'm getting nowhere fast with it.
The current scenario is like this:
  I register a font using _registerfonts
  I use _setfont to select a font (say roman) and also to 
  specify the character height and width in pixels.
  I next liberally aply _getfontinfo and find that the 
  pixheight it returns has nothing to do with the size of
  the font I specified using _setfont.
The clever amongst you might say 'You idiot, if you are specifying
the character height using _setfont you must know the height
of the characters'.  Most of the time yes, but remember I want
to be able to handle fonts I haven't seen yet and I have already
been able to screw myself (I don't recommend it) by requesting
a font size and having _setfont give me something that it thinks
is OK but in reality is a different size.
BTW if you try 'type stupid.fon' you will see information about
the font in the file amongst the jibberish - I would like to
gain access to this dribble too.
I have noticed when using Windows that its programs (Paintbrush for
instance) have the ability to know what sizes are allowed for a
given font -- (salivation) that is exactly what I need to know
(even though I've noticed Windows screwing up with certain fonts).

I am at a point where it is not too late to convert to TC.  I have
only looked through a manual but have noticed that it has similar
functions.  Anyone have experience using both setups for playing
with heavy graphics and fonts?

Thanks and email is fine.

				-Joe

-- 
=-=-=-=-=-=-=-=-=-=-=-=-= \ \_ _/ / =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
| Joe Burkley              | O_O |       "It's not enough that I succeed,   |
| burkley@cod.nosc.mil      \/_\/            everyone else must fail."      |
=-=-=-=-=-=-=-=-=-=-=-=-=-=- \_/ -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=