Code: Select all
; ************************************************
; Code: Point fonts.
; Authors: srod and omit59.
; Date: January 2007.
; OS: Windows only
; ************************************************
Code: Select all
GetExactPointFont()
GetLogicalPointFont()
Each procedure creates a font based on typographic points (1 point = 1/72 of an inch) and require a handle to a device context (hdc).
For a printer device context such as that obtained with Startdrawing(PrinterOutput()), both functions are absolutely identical and produce a font in exact measurements of 1/72 inches.
E.g. a font size of 72 would equate metrically to a font size of 1 inch (roughly speaking as font metrics do not easily equate to such precise values).
Printer output using such fonts will, for example, correspond exactly with the printed output from MS Word using the same fonts and font size etc.
For a screen device context such as that obtained with StartDrawing(WindowOutput(#win)), the two functions operate very differently.
The first will return a font of exact typographic measurements regardless of screen resolution and dpi. E.g. a font size of 36 will equate to roughly half an inch regardless of screen resolution.
Thus text displayed on the screen with such a font will have exactly the same metric size as when displayed on a printer (with the same font).
The second function, on the other hand, deals with 'logical inches' which can be a little fiddly to appreciate. Basically a logical inch is generally larger than a physical inch and depend upon the screen resolution and dpi setting.
(They act like a magnification factor to account for the fact that we generally view the screen from further away than when reading a printed page etc.)
Have a look at MS Word to get an idea of how logical inches can scale the measurements.
This second function returns a font which is scaled appropriately to keep pace with the size of a logical inch (depending upon the screen res. etc).
In this case, for example, a font size of 36 will correspond to half a LOGICAL INCH (not a physical one). Such fonts thus keep pace with changes to the display settings.
Code to follow in the next post.