Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Library"/> class.
        /// </summary>
        /// <remarks>
        /// SharpFont assumes that you have the correct version of FreeType for your operating system and processor
        /// architecture. If you get a <see cref="BadImageFormatException"/> here on Windows, there's a good chance
        /// that you're trying to run your program as a 64-bit process and have a 32-bit version of FreeType or vice
        /// versa. See the SharpFont.Examples project for how to handle this situation.
        /// </remarks>
        public Library()
            : this(false)
        {
            ArchitectureDllImport.LoadArchitectureDependencyDirectory();

            IntPtr libraryRef;
            Error  err = FT.FT_Init_FreeType(out libraryRef);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            Reference = libraryRef;
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Library"/> class.
        /// </summary>
        /// <param name="memory">A custom FreeType memory manager.</param>
        public Library(Memory memory)
            : this(false)
        {
            ArchitectureDllImport.LoadArchitectureDependencyDirectory();

            IntPtr libraryRef;
            Error  err = FT.FT_New_Library(memory.Reference, out libraryRef);

            if (err != Error.Ok)
            {
                throw new FreeTypeException(err);
            }

            Reference    = libraryRef;
            customMemory = true;
        }