summaryrefslogtreecommitdiff
path: root/xfa/fgas/font
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-10-24 10:19:11 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-24 10:19:11 -0700
commitad2441ef675866eb84c7392eeda03391a5a5d474 (patch)
tree5b250139c65d5f440f3b544643b1fb85e23380dd /xfa/fgas/font
parentb674ebe6dd13288160ad8e324d719a124caf5a83 (diff)
downloadpdfium-ad2441ef675866eb84c7392eeda03391a5a5d474.tar.xz
Rename IFX_ stream nameschromium/2900
It's been troubling for some time that an IFX_FileStream might actually be an in-memory buffer with no backing file. Review-Url: https://codereview.chromium.org/2443723002
Diffstat (limited to 'xfa/fgas/font')
-rw-r--r--xfa/fgas/font/fgas_gefont.h4
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.cpp27
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.h14
3 files changed, 25 insertions, 20 deletions
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index 5a13aec372..7245e836a1 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -101,7 +101,9 @@ class CFGAS_GEFont {
int32_t m_iRefCount;
bool m_bExternalFont;
std::unique_ptr<IFX_Stream, ReleaseDeleter<IFX_Stream>> m_pStream;
- std::unique_ptr<IFX_FileRead, ReleaseDeleter<IFX_FileRead>> m_pFileRead;
+ std::unique_ptr<IFX_SeekableReadStream,
+ ReleaseDeleter<IFX_SeekableReadStream>>
+ m_pFileRead;
std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding;
std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap;
std::unique_ptr<CFX_MassArrayTemplate<CFX_Rect>> m_pRectArray;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp
index 59bd272a93..646eb94696 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.cpp
+++ b/xfa/fgas/font/fgas_stdfontmgr.cpp
@@ -591,7 +591,7 @@ CFGAS_FontMgrImp::~CFGAS_FontMgrImp() {
pos = m_IFXFont2FileRead.GetStartPosition();
while (pos) {
CFGAS_GEFont* pFont;
- IFX_FileRead* pFileRead;
+ IFX_SeekableReadStream* pFileRead;
m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead);
pFileRead->Release();
}
@@ -609,7 +609,7 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFontMapper() {
pSystemFontInfo->EnumFontList(pFontMapper);
for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) {
- IFX_FileRead* pFontStream =
+ IFX_SeekableReadStream* pFontStream =
CreateFontStream(pFontMapper, pSystemFontInfo, i);
if (!pFontStream)
continue;
@@ -629,7 +629,7 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFiles() {
CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary();
FX_POSITION pos = m_pFontSource->GetStartPosition();
IFX_FileAccess* pFontSource = nullptr;
- IFX_FileRead* pFontStream = nullptr;
+ IFX_SeekableReadStream* pFontStream = nullptr;
while (pos) {
pFontSource = m_pFontSource->GetNext(pos);
pFontStream = pFontSource->CreateFileStream(FX_FILEMODE_ReadOnly);
@@ -783,7 +783,8 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode(
FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc,
FX_WCHAR wcUnicode) {
- IFX_FileRead* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode());
+ IFX_SeekableReadStream* pFileRead =
+ CreateFontStream(pDesc->m_wsFaceName.UTF8Encode());
if (!pFileRead)
return FALSE;
FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex);
@@ -835,7 +836,8 @@ CFGAS_GEFont* CFGAS_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName,
if (!pSystemFontInfo)
return nullptr;
- IFX_FileRead* pFontStream = CreateFontStream(wsFaceName.UTF8Encode());
+ IFX_SeekableReadStream* pFontStream =
+ CreateFontStream(wsFaceName.UTF8Encode());
if (!pFontStream)
return nullptr;
@@ -867,7 +869,8 @@ unsigned long _ftStreamRead(FXFT_Stream stream,
if (count == 0)
return 0;
- IFX_FileRead* pFile = (IFX_FileRead*)stream->descriptor.pointer;
+ IFX_SeekableReadStream* pFile =
+ (IFX_SeekableReadStream*)stream->descriptor.pointer;
int res = pFile->ReadBlock(buffer, offset, count);
if (res)
return count;
@@ -878,7 +881,7 @@ void _ftStreamClose(FXFT_Stream stream) {}
}; // extern "C"
-FXFT_Face CFGAS_FontMgrImp::LoadFace(IFX_FileRead* pFontStream,
+FXFT_Face CFGAS_FontMgrImp::LoadFace(IFX_SeekableReadStream* pFontStream,
int32_t iFaceIndex) {
if (!pFontStream)
return nullptr;
@@ -913,7 +916,7 @@ FXFT_Face CFGAS_FontMgrImp::LoadFace(IFX_FileRead* pFontStream,
return pFace;
}
-IFX_FileRead* CFGAS_FontMgrImp::CreateFontStream(
+IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream(
CFX_FontMapper* pFontMapper,
IFX_SystemFontInfo* pSystemFontInfo,
uint32_t index) {
@@ -934,7 +937,7 @@ IFX_FileRead* CFGAS_FontMgrImp::CreateFontStream(
return FX_CreateMemoryStream(pBuffer, dwFileSize, TRUE);
}
-IFX_FileRead* CFGAS_FontMgrImp::CreateFontStream(
+IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream(
const CFX_ByteString& bsFaceName) {
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper();
@@ -1111,7 +1114,7 @@ void CFGAS_FontMgrImp::ClearFontCache() {
pos = m_IFXFont2FileRead.GetStartPosition();
while (pos) {
CFGAS_GEFont* pFont;
- IFX_FileRead* pFileRead;
+ IFX_SeekableReadStream* pFileRead;
m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead);
pFileRead->Release();
}
@@ -1121,7 +1124,7 @@ void CFGAS_FontMgrImp::RemoveFont(CFGAS_GEFont* pEFont) {
if (!pEFont) {
return;
}
- IFX_FileRead* pFileRead;
+ IFX_SeekableReadStream* pFileRead;
if (m_IFXFont2FileRead.Lookup(pEFont, pFileRead)) {
pFileRead->Release();
m_IFXFont2FileRead.RemoveKey(pEFont);
@@ -1179,7 +1182,7 @@ void CFGAS_FontMgrImp::RegisterFace(FXFT_Face pFace,
m_InstalledFonts.Add(pFont.release());
}
-void CFGAS_FontMgrImp::RegisterFaces(IFX_FileRead* pFontStream,
+void CFGAS_FontMgrImp::RegisterFaces(IFX_SeekableReadStream* pFontStream,
const CFX_WideString* pFaceName) {
int32_t index = 0;
int32_t num_faces = 0;
diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h
index 785a47f854..fd7f9cd318 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.h
+++ b/xfa/fgas/font/fgas_stdfontmgr.h
@@ -185,7 +185,7 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr {
protected:
void RegisterFace(FXFT_Face pFace,
const CFX_WideString* pFaceName);
- void RegisterFaces(IFX_FileRead* pFontStream,
+ void RegisterFaces(IFX_SeekableReadStream* pFontStream,
const CFX_WideString* pFaceName);
void GetNames(const uint8_t* name_table, CFX_WideStringArray& Names);
std::vector<uint16_t> GetCharsets(FXFT_Face pFace) const;
@@ -204,16 +204,16 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr {
uint32_t dwFontStyles,
const CFX_WideString& FontName,
FX_WCHAR wcUnicode = 0xFFFE);
- FXFT_Face LoadFace(IFX_FileRead* pFontStream, int32_t iFaceIndex);
- IFX_FileRead* CreateFontStream(CFX_FontMapper* pFontMapper,
- IFX_SystemFontInfo* pSystemFontInfo,
- uint32_t index);
- IFX_FileRead* CreateFontStream(const CFX_ByteString& bsFaceName);
+ FXFT_Face LoadFace(IFX_SeekableReadStream* pFontStream, int32_t iFaceIndex);
+ IFX_SeekableReadStream* CreateFontStream(CFX_FontMapper* pFontMapper,
+ IFX_SystemFontInfo* pSystemFontInfo,
+ uint32_t index);
+ IFX_SeekableReadStream* CreateFontStream(const CFX_ByteString& bsFaceName);
CFX_FontDescriptors m_InstalledFonts;
CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList;
CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<CFGAS_GEFont*>*> m_Hash2Fonts;
- CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_FileRead*> m_IFXFont2FileRead;
+ CFX_MapPtrTemplate<CFGAS_GEFont*, IFX_SeekableReadStream*> m_IFXFont2FileRead;
CFX_MapPtrTemplate<FX_WCHAR, CFGAS_GEFont*> m_FailedUnicodes2Nullptr;
CFX_FontSourceEnum_File* const m_pFontSource;
};