Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

GraphicsCache.GetFont(Font, FontStyle) Method

Gets a font object with the specified settings.

Namespace: DevExpress.Utils.Drawing

Assembly: DevExpress.Utils.v24.2.dll

NuGet Packages: DevExpress.Utils, DevExpress.Wpf.Core

#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.
See Also