Esempio n. 1
0
 /// <summary>
 /// Unregisters a custom font collection loader that was previously registered using {{RegisterFontCollectionLoader}}.
 /// </summary>
 /// <param name="fontCollectionLoader">Pointer to a <see cref="SharpDX.DirectWrite.FontCollectionLoader"/> object to be unregistered. </param>
 /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. </returns>
 /// <unmanaged>HRESULT IDWriteFactory::UnregisterFontCollectionLoader([None] IDWriteFontCollectionLoader* fontCollectionLoader)</unmanaged>
 public void UnregisterFontCollectionLoader(FontCollectionLoader fontCollectionLoader)
 {
     if (!_fontCollectionLoaderCallbacks.Contains(fontCollectionLoader))
     {
         throw new ArgumentException("This font collection loader is not registered", "fontCollectionLoader");
     }
     UnregisterFontCollectionLoader_(FontCollectionLoaderShadow.ToIntPtr(fontCollectionLoader));
     _fontCollectionLoaderCallbacks.Remove(fontCollectionLoader);
 }
Esempio n. 2
0
 /// <summary>
 /// Creates a font collection using a custom font collection loader.
 /// </summary>
 /// <param name="factory">A reference to a DirectWrite factory <see cref="Factory"/></param>
 /// <param name="collectionLoader">An application-defined font collection loader, which must have been previously registered using <see cref="Factory.RegisterFontCollectionLoader_"/>. </param>
 /// <param name="collectionKey">The key used by the loader to identify a collection of font files.  The buffer allocated for this key should at least be the size of collectionKeySize. </param>
 /// <unmanaged>HRESULT IDWriteFactory::CreateCustomFontCollection([None] IDWriteFontCollectionLoader* collectionLoader,[In, Buffer] const void* collectionKey,[None] int collectionKeySize,[Out] IDWriteFontCollection** fontCollection)</unmanaged>
 public FontCollection(Factory factory, FontCollectionLoader collectionLoader, DataPointer collectionKey)
 {
     factory.CreateCustomFontCollection_(FontCollectionLoaderShadow.ToIntPtr(collectionLoader), collectionKey.Pointer, collectionKey.Size, this);
 }
Esempio n. 3
0
 /// <summary>
 /// Registers a custom font collection loader with the factory object.
 /// </summary>
 /// <remarks>
 /// This function registers a font collection loader with DirectWrite. The font collection loader interface, which should be implemented by a singleton object, handles enumerating font files in a font collection given a particular type of key. A given instance can only be registered once. Succeeding attempts will return an error, indicating that it has already been registered. Note that font file loader implementations must not register themselves with DirectWrite inside their constructors, and must not unregister themselves inside their destructors, because registration and unregistraton operations increment and decrement the object reference count respectively. Instead, registration and unregistration with DirectWrite of font file loaders should be performed outside of the font file loader implementation.
 /// </remarks>
 /// <param name="fontCollectionLoader">Reference to a <see cref="SharpDX.DirectWrite.FontCollectionLoader"/> object to be registered. </param>
 /// <returns>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code. </returns>
 /// <unmanaged>HRESULT IDWriteFactory::RegisterFontCollectionLoader([None] IDWriteFontCollectionLoader* fontCollectionLoader)</unmanaged>
 public void RegisterFontCollectionLoader(FontCollectionLoader fontCollectionLoader)
 {
     this.RegisterFontCollectionLoader_(FontCollectionLoaderShadow.ToIntPtr(this, fontCollectionLoader));
     _fontCollectionLoaderCallbacks.Add(fontCollectionLoader);
 }
Esempio n. 4
0
 /// <summary>
 /// Creates a font collection using a custom font collection loader.
 /// </summary>
 /// <param name="factory">A reference to a DirectWrite factory <see cref="Factory"/></param>
 /// <param name="collectionLoader">An application-defined font collection loader, which must have been previously registered using <see cref="Factory.RegisterFontCollectionLoader_"/>. </param>
 /// <param name="collectionKey">The key used by the loader to identify a collection of font files.  The buffer allocated for this key should at least be the size of collectionKeySize. </param>
 /// <unmanaged>HRESULT IDWriteFactory::CreateCustomFontCollection([None] IDWriteFontCollectionLoader* collectionLoader,[In, Buffer] const void* collectionKey,[None] int collectionKeySize,[Out] IDWriteFontCollection** fontCollection)</unmanaged>
 public FontCollection(Factory factory, FontCollectionLoader collectionLoader, DataStream collectionKey)
 {
     factory.CreateCustomFontCollection_(FontCollectionLoaderShadow.ToIntPtr(collectionLoader), collectionKey.PositionPointer, (int)collectionKey.RemainingLength, this);
 }