Definition: |
include pGUI.e
cdCanvasFont(cdCanvas hCdCanvas, nullable_string font, integer style, size) -- or -- wdCanvasFont(cdCanvas hCdCanvas, nullable_string font, integer style, atom size) |
Description: | Selects a text font. |
Comments: |
The font type can be one of the standard type faces or other driver dependent type face. Since font face names are not a standard between drivers, a few names are specially handled to improve application portability. If you want to use names that work for all systems we recommend using: "Courier", "Times" and "Helvetica". The style can be a combination of: CD_PLAIN (0), CD_BOLD (1), CD_ITALIC (2), CD_UNDERLINE (4) and CD_STRIKEOUT (8). pGUI also provides the constant CD_BOLD_ITALIC (3) for convenience. (Obvously source code should always use the named constants, the numerical values are only given to allow values seen during debugging and the like to be deciphered.) Only the Windows and PDF drivers support underline and strikeout. The size is provided in points (1/72 inch) or in pixels (using negative values). Default values: "System", CD_PLAIN, 12. You can specify partial parameters using NULL, -1 and 0 for typeface, style and size. When these parameters are specified the current font parameter is used. For example: cdCanvasFont(NULL, -1, 10) will only change the font size.
To convert between pixels and points use the function cdPixel2MM to convert from pixels to millimeters and use the formula value_in_points = CD_MM2PT * value_in_millimeters .
In WC, the size is specified in millimeters, but is internally converted to points. Fonts can heavily benefit from the ANTIALIAS attribute where available in the driver. |