Text and Fonts


WinX Auto Draw has several functions for managing fonts and drawing text.

To draw text you first need a font. A font is a GDI object, like a pen or a brush. To create a font, use the Win32 CreateFontIndirect function. This function takes a pointer to a LOGFONT structure as its argument. WinX has several functions to manage LOGFONT structures. You can initialise a LOGFONT structure for a specific font with the WinXDraw_MakeLogFont function. You can also get a font from the user with the WinXDraw_GetFontDialog function.

The size of the font as specified by the height field of the LOGFONT structure is the size in device units. The physical size of a device unit can vary between devices and even within a single device. For this reason it is common for users to specify font sizes in points. You can convert between points and screen pixels with the WinXDraw_PixelsPerPoint. For printing, you can use the WinXPrint_LogUnitsPerPoint to get the fonts to come out at the correct physical size.

Related Links

WinXDrawText
WinXDraw_GetFontDialog
WinXDraw_GetTextWidth
WinXDraw_MakeLogFont
WinXDraw_PixelsPerPoint
WinXPrint_LogUnitsPerPoint