home *** CD-ROM | disk | FTP | other *** search
- From: Monroe.Thomas@ttlg.UUCP (Monroe Thomas)
- Sender: postmaster@ttlg.UUCP
- Path: sparky!uunet!wupost!gumby!destroyer!ubc-cs!alberta!ttlg!postmaster
- Newsgroups: comp.os.ms-windows.programmer.misc
- Subject: Printer Fonts
- Message-ID: <714807912.3@ttlg.ttlg.UUCP>
- Date: 25 Aug 92 22:11:06 mst
- Lines: 46
-
- DW>I just received Quick C for Windows and am attempting to write my
- >first application. I have managed to print out my data with an abort dialog
- >box. I am trying to figure out how to change the printer font. I have
- >Programming Windows by Charles Petzold and I am unable to figure out how to
- >change the Printer Font. Does anyone know of another book or have some
- >sample code of how to do this? Thank you.
-
-
- Sure, you need to fill in the attributes of a LOGFONT structure,
- and then select that font into the printer device context.
-
- Eg.
-
- HFONT hfontPrinter;
- HFONT hfontOld;
- LOGFONT lf;
-
- // initialize structure to zero, fill in attributes as desired
- memset(&lf, 0, sizeof(LOGFONT));
- lf.lfWeight = FW_NORMAL;
- lf.lfHeight = -10;
- lstrcpy(lf.lfFaceName, "MS Sans Serif");
-
- // get handle to new font
- hfontPrinter = CreateFontIndirect(&lf);
-
- // select font into printer device context
- // when doing so, hfontOld will contain
- // handle to old printer font
- hfontOld = SelectObject(hdcPrinter, hfontPrinter);
-
- ... // printing code //
-
- // put old font back into printer DC, and delete new font
- // object since it is no longer needed
- SelectObject(hdcPrinter, hfontOld);
- DeleteObject(hfontPrinter);
-
- ... // other clean up code
-
-
- -Monroe
-
- * OLX 2.2 * MT: Those are my initials, not the state of my head!
-
- * Origin: Through the Looking Glass (42:100/14)
-