Special Font Selection Considerations
Although most font selection operations involve the user, there are some
instances where this is not true. For example, a developer may want to use a unique
font in an application to draw text in a control window. To select an
appropriate font, the application must be able to determine what fonts are available,
create a logical font that describes one of these available fonts, and then
select that font into the appropriate device context.
An application can enumerate the available fonts by using the
EnumFontFamilies function. This can be useful when an application must determine which fonts
are available from a given family.
Once an application has enumerated the available fonts and located an
appropriate match, it should use the values returned by the font enumeration function
to initialize the members of a
LOGFONT structure. Then it can call the
CreateFontIndirect function, passing to it a pointer to the initialized
LOGFONT structure. If the
CreateFontIndirect function is successful, the application can then select the logical font by
calling the
SelectObject function.
When initializing the members of the
LOGFONT structure, be sure to specify a specific character set in the
lfCharSet member. This member is important in the font mapping process and the results
will be inconsistent if this member is not initialized correctly. If you
specify a typeface name in the
lfFaceName member of the
LOGFONT structure, make sure that the
lfCharSet value matches the character set of the typeface specified in
lfFaceName. For example, if you want to select a font such as "MS Mincho",
lfCharSet must be set to the predefined value SHIFTJIS_CHARSET.
- Software for developers
-
Delphi Components
.Net Components
Software for Android Developers
- More information resources
-
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
- Databases for Amazon shops developers
-
Amazon Categories Database
Browse Nodes Database