のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

Faceクラス

namespace SharpFont
{
	public sealed class Face : IDisposable
	{
		private IntPtr reference;
		private FaceRec rec;
		private Library parentLibrary;

		public Face(Library library, string path, int faceIndex)
			: this(library)
		{
			IntPtr reference;
			Error err = FT.FT_New_Face(library.Reference, path, faceIndex, out reference);

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

			Reference = reference;
		}

Referenceは、プロパティ

	internal IntPtr Reference
		{
			get
			{
				if (disposed)
					throw new ObjectDisposedException("Reference", "Cannot access a disposed object.");

				return reference;
			}

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

				reference = value;
				rec = PInvokeHelper.PtrToStructure<FaceRec>(reference);
			}
	

FaceRecクラス

namespace SharpFont.Internal
{
	[StructLayout(LayoutKind.Sequential)]
	internal class FaceRec
	{
		internal FT_Long num_faces;
		internal FT_Long face_index;

		internal FT_Long face_flags;
		internal FT_Long style_flags;

		internal FT_Long num_glyphs;

		internal IntPtr family_name;
		internal IntPtr style_name;

		internal int num_fixed_sizes;
		internal IntPtr available_sizes;

		internal int num_charmaps;
		internal IntPtr charmaps;

		internal GenericRec generic;

		internal BBox bbox;

		internal ushort units_per_EM;
		internal short ascender;
		internal short descender;
		internal short height;

		internal short max_advance_width;
		internal short max_advance_height;

		internal short underline_position;
		internal short underline_thickness;

		internal IntPtr glyph;
		internal IntPtr size;
		internal IntPtr charmap;

		private IntPtr driver;
		private IntPtr memory;
		private IntPtr stream;

		private IntPtr sizes_list;
		private GenericRec autohint;
		private IntPtr extensions;

		private IntPtr @internal;

		internal static int SizeInBytes { get { return Marshal.SizeOf(typeof(FaceRec)); } }
	}
}