Table of Contents

Class FontFileStreamNative

Namespace
SharpDX.DirectWrite
Assembly
SharpDX.Direct2D1.dll
[Guid("6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0")]
public class FontFileStreamNative : ComObject, FontFileStream, IUnknown, ICallbackable, IDisposable
Inheritance
FontFileStreamNative
Implements
IUnknown
ICallbackable
Derived

Constructors

FontFileStreamNative(nint)

public FontFileStreamNative(nint nativePtr)

Parameters

nativePtr nint

Properties

FileSize_

Obtains the total size of a file.

public long FileSize_ { get; }

Property Value

long

Remarks

Implementing GetFileSize() for asynchronously loaded font files may require downloading the complete file contents. Therefore, this method should be used only for operations that either require a complete font file to be loaded (for example, copying a font file) or that need to make decisions based on the value of the file size (for example, validation against a persisted file size).

LastWriteTime_

Obtains the last modified time of the file.

public long LastWriteTime_ { get; }

Property Value

long

Remarks

The "last modified time" is used by DirectWrite font selection algorithms to determine whether one font resource is more up to date than another one.

Methods

GetFileSize()

Obtains the total size of a file.

public long GetFileSize()

Returns

long

the total size of the file.

Remarks

Implementing GetFileSize() for asynchronously loaded font files may require downloading the complete file contents. Therefore, this method should be used only for operations that either require a complete font file to be loaded (for example, copying a font file) or that need to make decisions based on the value of the file size (for example, validation against a persisted file size).

GetLastWriteTime()

Obtains the last modified time of the file.

public long GetLastWriteTime()

Returns

long

the last modified time of the file in the format that represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).

Remarks

The "last modified time" is used by DirectWrite font selection algorithms to determine whether one font resource is more up to date than another one.

ReadFileFragment(out nint, long, long, out nint)

Reads a fragment from a font file.

public void ReadFileFragment(out nint fragmentStart, long fileOffset, long fragmentSize, out nint fragmentContext)

Parameters

fragmentStart nint

When this method returns, contains an address of a reference to the start of the font file fragment. This parameter is passed uninitialized.

fileOffset long

The offset of the fragment, in bytes, from the beginning of the font file.

fragmentSize long

The size of the file fragment, in bytes.

fragmentContext nint

When this method returns, contains the address of

Remarks

Note that ReadFileFragment implementations must check whether the requested font file fragment is within the file bounds. Otherwise, an error should be returned from ReadFileFragment. {{DirectWrite}} may invoke FontFileStream methods on the same object from multiple threads simultaneously. Therefore, ReadFileFragment implementations that rely on internal mutable state must serialize access to such state across multiple threads. For example, an implementation that uses separate Seek and Read operations to read a file fragment must place the code block containing Seek and Read calls under a lock or a critical section.

ReleaseFileFragment(nint)

Releases a fragment from a file.

public void ReleaseFileFragment(nint fragmentContext)

Parameters

fragmentContext nint

A reference to the client-defined context of a font fragment returned from {{ReadFileFragment}}.

Operators

explicit operator FontFileStreamNative(nint)

public static explicit operator FontFileStreamNative(nint nativePtr)

Parameters

nativePtr nint

Returns

FontFileStreamNative