예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NGraphite.Face"/> class.
        /// </summary>
        /// <param name='filename'>
        /// fullpath to a graphite enabled font.
        /// </param>
        public Face(string filename, FaceOptions options)
        {
            if (!File.Exists(filename))
            {
                throw new ArgumentException("filename");
            }

            _face = Graphite2Api.MakeFileFace(filename, options);

            if (_face == IntPtr.Zero)
            {
                throw new ArgumentException("filename is not a graphite font");
            }
        }
예제 #2
0
        /// <summary>
        /// Determins if filename is a graphite font or not.
        /// </summary>
        public static bool IsGraphiteFont(string filename)
        {
            if (!File.Exists(filename))
            {
                return(false);
            }

            IntPtr face = Graphite2Api.MakeFileFace(filename, FaceOptions.face_default);

            if (face == IntPtr.Zero)
            {
                return(false);
            }

            Graphite2Api.FaceDestroy(face);
            return(true);
        }