Beispiel #1
0
 public void ReleaseFace()
 {
     if (m_pFTFace != null)
     {
         ANT.ANT_Done_Face(ref m_pFTFace);
         m_pFTFace = null;
     }
 }
Beispiel #2
0
        public void Dispose()
        {
            if (m_Faces != null)
            {
                foreach (ANT_Face face in m_Faces.Values)
                {
                    ANT_Face f = face;
                    ANT.ANT_Done_Face(ref f);
                }

                m_Faces.Clear();
                m_Faces = null;
            }

            if (m_FaceNames != null)
            {
                m_FaceNames.Clear();
                m_FaceNames = null;
            }

            m_Signature = null;
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 public ANTBitmapFont(FontAtlasManager pFontAtlas)
 {
     m_pFontAtlas = pFontAtlas;
     m_pFTFace    = null;
 }
Beispiel #5
0
 public void SetFTFace(ANT_Face pFTFace)
 {
     m_pFTFace = pFTFace;
 }