Article View: comp.windows.ms.programmer
Article #205Re: How to select a font with size in points? - HELP
From: Urs Beckmann
Date: Tue, 07 Apr 1992 17:18
Date: Tue, 07 Apr 1992 17:18
39 lines
2139 bytes
2139 bytes
In article <266570021@hpopd.pwd.hp.com> richardh@hpopd.pwd.hp.com (Richard Hancock) writes: >/ hpopd:comp.windows.ms.programmer / tonym@polari.com / 2:29 pm Apr 2, 1992 / > > >Try this out. Create a DC for the printer. Set the mapping mode to MM_TWIPS. >Enumerate all the available fonts. Choose one of these fonts and use >CreateFontIndirect() to create a HFONT using the lpLogFont passed during the >enumeration. Terminate the enumeration. Select the font into the DC for the >printer. Get the text metrics of the font. > >You should find that the text metrics DO NOT match those passed during the >enumeration. > My experience with postscript printer driver and Courier Font was, that the matching didnt work for MM_TEXT nor MM_TWIPS. The resulted Fontsize from TextMetrics was smaller than the desired one from LOGFONT-structure. An interesting additional fact is that internalleading and external leading were both zero for this font. What worked for me was modifying the LOGFONT-structure after EnumFonts(). The desired fontsize is entered directly into LOGFONT: lf.lfHeight=-20*12; (Assuming 12 pts-font and MM_TWIPS-mode) The miracle is that you really get a 12 pts font on paper. >>Point size generally refers to line height not character height, so you do not >>need to subtract the internal leading. > >Not according to Petzold, and not according to my own experience with >LaserJets. Internal leading is not included in pointsize. The printerdriver handles this correctly if lf.lfHeight has a negative value. Urs ----- U. Beckmann Rechenzentrum der ETH Zuerich Switzerland
Technical Details
Message-ID:
<1992Apr7.171852.18786@bernina.ethz.ch>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!Sirius.dfn.de!chx400!bernina!ursbReferences:
<1992Mar19.040455.9972@hubcap.clemson.edu> <266570021@hpopd.pwd.hp.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!mips!darwin.sura.net!Sirius.dfn.de!chx400!bernina!ursb From: ursb@bernina.ethz.ch (Urs Beckmann) Subject: Re: How to select a font with size in points? - HELP Message-ID: <1992Apr7.171852.18786@bernina.ethz.ch> Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH References: <1992Mar19.040455.9972@hubcap.clemson.edu> <266570021@hpopd.pwd.hp.com> Date: Tue, 7 Apr 1992 17:18:52 GMT Lines: 40