IDWriteFontFileStream::ReadFileFragment method (dwrite.h)

Reads a fragment from a font file.

Syntax

HRESULT ReadFileFragment(
  [out] void const **fragmentStart,
        UINT64     fileOffset,
        UINT64     fragmentSize,
  [out] void       **fragmentContext
);

Parameters

[out] fragmentStart

Type: const void**

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

fileOffset

Type: UINT64

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

fragmentSize

Type: UINT64

The size of the file fragment, in bytes.

[out] fragmentContext

Type: void**

When this method returns, contains the address of a pointer to a pointer to the client-defined context to be passed to ReleaseFileFragment.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

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 IDWriteFontFileStream 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.

Requirements

Requirement Value
Minimum supported client Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 R2, Windows Server 2008 with SP2 and Platform Update for Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header dwrite.h
Library Dwrite.lib
DLL Dwrite.dll

See also

IDWriteFontFileStream