The alternative to selecting a specific font is to set the match value to 0. To have the Presentation Manager programming interface select the closest-matching font available, do the following:
Filling in the FATTRS Structure
┌──────────────────────────────┬──────────────────────────────┐ │If using a match number │If not using a match number │ ├──────────────────────────────┼──────────────────────────────┤ │Set the match number to the │Set the match number to zero. │ │required FONTMETRICS value. │ │ │The FONTMETRICS value is the │If your font is an image font:│ │value in the FONTMETRICS │ │ │structure for the required │Set the maximum baseline │ │font returned by GpiQueryFonts│extent to the required │ │. │FONTMETRICS value. │ │ │ │ │Set the maximum baseline │Set the average character │ │extent to zero. │width to the required │ │ │FONTMETRICS value. │ │Set the average character │ │ │width to zero. │ │ │ │ │ │Note: A negative lMatch is │ │ │only unique for a device. A │ │ │positive lMatch is only unique│ │ │on a particular system at a │ │ │particular time. │ │ └──────────────────────────────┴──────────────────────────────┘
Also observe the rules concerning the font-use indicator that are listed in the following table.
Font-Use Indicator Considerations
┌──────────────────────────────┬──────────────────────────────┐ │If you have not set the │If you have set the │ │FATTR_FONTUSE_OUTLINE │FATTR_FONTUSE_OUTLINE │ │indicator: │indicator: │ ├──────────────────────────────┼──────────────────────────────┤ │PM looks for an image font │PM looks for a suitable │ │that has the required │outline font whose selection │ │selection indicators and whose│indicators match those you │ │maximum baseline extent and │have specified. │ │average character width match │ │ │those you have specified. │If no suitable outline font is│ │ │found, the default font is │ │If no suitable image font is │used. No attempt is made to │ │found, PM looks for an outline│substitute an image font. │ │font with the required face │ │ │name and selection indicators.│ │ │ │ │ │If no suitable outline font is│ │ │found, the default font is │ │ │made available to you. │ │ └──────────────────────────────┴──────────────────────────────┘
Outline fonts are affected by the current character attributes (for example, character box, shear, and angle). Because an outline font might be made available to you, even when you requested an image font, call GpiQueryFontMetrics to determine whether the font is an image font or an outline font. GpiQueryFontMetrics returns the metrics of the current logical font in world coordinates.
The setting of the definition indicators in the FONTMETRICS structure tell you whether the font is either an image or outline font, or a device or generic font. If the font is an outline font, specify values for the character attributes before using the font. Outline fonts are unaffected by the maximum baseline extent and average character width values specified in GpiCreateLogFont.
If the default font provided is an image font, and you also have specified FATTR_FONTUSE_TRANSFORMABLE, any attempt to draw graphics characters in CM_MODE3 raises an error condition. This is an exception to the general rule that a FATTR_FONTUSE_TRANSFORMABLE font must be used in CM_MODE3 only.