Table of Contents

Class FontSet

Namespace
SharpDX.DirectWrite
Assembly
SharpDX.Direct2D1.dll
[Guid("53585141-D9F8-4095-8321-D73CF6BD116B")]
public class FontSet : ComObject
Inheritance
FontSet

Constructors

FontSet(nint)

public FontSet(nint nativePtr)

Parameters

nativePtr nint

Properties

FontCount

Get the number of total fonts in the set.

public int FontCount { get; }

Property Value

int

Methods

FindFontFace(FontFace, out int, out RawBool)

Gets the index of the matching font face reference in the font set, with the same file, face index, and simulations.

public void FindFontFace(FontFace fontFace, out int listIndex, out RawBool exists)

Parameters

fontFace FontFace

Font face object that specifies the physical font.

listIndex int

Receives the zero-based index of the matching font if the font was found, or UINT_MAX otherwise.

exists RawBool

Receives TRUE if the font exists or SharpDX.Result.False otherwise.

FindFontFaceReference(FontFaceReference, out int, out RawBool)

Gets the index of the matching font face reference in the font set, with the same file, face index, and simulations.

public void FindFontFaceReference(FontFaceReference fontFaceReference, out int listIndex, out RawBool exists)

Parameters

fontFaceReference FontFaceReference

Font face object that specifies the physical font.

listIndex int

Receives the zero-based index of the matching font if the font was found, or UINT_MAX otherwise.

exists RawBool

Receives TRUE if the font exists or SharpDX.Result.False otherwise.

GetFontFaceReference(int, out FontFaceReference)

Gets a reference to the font at the specified index, which may be local or remote.

public void GetFontFaceReference(int listIndex, out FontFaceReference fontFaceReference)

Parameters

listIndex int

Zero-based index of the font.

fontFaceReference FontFaceReference

Receives a reference the font face reference object, or nullptr on failure.

GetMatchingFonts(FontProperty[], int, out FontSet)

Returns a subset of fonts filtered by the given properties.

public void GetMatchingFonts(FontProperty[] ropertiesRef, int propertyCount, out FontSet filteredSet)

Parameters

ropertiesRef FontProperty[]

List of properties to filter using.

propertyCount int

The number of properties to filter.

filteredSet FontSet

The subset of fonts that match the properties, or nullptr on failure.

Remarks

If no fonts matched the filter, the subset will be empty (GetFontCount returns 0), but the function does not return an error. The subset will always be equal to or less than the original set. If you only want to filter out remote fonts, you may pass null in properties and zero in propertyCount.

GetMatchingFonts(string, FontWeight, FontStretch, FontStyle, out FontSet)

Returns a subset of fonts filtered by the given properties.

public void GetMatchingFonts(string familyName, FontWeight fontWeight, FontStretch fontStretch, FontStyle fontStyle, out FontSet filteredSet)

Parameters

familyName string

List of properties to filter using.

fontWeight FontWeight

The number of properties to filter.

fontStretch FontStretch

The subset of fonts that match the properties, or nullptr on failure.

fontStyle FontStyle

No documentation.

filteredSet FontSet

The subset of fonts that match the properties, or nullptr on failure.

Remarks

If no fonts matched the filter, the subset will be empty (GetFontCount returns 0), but the function does not return an error. The subset will always be equal to or less than the original set. If you only want to filter out remote fonts, you may pass null in properties and zero in propertyCount.

GetPropertyOccurrenceCount(ref FontProperty, out int)

Returns how many times a given property value occurs in the set.

public void GetPropertyOccurrenceCount(ref FontProperty ropertyRef, out int ropertyOccurrenceCountRef)

Parameters

ropertyRef FontProperty

Font property of interest.

ropertyOccurrenceCountRef int

Receives how many times the property occurs.

GetPropertyValues(FontPropertyId, out StringList)

Returns all unique property values in the set, which can be used for purposes such as displaying a family list or tag cloud. Values are returned in priority order according to the language list, such that if a font contains more than one localized name, the preferred one will be returned.

public void GetPropertyValues(FontPropertyId propertyID, out StringList values)

Parameters

propertyID FontPropertyId

Font property of interest.

values StringList

Receives a reference to the newly created strings list.

GetPropertyValues(FontPropertyId, string, out StringList)

Returns all unique property values in the set, which can be used for purposes such as displaying a family list or tag cloud. Values are returned in priority order according to the language list, such that if a font contains more than one localized name, the preferred one will be returned.

public void GetPropertyValues(FontPropertyId propertyID, string referredLocaleNamesRef, out StringList values)

Parameters

propertyID FontPropertyId

Font property of interest.

referredLocaleNamesRef string

List of semicolon delimited language names in preferred order. When a particular string like font family has more than one localized name, the first match is returned. For example, suppose the font set includes the Meiryo family, which has both Japanese and English family names. The returned list of distinct family names would include either the Japanese name (if "ja-jp" was specified as a preferred locale) or the English name (in all other cases).

values StringList

Receives a reference to the newly created strings list.

GetPropertyValues(int, FontPropertyId, out RawBool, out LocalizedStrings)

Returns all unique property values in the set, which can be used for purposes such as displaying a family list or tag cloud. Values are returned in priority order according to the language list, such that if a font contains more than one localized name, the preferred one will be returned.

public void GetPropertyValues(int listIndex, FontPropertyId propertyId, out RawBool exists, out LocalizedStrings values)

Parameters

listIndex int

Font property of interest.

propertyId FontPropertyId

List of semicolon delimited language names in preferred order. When a particular string like font family has more than one localized name, the first match is returned. For example, suppose the font set includes the Meiryo family, which has both Japanese and English family names. The returned list of distinct family names would include either the Japanese name (if "ja-jp" was specified as a preferred locale) or the English name (in all other cases).

exists RawBool

Receives a reference to the newly created strings list.

values LocalizedStrings

Receives a reference to the newly created strings list.

Operators

explicit operator FontSet(nint)

public static explicit operator FontSet(nint nativePtr)

Parameters

nativePtr nint

Returns

FontSet