GreRealizeFont is called by the graphics engine to allow the presentation driver to satisfy logical font requests. The example below shows a typical font-matching algorithm for the presentation driver:
/* If the face name is empty, the application is requesting the default font. Return NO_MATCH.*/ if(Font->szFacename = NULL) { return(0); } /* If the match number is positive, an engine font is required. Return NO_MATCH. */ if(Font->lfMatch > 0) { return(0); } /* If the match number is negative, a device font is required. The presentation driver should */ /* return the font if it exists; otherwise return NO_MATCH. */ if(Font->lMatch < 0) { if(font with required lMatch exists) { /* Check the fsSelection flags and szFacename. If the font is unable to satisfy these */ /* flags, return NO_MATCH. Otherwise, return the device font handle. */ if((FATTR_FONTUSE_OUTLINE && font not outline) ||(FATTR_FONTUSE_TRANSFORMABLE && font not outline) ||(szFacename does not match font)) return(0); else return(device_font_handle); } else { /* Attempt metrics match (i.e. all metrics including szFaceName, usCodePage, lAveCharWidth */ /* and lMaxBaselineExt). If match exists, return device font handle. Otherwise, return */ /* NO_MATCH. */ if(metric match exists) { return(device_font_handle); } else return(0); } } /* The match number is zero, the presentation driver should search for a font with the */ /* specified metrics, and if an exact match exists, return the device font handle. Otherwise, */ /* return NO_MATCH. */ if(Font->lMatch = 0) { if(metrics match exists - see above) { /* Check the fsSelection flags. If the font is unable to satisfy these flags, return */ /* NO_MATCH. Otherwise, return the device font handle. */ if((FATTR_FONTUSE_OUTLINE && font not outline) ||(FATTR_FONTUSE_TRANSFORMABLE && font not outline) return(0); else return(device_font_handle); } else return(0); }
Graphics Engine Simulation