IMLangFontLink2::MapFont
A version of this page is also available for
4/8/2010
This method creates a font to output the characters from the given set of code pages or to output a character not found in a code page.
Syntax
HRESULT MapFont(
HDC hDC,
DWORD dwCodePages,
WCHAR chSrc,
HFONT* pFont
);
Parameters
- hDC
[in] Handle to a device context.
- dwCodePages
[in] Specifies the source set of code pages. This value should be set to zero when creating a font for a character identified in the chSrc parameter that is not found in a code page.
- chSrc
[in] Source for a Unicode character that does not map to a code page character set. This parameter is ignored unless the value of the dwCodePages parameter is set to zero.
- pFont
[out] Pointer to a font object where the created font will be returned.
Return Value
Returns S_OK if successful or E_FAIL otherwise.
Remarks
MLang implements a font cache to store the custom fonts created by this method. When a client has finished using a font created by this method, the client should call the IMLangFontLink2::ReleaseFont method to remove the font object from the cache.
Unlike the IMLangFontLink::MapFont method, the IMLangFontLink2::MapFont method supports non-Windows code page character font linking. To locate a font for a Unicode character not found in a code page, the value of the dwCodePages parameter must be set to zero and the chSrc parameter must contain the Unicode character source. All system fonts are then searched to locate the font that supports this character.
When using the IMLangFontLink2::MapFont method, it is assumed that the desired font is already selected in the hDC parameter.
Note
The IMLangFontLink2::GetScriptFontInfo method is an alternative to using the IMLangFontLink2::MapFont method as it performs a script-based fontlink that works with both code-page-based and non-code-page-based Unicode characters.
Requirements
Header | mlang.h, mlang.idl |
Library | mlang.dll |
Windows Embedded CE | Windows CE .NET 4.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |