Table of Contents

Class FontFile

Namespace
SharpDX.DirectWrite
Assembly
SharpDX.Direct2D1.dll
[Guid("739d886a-cef5-47dc-8769-1a8b41bebbb0")]
public class FontFile : ComObject
Inheritance
FontFile

Constructors

FontFile(Factory, nint, int, FontFileLoader)

Creates a reference to an application-specific font file resource.

public FontFile(Factory factory, nint fontFileReferenceKey, int fontFileReferenceKeySize, FontFileLoader fontFileLoader)

Parameters

factory Factory

A reference to a DirectWrite factory Factory

fontFileReferenceKey nint

A font file reference key that uniquely identifies the font file resource during the lifetime of fontFileLoader.

fontFileReferenceKeySize int

The size of the font file reference key in bytes.

fontFileLoader FontFileLoader

The font file loader that will be used by the font system to load data from the file identified by fontFileReferenceKey.

Remarks

This function is provided for cases when an application or a document needs to use a private font without having to install it on the system. fontFileReferenceKey has to be unique only in the scope of the fontFileLoader used in this call.

FontFile(Factory, string)

Creates a font file reference object from a local font file.

public FontFile(Factory factory, string filePath)

Parameters

factory Factory

A reference to a DirectWrite factory Factory

filePath string

An array of characters that contains the absolute file path for the font file. Subsequent operations on the constructed object may fail if the user provided filePath doesn't correspond to a valid file on the disk.

FontFile(Factory, string, long?)

Creates a font file reference object from a local font file.

public FontFile(Factory factory, string filePath, long? lastWriteTime)

Parameters

factory Factory

A reference to a DirectWrite factory Factory

filePath string

An array of characters that contains the absolute file path for the font file. Subsequent operations on the constructed object may fail if the user provided filePath doesn't correspond to a valid file on the disk.

lastWriteTime long?

The last modified time of the input file path. If the parameter is omitted, the function will access the font file to obtain its last write time. You should specify this value to avoid extra disk access. Subsequent operations on the constructed object may fail if the user provided lastWriteTime doesn't match the file on the disk.

FontFile(nint)

public FontFile(nint nativePtr)

Parameters

nativePtr nint

Properties

Loader

Obtains the file loader associated with a font file object.

public FontFileLoader Loader { get; }

Property Value

FontFileLoader

Methods

Analyze(out RawBool, out FontFileType, out FontFaceType, out int)

Analyzes a file and returns whether it represents a font, and whether the font type is supported by the font system.

public void Analyze(out RawBool isSupportedFontType, out FontFileType fontFileType, out FontFaceType fontFaceType, out int numberOfFaces)

Parameters

isSupportedFontType RawBool

TRUE if the font type is supported by the font system; otherwise, SharpDX.Result.False.

fontFileType FontFileType

When this method returns, contains a value that indicates the type of the font file. Note that even if isSupportedFontType is SharpDX.Result.False, the fontFileType value may be different from DWRITE_FONT_FILE_TYPE_UNKNOWN.

fontFaceType FontFaceType

When this method returns, contains a value that indicates the type of the font face. If fontFileType is not equal to DWRITE_FONT_FILE_TYPE_UNKNOWN, then that can be constructed from the font file.

numberOfFaces int

When this method returns, contains the number of font faces contained in the font file.

Remarks

Important??Certain font file types are recognized, but not supported by the font system. For example, the font system will recognize a file as a Type 1 font file but will not be able to construct a font face object from it. In such situations, Analyze will set isSupportedFontType output parameter to SharpDX.Result.False.?

GetReferenceKey()

Obtains the reference to the reference key of a font file. The returned reference is valid until the font file object is released.

public DataPointer GetReferenceKey()

Returns

DataPointer

the reference to the reference key of a font file.

Operators

explicit operator FontFile(nint)

public static explicit operator FontFile(nint nativePtr)

Parameters

nativePtr nint

Returns

FontFile