[comp.windows.ms.programmer] Add-On-Font Problem?

kit@sunrise.oulu.fi (Ilpo Tapio Karjalainen) (05/31/91)

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)