[]
IDWriteFontFileStream
[Guid("6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0")]
[Shadow(typeof(FontFileStreamShadow))]
public interface IFontFileStream : ICallbackable, IDisposable
Obtains the total size of a file.
long GetFileSize()
the total size of the file.
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).
Obtains the last modified time of the file.
long GetLastWriteTime()
the last modified time of the file in the format that represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).
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.
Reads a fragment from a font file.
void ReadFileFragment(out IntPtr fragmentStart, long fileOffset, long fragmentSize, out IntPtr fragmentContext)
fragmentStart
System.IntPtrWhen this method returns, contains an address of a reference to the start of the font file fragment. This parameter is passed uninitialized.
fileOffset
longThe offset of the fragment, in bytes, from the beginning of the font file.
fragmentSize
longThe size of the file fragment, in bytes.
fragmentContext
System.IntPtrWhen this method returns, contains the address of
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 IFontFileStream 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.
Releases a fragment from a file.
void ReleaseFileFragment(IntPtr fragmentContext)
fragmentContext
System.IntPtrA reference to the client-defined context of a font fragment returned from {{ReadFileFragment}}.