Share via


IMLangFontLink2::MapFont method

Creates a font to output the characters from the given set of code pages or to output a character not found in a codepage.

Syntax

HRESULT MapFont(
  [in]  HDC   hDC,
  [in]  DWORD dwCodePages,
  [in]  WCHAR chSrc,
  [out] HFONT *pFont
);

Parameters

  • hDC [in]
    A handle to a device context.

  • dwCodePages [in]
    The source set of code pages. This is set to zero when a font is created for a character that is identified in chSrc and is not found in a codepage.

  • chSrc [in]
    The source for a Unicode character that does not map to a codepage character set. The parameter chSrc is ignored, unless dwCodePages is set to zero.

  • pFont [out]
    A pointer to a font object where the created font is 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 IMLangFontLink2::MapFont, it should call IMLangFontLink2::ReleaseFont to remove the font object from the cache.

Unlike MapFont, IMLangFontLink2::MapFont supports non-Windows codepage character font linking. To locate a font for a Unicode character that is not found in a codepage, dwCodePages must be set to zero, and chSrc must contain the Unicode character source. All system fonts are then searched to locate the font that supports this character.

When you use IMLangFontLink2::MapFont, it is assumed that the required font is already selected into the hDC.

Note  IMLangFontLink2::GetScriptFontInfo is an alternative to using IMLangFontLink2::MapFont because it performs a script-based font link that works with both codepage-based Unicode characters and noncodepage-based Unicode characters.

 

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mlang.h

IDL

Mlang.idl

DLL

Mlang.dll

See also

IMLangFontLink2