public bool LoadFont(string font_name, GlyphRenderType ren_type, byte[] font_mem, int font_mem_size) { int face_index = 0; bool ret = false; ANT_Library library = Library; if (library != null) { m_ANTLastError = ANT_Error.ANT_Err_Ok; int idx = FindFace(font_name); if (idx >= 0) { if (m_CurrentFace == m_Faces[idx] && m_GlyphRenderType == ren_type) { return(true); } m_CurrentFace = m_Faces[idx]; m_Name = font_name; } else { ANT_Face face; if (font_mem != null && font_mem_size != 0) { m_ANTLastError = ANT.ANT_New_Memory_Face(library, font_mem, font_mem_size, face_index, out face); } else { m_ANTLastError = ANT.ANT_New_Face(library, font_name, face_index, out face); } if (m_ANTLastError == ANT_Error.ANT_Err_Ok) { m_FaceIndex++; m_Faces.Add(m_FaceIndex, face); m_FaceNames.Add(font_name, m_FaceIndex); m_CurrentFace = face; m_Name = font_name; UpdateCharSize(); } else { m_CurrentFace = null; m_Name = null; } } if (m_ANTLastError == ANT_Error.ANT_Err_Ok) { ret = true; switch (ren_type) { case GlyphRenderType.Mono: m_GlyphRenderType = GlyphRenderType.Mono; break; case GlyphRenderType.Gray8: m_GlyphRenderType = GlyphRenderType.Gray8; break; case GlyphRenderType.Outline: if (ANT.ANT_IS_SCALABLE(m_CurrentFace.face_flags)) { m_GlyphRenderType = GlyphRenderType.Outline; } else { m_GlyphRenderType = GlyphRenderType.Gray8; } break; } UpdateSignature(); } } return(ret); }