public static void SetFactory(FontCollectionLoader loader, Factory factory)
        {
            var shadowPtr = ToIntPtr(loader);
            var shadow    = ToShadow <FontCollectionLoaderShadow>(shadowPtr);

            shadow._factory = factory;
        }
 public static IntPtr ToIntPtr(Factory factory, FontCollectionLoader fontFileEnumerator)
 {
     var shadowPtr = ToIntPtr(fontFileEnumerator);
     var shadow = ToShadow<FontCollectionLoaderShadow>(shadowPtr);
     shadow._factory = factory;
     return shadowPtr;
 }
Ejemplo n.º 3
0
        public static IntPtr ToIntPtr(Factory factory, FontCollectionLoader fontFileEnumerator)
        {
            var shadowPtr = ToIntPtr(fontFileEnumerator);
            var shadow    = ToShadow <FontCollectionLoaderShadow>(shadowPtr);

            shadow._factory = factory;
            return(shadowPtr);
        }
Ejemplo n.º 4
0
 internal FontCollectionLoader FindRegisteredFontCollectionLoaderCallback(FontCollectionLoader loader)
 {
     foreach (var fontCollectionLoaderCallback in _fontCollectionLoaderCallbacks)
     {
         if (fontCollectionLoaderCallback == loader)
             return fontCollectionLoaderCallback;
     }
     return null;
 }
Ejemplo n.º 5
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_(fontCollectionLoader);
     _fontCollectionLoaderCallbacks.Remove(fontCollectionLoader);
 }
Ejemplo n.º 6
0
 internal FontCollectionLoader FindRegisteredFontCollectionLoaderCallback(FontCollectionLoader loader)
 {
     foreach (var fontCollectionLoaderCallback in _fontCollectionLoaderCallbacks)
     {
         if (fontCollectionLoaderCallback == loader)
         {
             return(fontCollectionLoaderCallback);
         }
     }
     return(null);
 }
Ejemplo n.º 7
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);
 }
Ejemplo n.º 8
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);
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
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);
 }
Ejemplo n.º 11
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);
 }
Ejemplo n.º 12
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);
 }
Ejemplo n.º 13
0
 public static IntPtr ToIntPtr(FontCollectionLoader fontFileEnumerator)
 {
     return(ToCallbackPtr <FontCollectionLoader>(fontFileEnumerator));
 }
Ejemplo n.º 14
0
 public static IntPtr ToIntPtr(FontCollectionLoader loader)
 {
     return(ToCallbackPtr <FontCollectionLoader>(loader));
 }
Ejemplo n.º 15
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);
 }
 public static IntPtr ToIntPtr(FontCollectionLoader fontFileEnumerator)
 {
     return ToIntPtr<FontCollectionLoader>(fontFileEnumerator);
 }
Ejemplo n.º 17
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 unregistration 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)
 {
     FontCollectionLoaderShadow.SetFactory(fontCollectionLoader, this);
     this.RegisterFontCollectionLoader_(fontCollectionLoader);
     _fontCollectionLoaderCallbacks.Add(fontCollectionLoader);
 }
Ejemplo n.º 18
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(collectionLoader, collectionKey.Pointer, collectionKey.Size, this);
 }