Skip to main content
A newer version of this page is available. .

GraphicsCache.GetFont(Font, FontStyle) Method

Gets a font object with the specified settings.

Namespace: DevExpress.Utils.Drawing

Assembly: DevExpress.Utils.v18.2.dll

Declaration

public Font GetFont(
    Font font,
    FontStyle fontStyle
)

Parameters

Name Type Description
font Font

A Font object whose settings specify the desired font’s typeface and size.

fontStyle FontStyle

A bitwise combination of Font enumeration values specifying the desired font style.

Returns

Type Description
Font

A Font object representing a font with the specified settings.

Remarks

The following cases may take place:

  • the method returns the font object which was passed as the parameter if its style matches the font style specified;
  • if the specified font object’s style doesn’t match the font style specified, the method searches for a font with the desired settings in the internal fonts hashtable. If found, the font is returned;
  • if the internal fonts hashtable doesn’t contain the desired font, a new font object is created, customized to meet the desired settings, added to the hashtable and then returned.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetFont(Font, FontStyle) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also