IPrintCoreHelper::GetFontSubstitution method (prcomoem.h)

The IPrintCoreHelper::GetFontSubstitution method indicates which device font, if any, is used as a substitution font for a specified TrueType font.

Syntax

HRESULT GetFontSubstitution(
  [in]  IN PCWSTR  pszTrueTypeFontName,
  [out] OUT PCWSTR *ppszDevFontName
);

Parameters

[in] pszTrueTypeFontName

A pointer to a null-terminated Unicode string that contains the name of a TrueType font.

[out] ppszDevFontName

A pointer to a variable that receives the address of a null-terminated Unicode string. This string contains the name of the device font that will be used in place of the TrueType font specified in the pszFontName parameter. If there is no device font that can serve as a substitute for the specified TrueType font, this parameter is set to NULL.

Return value

IPrintCoreHelper::GetFontSubstitution should return one of the following values:

Return code Description
S_OK The method read the option for the specified feature.
E_FAIL The font that was requested does not exist or was not a TrueType font.
E_INVALIDARG One or more of the arguments is invalid.
E_OUTOFMEMORY The core driver was not able to service the request because there was insufficient memory.
E_UNEXPECTED, or other return codes not listed elsewhere in this table The core driver seems to be in an invalid state. The caller should return a failure code.

Remarks

If an application attempts to print text that uses the TrueType font specified in the pszTrueTypeFontName parameter, that text will instead be printed in the device font specified in the ppszDevFontName parameter. The device font name must be that of a valid, installed font.

A font is identified by its font face name, which appears in the lfFaceName member of the LOGFONT structure.

To obtain a list of available fonts, create an information context for the current printer, and call SetGraphicsMode(hIC, GM_ADVANCED). Then enumerate device fonts by means of a call to EnumFontFamilies. The callback parameter (see EnumFontFamProc) of EnumFontFamilies should filter for device fonts by incrementing a counter for each font for which the bitwise AND result (FontType & TRUETYPE_FONTTYPE) is nonzero.

Requirements

Requirement Value
Target Platform Desktop
Header prcomoem.h (include Prcomoem.h)

See also

IPrintCoreHelper

IPrintCoreHelper::SetFontSubstitution