Example #1
0
CFX_Font::~CFX_Font()
{
    if (m_pSubstFont) {
        delete m_pSubstFont;
        m_pSubstFont = NULL;
    }
    if (m_pFontDataAllocation) {
        FX_Free(m_pFontDataAllocation);
        m_pFontDataAllocation = NULL;
    }
    if (m_Face) {
        if (FXFT_Get_Face_External_Stream(m_Face)) {
            FXFT_Clear_Face_External_Stream(m_Face);
        }
        if(m_bEmbedded) {
            DeleteFace();
        } else {
            CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
        }
    }
    if (m_pOwnedStream) {
        FX_Free(m_pOwnedStream);
        m_pOwnedStream = NULL;
    }
    if (m_pGsubData) {
        FX_Free(m_pGsubData);
        m_pGsubData = NULL;
    }
#if _FXM_PLATFORM_  == _FXM_PLATFORM_APPLE_
    ReleasePlatformResource();
#endif
}
Example #2
0
CFX_Font::~CFX_Font() {
  delete m_pSubstFont;
  FX_Free(m_pFontDataAllocation);
#ifdef PDF_ENABLE_XFA
  if (m_bLogic) {
    m_OtfFontData.DetachBuffer();
    return;
  }
#endif  // PDF_ENABLE_XFA
  if (m_Face) {
#ifndef PDF_ENABLE_XFA
    if (FXFT_Get_Face_External_Stream(m_Face)) {
      FXFT_Clear_Face_External_Stream(m_Face);
    }
#endif  // PDF_ENABLE_XFA
    if (m_bEmbedded) {
      DeleteFace();
    } else {
      CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
    }
  }
#ifdef PDF_ENABLE_XFA
  FX_Free(m_pOwnedStream);
#endif  // PDF_ENABLE_XFA
  FX_Free(m_pGsubData);
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
  ReleasePlatformResource();
#endif
}
FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc,
                                        FX_WCHAR wcUnicode) {
  IFX_FileRead* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode());
  if (!pFileRead)
    return FALSE;
  FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex);
  FT_Error retCharmap = FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE);
  FT_Error retIndex = FXFT_Get_Char_Index(pFace, wcUnicode);
  pFileRead->Release();
  if (!pFace)
    return FALSE;
  if (FXFT_Get_Face_External_Stream(pFace))
    FXFT_Clear_Face_External_Stream(pFace);
  FXFT_Done_Face(pFace);
  return !retCharmap && retIndex;
}
Example #4
0
void CFGAS_FontMgr::RegisterFaces(IFX_SeekableReadStream* pFontStream,
                                  const CFX_WideString* pFaceName) {
  int32_t index = 0;
  int32_t num_faces = 0;
  do {
    FXFT_Face pFace = LoadFace(pFontStream, index++);
    if (!pFace)
      continue;
    // All faces keep number of faces. It can be retrieved from any one face.
    if (num_faces == 0)
      num_faces = pFace->num_faces;
    RegisterFace(pFace, pFaceName);
    if (FXFT_Get_Face_External_Stream(pFace))
      FXFT_Clear_Face_External_Stream(pFace);
    FXFT_Done_Face(pFace);
  } while (index < num_faces);
}
CFX_Font::~CFX_Font()
{
    if (m_pSubstFont) {
        delete m_pSubstFont;
        m_pSubstFont = NULL;
    }
#ifdef FOXIT_CHROME_BUILD
    if (m_pFontDataAllocation) {
        FX_Free(m_pFontDataAllocation);
        m_pFontDataAllocation = NULL;
    }
#endif
    if (m_Face) {
#ifdef FOXIT_CHROME_BUILD
        FXFT_Library library = FXFT_Get_Face_FreeType(m_Face);
        if (FXFT_Get_Face_External_Stream(m_Face)) {
            FXFT_Clear_Face_External_Stream(m_Face);
        }
#endif
        if(m_bEmbedded) {
            DeleteFace();
        } else {
            CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face);
        }
    }
    if (m_pOwnedStream) {
        FX_Free(m_pOwnedStream);
        m_pOwnedStream = NULL;
    }
    if (m_pGsubData) {
        FX_Free(m_pGsubData);
        m_pGsubData = NULL;
    }
#if (_FXM_PLATFORM_  == _FXM_PLATFORM_APPLE_ && (!defined(_FPDFAPI_MINI_)))
    ReleasePlatformResource();
#endif
}