FT_New_Face_From_FOND() private method

private FT_New_Face_From_FOND ( IntPtr library, IntPtr fond, int face_index, IntPtr &aface ) : System.Error
library System.IntPtr
fond System.IntPtr
face_index int
aface System.IntPtr
return System.Error
Ejemplo n.º 1
0
        /// <summary>
        /// Create a new face object from a FOND resource.
        /// </summary>
        /// <remarks>
        /// This function can be used to create <see cref="Face"/> objects from fonts that are installed in the system
        /// as follows.
        /// <code>
        /// fond = GetResource( 'FOND', fontName );
        /// error = FT_New_Face_From_FOND( library, fond, 0, &amp;face );
        /// </code>
        /// </remarks>
        /// <param name="fond">A FOND resource.</param>
        /// <param name="faceIndex">Only supported for the -1 ‘sanity check’ special case.</param>
        /// <returns>A handle to a new face object.</returns>
        public Face NewFaceFromFond(IntPtr fond, int faceIndex)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");
            }

            IntPtr faceRef;

            Error err = FT.FT_New_Face_From_FOND(Reference, fond, faceIndex, out faceRef);

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

            return(new Face(faceRef, this));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new face object from a FOND resource.
        /// </summary>
        /// <remarks>
        /// This function can be used to create <see cref="Face"/> objects from fonts that are installed in the system
        /// as follows.
        /// <code>
        /// fond = GetResource( 'FOND', fontName );
        /// error = FT_New_Face_From_FOND( library, fond, 0, &amp;face );
        /// </code>
        /// </remarks>
        /// <param name="fond">A FOND resource.</param>
        /// <param name="faceIndex">Only supported for the -1 ‘sanity check’ special case.</param>
        /// <returns>A handle to a new face object.</returns>
        public Face NewFaceFromFond(IntPtr fond, int faceIndex)
        {
            if (!FT.IsMacOS)
            {
                throw new InvalidOperationException(
                          $"{nameof(NewFaceFromFond)} can only be called on macOS.");
            }

            if (disposed)
            {
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");
            }

            IntPtr faceRef;

            Error err = FT.FT_New_Face_From_FOND(Reference, fond, faceIndex, out faceRef);

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

            return(new Face(faceRef, this));
        }