Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: genius0215 on February 19, 2017, 09:15:18 PM

Title: FontMaker crash in OSX
Post by: genius0215 on February 19, 2017, 09:15:18 PM
  1. if (File.Exists(fileName))
  2.                 {
  3.                         if (FT_New_Face(lib, fileName, 0, out face) != 0)
  4.                         {
  5.                                 Debug.LogError("Unable to use the chosen font (FT_New_Face).");
  6.                         }
  7.                         else
  8.                         {
  9.                                 FT_FaceRec record = (FT_FaceRec)Marshal.PtrToStructure(face, typeof(FT_FaceRec));
  10.                                 names = new string[record.num_faces];
  11.  
  12.                                 for (int i = 0; i < record.num_faces; i++)
  13.                                 {
  14.                                         IntPtr ptr = IntPtr.Zero;
  15.  
  16.                                         if (FT_New_Face(lib, fileName, i, out ptr) == 0)
  17.                                         {
  18.                                                 string family = Marshal.PtrToStringAnsi(record.family_name);
  19.                                                 string style = Marshal.PtrToStringAnsi(record.style_name);//crash in this line
  20.                                                 names[i] = family + " - " + style;
  21.                                                 FT_Done_Face(ptr);
  22.                                         }
  23.                                 }
  24.                         }
  25.                 }
  26.  
NGUI version :3.11.1
Unity version :5.5.0f3
FreeType version:2.7.1/2.6.5
OSX version : macOS Sierra 10.12.3

I install freetype with brew in OSX, changing the filename to "FreeType.dylib" from "libfreetype.6.dylib"
and i still crash in line  showed above.

how can I do with this issue?
Title: Re: FontMaker crash in OSX
Post by: genius0215 on February 19, 2017, 09:18:38 PM
  1. if (File.Exists(fileName))
  2. {
  3.         if (FT_New_Face(lib, fileName, 0, out face) != 0)
  4.         {
  5.                 Debug.LogError("Unable to use the chosen font (FT_New_Face).");
  6.         }
  7.         else
  8.         {
  9.                 FT_FaceRec record = (FT_FaceRec)Marshal.PtrToStructure(face, typeof(FT_FaceRec));
  10.                 names = new string[record.num_faces];
  11.  
  12.                 for (int i = 0; i < record.num_faces; i++)
  13.                 {
  14.                         IntPtr ptr = IntPtr.Zero;
  15.  
  16.                         if (FT_New_Face(lib, fileName, i, out ptr) == 0)
  17.                         {
  18.                                 string family = Marshal.PtrToStringAnsi(record.family_name);
  19.                                 string style = Marshal.PtrToStringAnsi(record.style_name);//crash in this line
  20.                                 names[i] = family + " - " + style;
  21.                                 FT_Done_Face(ptr);
  22.                         }
  23.                 }
  24.         }
  25. }
  26.  
NGUI version :3.11.1
Unity version :5.5.0f3
FreeType version:2.7.1/2.6.5
OSX version : macOS Sierra 10.12.3

I install freetype with brew in OSX, changing the filename to "FreeType.dylib" from "libfreetype.6.dylib"
and i still crash in line  showed above.

how can I do with this issue?
Title: Re: FontMaker crash in OSX
Post by: ArenMook on February 21, 2017, 12:34:07 PM
I'm pretty sure you need a specific version of FreeType. I don't know what version comes with the OSX. Try getting the FreeType from https://www.freetype.org/ and compiling it yourself.
Title: Re: FontMaker crash in OSX
Post by: genius0215 on February 24, 2017, 08:43:07 AM
I download the newest freetype and compile it, and still crash when I use the FontMaker.
My FreeType version is 2.7.1.
I want to know which version  work well with the NGUI on OSX?
Title: Re: FontMaker crash in OSX
Post by: ArenMook on February 24, 2017, 09:32:11 AM
I believe it was FreeType 2.5, but it's been so long that I'm not sure...