/// <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, &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)); }
/// <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, &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)); }