ID Number: Q72021
3.00
WINDOWS
Summary:
In Windows version 3.0, only the stroke fonts supplied with the
Windows graphical device interface (GDI) are guaranteed to be
available for rotation. The ability to rotate raster fonts or device
fonts is not guaranteed. Developers requiring font rotation should use
GDI stroke fonts.
More Information:
In Windows, there are two types of fonts: raster fonts and stroke
fonts. Raster fonts are made up of bitmaps, whereas stroke fonts are a
collection of directions for writing various strokes. The raster fonts
cannot be rotated because the work involved in the rotation would be
very device specific, due to the need to preserve font aspect ratios.
Windows 3.0 is shipped with three standard GDI stroke fonts: Script,
Modern, and Roman. Developers should not rely on this fact when
rotating fonts. The appropriate way to determine which fonts can be
rotated is to enumerate all available fonts, using the EnumFonts()
function. EnumFonts() will call a specified callback function with
information on all available fonts. The third parameter passed to this
callback function, nFontType, can be used to determine whether or not
the font is a GDI stroke font.
By using the logical AND function on nFontType and the constant
RASTER_FONTTYPE (defined in the WINDOWS.H header file), a program can
determine whether the font is a raster font or a stroke font. The font
is a raster font if (nFontType & RASTER_FONTTYPE) is nonzero.
An application can determine if the font is a GDI or device font by
ANDing nFontType with DEVICE_FONTTYPE. If the result is not zero, the
font is a device supplied font. Only those fonts that are GDI-based
stroke fonts are guaranteed to be available for rotation.
After enumerating fonts and finding a stroke font, the LOGFONT
structure passed to the callback function can be used with the
CreateFontIndirect() API to produce a handle to the desired font. A
program can modify the lfOrientation and lfEscapement fields to
perform the appropriate font rotation; note that these parameters are
specified in tenths of degrees.
Devices can also perform their own rotations. To determine whether a
device can perform character rotations (above and beyond what GDI will
do), use the GetDeviceCaps() function with the TEXTCAPS parameter.