🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2970

Add-On-Font Problem?

#2970
From: Ilpo Tapio Karjalainen
Date: Fri, 31 May 1991 11:37
59 lines
3427 bytes
Does anyone know how to tell to CreateFont() to get one exact font?

I am having problems in specifying to Windows that I request for one exact font
that I have installed in Control panel. Now my system has some extra Courier 
fonts (Courier-Bold, Courier-Medium) installed from a archived font set that is
available from the net (fonts.lzh in FUNIC.FUNET.FI at least). Fonts are
described in WIN.INI as:
[fonts]
Courier-Bold=COB_____.FON
Courier-Medium=COM_____.FON

and in Control panel's samplebox there reads:
Courier 8 ABCDEFG...
Courier 10 ABCDEFG...
Courier 12 ABCDEFG...
.
.
Courier 24 ABCDEFG...

Now, I added line ' FONT 8, "Courier" ' into my applications .RC file to the
header of one dialog and I got a Courier-Bold 8 font (bold presumerably because
Courier-Bold was first 8 point Courier font in Control panel's listbox). 
Now this works just fine, but I would like to create this font by using 
CreateFont(). I just cannot figure out where could I gather required parameters
for CreateFont(). This created font would then be used with WM_SETFONT-message
to change fonts for some parts of the dialog only.
I passed the following set to CreateFont and got just plain Courier 10 :
hFont=CreateFont(8, /* height (the number 8 in Control Panel' listbox means
                       height, eh?) */
                 0, /* width (I set this to zero so that Windows can match it
                       to proper aspect ratio) */
                 0,                   /* escapement */
                 0,                   /* orientation */
                 FW_NORMAL,           /* weight */
                 FALSE,               /* italic */
                 FALSE,               /* underline */
                 FALSE,               /* strikeout */
                 ANSI_CHARSET,        /* charset (I need ANSI set) */
                 OUT_DEFAULT_PRECIS,  /* out precision    */
                 CLIP_DEFAULT_PRECIS, /* clip precision   */
                 PROOF_QUALITY, /* quality (should it be DRAFT or DEFAULT so
                                   that height would become more important?) */
                 FIXED_PITCH | FF_MODERN, /* pitch and family */
                 "Courier"); /* typeface (again, what should read here, is 
                                Courier-Medium considered to be a typeface of
                                its own or does it belong to Courier?) */

Now, where did I go wrong? Why did Windows select 10 point font instead of 
requested 8? These fonts that can be seen in Sample of Font listbox should be
available for applications, shouldn`t them?

If you do have some experience in using add-on fonts, please let me know the
trick! Thanks in advance,
-Ilpo


--
Ilpo Karjalainen - Dept. of Information processing science, Oulu University
kit@sunrise.oulu.fi, kit@tolsun.oulu.fi, tel. +358-81-563 241 (voice)
Technical Details
Message-ID: <1991May31.113701.27692@ousrvr.oulu.fi>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!sics.se!fuug!news.funet.fi!ousrvr.oulu.fi!sunrise!kit

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!sics.se!fuug!news.funet.fi!ousrvr.oulu.fi!sunrise!kit
From: kit@sunrise.oulu.fi (Ilpo Tapio Karjalainen)
Newsgroups: comp.windows.ms.programmer
Subject: Add-On-Font Problem?
Message-ID: <1991May31.113701.27692@ousrvr.oulu.fi>
Date: 31 May 91 11:37:01 GMT
Sender: news@ousrvr.oulu.fi
Reply-To: kit@sunrise.oulu.fi (Ilpo Tapio Karjalainen)
Organization: University of Oulu
Lines: 59