if (File.Exists(fileName))
{
if (FT_New_Face(lib, fileName, 0, out face) != 0)
{
Debug.LogError("Unable to use the chosen font (FT_New_Face).");
}
else
{
FT_FaceRec record
= (FT_FaceRec
)Marshal
.PtrToStructure(face,
typeof(FT_FaceRec
)); names
= new string[record
.num_faces];
for (int i = 0; i < record.num_faces; i++)
{
IntPtr ptr = IntPtr.Zero;
if (FT_New_Face(lib, fileName, i, out ptr) == 0)
{
string family = Marshal.PtrToStringAnsi(record.family_name);
string style = Marshal.PtrToStringAnsi(record.style_name);//crash in this line
names[i] = family + " - " + style;
FT_Done_Face(ptr);
}
}
}
}