FT_New_Face_From_FSSpec() private method

private FT_New_Face_From_FSSpec ( IntPtr library, IntPtr spec, int face_index, IntPtr &aface ) : System.Error
library System.IntPtr
spec System.IntPtr
face_index int
aface System.IntPtr
return System.Error
Esempio n. 1
0
        /// <summary>
        /// Create a new face object from a given resource and typeface index using an FSSpec to the font file.
        /// </summary>
        /// <remarks>
        /// <see cref="NewFaceFromFSSpec"/> is identical to <see cref="NewFace"/> except it accepts an FSSpec instead
        /// of a path.
        /// </remarks>
        /// <param name="spec">FSSpec to the font file.</param>
        /// <param name="faceIndex">The index of the face within the resource. The first face has index 0.</param>
        /// <returns>A handle to a new face object.</returns>
        public Face NewFaceFromFSSpec(IntPtr spec, int faceIndex)
        {
            if (disposed)
            {
                throw new ObjectDisposedException("Library", "Cannot access a disposed object.");
            }

            IntPtr faceRef;

            Error err = FT.FT_New_Face_From_FSSpec(Reference, spec, faceIndex, out faceRef);

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

            return(new Face(faceRef, this));
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new face object from a given resource and typeface index using an FSSpec to the font file.
        /// </summary>
        /// <remarks>
        /// <see cref="NewFaceFromFSSpec"/> is identical to <see cref="NewFace"/> except it accepts an FSSpec instead
        /// of a path.
        /// </remarks>
        /// <param name="spec">FSSpec to the font file.</param>
        /// <param name="faceIndex">The index of the face within the resource. The first face has index 0.</param>
        /// <returns>A handle to a new face object.</returns>
        public Face NewFaceFromFSSpec(IntPtr spec, int faceIndex)
        {
            if (!FT.IsMacOS)
            {
                throw new InvalidOperationException(
                          $"{nameof(NewFaceFromFSSpec)} 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_FSSpec(Reference, spec, faceIndex, out faceRef);

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

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