コード例 #1
0
        public static void SetFactory(IDWriteFontCollectionLoader loader, IDWriteFactory factory)
        {
            IntPtr shadowPtr = ToCallbackPtr <IDWriteFontCollectionLoader>(loader);
            IDWriteFontCollectionLoaderShadow shadow = ToShadow <IDWriteFontCollectionLoaderShadow>(shadowPtr);

            shadow._factory = factory;
        }
コード例 #2
0
            private static int CreateEnumeratorFromKeyImpl(IntPtr thisPtr, IntPtr factory, IntPtr collectionKey, int collectionKeySize, out IntPtr fontFileEnumerator)
            {
                fontFileEnumerator = IntPtr.Zero;
                try
                {
                    IDWriteFontCollectionLoaderShadow shadow   = ToShadow <IDWriteFontCollectionLoaderShadow>(thisPtr);
                    IDWriteFontCollectionLoader       callback = (IDWriteFontCollectionLoader)shadow.Callback;
                    Debug.Assert(factory == shadow._factory.NativePointer);
                    IDWriteFontFileEnumerator enumerator = callback.CreateEnumeratorFromKey(shadow._factory, collectionKey, collectionKeySize);
                    fontFileEnumerator = IDWriteFontFileEnumeratorShadow.ToIntPtr(enumerator);
                }
                catch (Exception exception)
                {
                    return((int)Result.GetResultFromException(exception));
                }

                return(Result.Ok.Code);
            }
コード例 #3
0
 /// <summary>
 /// Registers a custom font collection loader with the factory object.
 /// </summary>
 /// <param name="fontCollectionLoader">Reference to a <see cref="IDWriteFontCollectionLoader"/> object to be registered.</param>
 public void RegisterFontCollectionLoader(IDWriteFontCollectionLoader fontCollectionLoader)
 {
     IDWriteFontCollectionLoaderShadow.SetFactory(fontCollectionLoader, this);
     RegisterFontCollectionLoader_(fontCollectionLoader);
     _fontCollectionLoaderCallbacks.Add(fontCollectionLoader);
 }