

Otherwise it will be set to FALSE and the method will return S_OK. If there is a file at the position, it will set the hasCurrentFile to TRUE. The IDWriteFontFileEnumerator::MoveNext method changes the position to the next font file. The application-defined IDWriteFontFileEnumerator object that was created by the CreateEnumeratorFromKey method is used to enumerate the font files in a collection, creating an IDWriteFontFile object for each file. The key passed to this method identifies the font collection and is the same key passed to CreateCustomFontCollection. The IDWriteFactory object that is being used to create the collection is passed to this method and should be used by the font file enumerator to create the IDWriteFontFile objects to be included in the collection. The IDWriteFontCollectionLoader::CreateEnumeratorFromKey callback method is used by DirectWrite to retrieve an IDWriteFontFileEnumerator object implemented by the application. When the CreateCustomFontCollection method is called, DirectWrite calls back to an IDWriteFontCollectionLoader interface implemented as a singleton object by the application. Valid until the loader is unregistered using the factory.Unique to a single font collection within the scope of the loader.Whereas the key can be anything, DirectWrite requires that each key is both: The key is a void pointer and the data type, format, and meaning are defined by the application and are opaque to the font system.

You create an IDWriteFontFileEnumerator object by using the IDWriteFactory::CreateCustomFontCollection and passing it an application-defined key. Registering the font collection loader adds to the reference count do not call UnregisterFontCollectionLoader from within the destructor or the collection loader object will never be unregistered. The font collection loader must be unloaded eventually by using the IDWriteFactory::UnregisterFontCollectionLoader. Both the system font collection and custom font collections are cached, so the fonts are only loaded one time. This object will load the fonts when the custom collection is requested. You register a font collection loader by using the IDWriteFactory::RegisterFontCollectionLoader method and passing it an IDWriteFontCollectionLoader interface implemented by the application as a singleton object. Registering and unregistering a Font Collection Loader Registering and unregistering a Font Collection Loader.This overview consists of the following parts: If the fonts that you want are not in the system font collection, you can create a custom font collection derived from IDWriteFontCollection. However some applications have to use fonts that are not installed on the system, such as from included font files or font files embedded in the application. This is the font collection that is most frequently used. DirectWrite provides access to the system font collection by using the IDWriteFactory::GetSystemFontCollection method.
