Remove FXFT_Face typedef.
Use FXFT_FaceRec* instead. A subsequent CL will introduce CFX_Face
which is too easily confused with FXFT_Face. Additionally, typedefs
with |*| in the name are icky.
- Remove some needless casts.
Change-Id: I3b67faf3c050a3396e977da6c2b6b89409cdd6dd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55754
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 46e5405..d47e7ce 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -176,7 +176,7 @@
#endif // !defined(OS_WIN)
-void FT_UseCIDCharmap(FXFT_Face face, int coding) {
+void FT_UseCIDCharmap(FXFT_FaceRec* face, int coding) {
int encoding;
switch (coding) {
case CIDCODING_GB:
@@ -426,14 +426,14 @@
FX_RECT rect;
bool bVert = false;
int glyph_index = GlyphFromCharCode(charcode, &bVert);
- FXFT_Face face = m_Font.GetFace();
+ FXFT_FaceRec* face = m_Font.GetFace();
if (face) {
if (FXFT_Is_Face_Tricky(face)) {
int err = FXFT_Load_Glyph(face, glyph_index,
FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (!err) {
FXFT_Glyph glyph;
- err = FXFT_Get_Glyph(((FXFT_Face)face)->glyph, &glyph);
+ err = FXFT_Get_Glyph(face->glyph, &glyph);
if (!err) {
FXFT_BBox cbox;
FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
@@ -441,8 +441,8 @@
cbox.xMax = pdfium::clamp(cbox.xMax, kMinCBox, kMaxCBox);
cbox.yMin = pdfium::clamp(cbox.yMin, kMinCBox, kMaxCBox);
cbox.yMax = pdfium::clamp(cbox.yMax, kMinCBox, kMaxCBox);
- int pixel_size_x = ((FXFT_Face)face)->size->metrics.x_ppem;
- int pixel_size_y = ((FXFT_Face)face)->size->metrics.y_ppem;
+ int pixel_size_x = face->size->metrics.x_ppem;
+ int pixel_size_y = face->size->metrics.y_ppem;
if (pixel_size_x == 0 || pixel_size_y == 0) {
rect = FX_RECT(cbox.xMin, cbox.yMax, cbox.xMax, cbox.yMin);
} else {
@@ -554,7 +554,7 @@
if (pVertGlyph)
*pVertGlyph = false;
- FXFT_Face face = m_Font.GetFace();
+ FXFT_FaceRec* face = m_Font.GetFace();
int index = FXFT_Get_Char_Index(face, unicode);
if (unicode == 0x2502)
return index;
@@ -623,7 +623,7 @@
unicode = unicode_str[0];
}
}
- FXFT_Face face = m_Font.GetFace();
+ FXFT_FaceRec* face = m_Font.GetFace();
if (unicode == 0) {
if (!m_bAdobeCourierStd)
return charcode ? static_cast<int>(charcode) : -1;
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 3c476eb..9a23217 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -222,7 +222,7 @@
void CPDF_Font::CheckFontMetrics() {
if (m_FontBBox.top == 0 && m_FontBBox.bottom == 0 && m_FontBBox.left == 0 &&
m_FontBBox.right == 0) {
- FXFT_Face face = m_Font.GetFace();
+ FXFT_FaceRec* face = m_Font.GetFace();
if (face) {
m_FontBBox.left = TT2PDF(FXFT_Get_Face_xMin(face), face);
m_FontBBox.bottom = TT2PDF(FXFT_Get_Face_yMin(face), face);
@@ -403,7 +403,7 @@
}
// static
-int CPDF_Font::TT2PDF(int m, FXFT_Face face) {
+int CPDF_Font::TT2PDF(int m, FXFT_FaceRec* face) {
int upm = FXFT_Get_Face_UnitsPerEM(face);
if (upm == 0)
return m;
@@ -415,7 +415,7 @@
}
// static
-bool CPDF_Font::FT_UseTTCharmap(FXFT_Face face,
+bool CPDF_Font::FT_UseTTCharmap(FXFT_FaceRec* face,
int platform_id,
int encoding_id) {
auto** pCharMap = FXFT_Get_Face_Charmaps(face);
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 7159eb9..ab599d3 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -94,8 +94,10 @@
protected:
CPDF_Font(CPDF_Document* pDocument, CPDF_Dictionary* pFontDict);
- static int TT2PDF(int m, FXFT_Face face);
- static bool FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id);
+ static int TT2PDF(int m, FXFT_FaceRec* face);
+ static bool FT_UseTTCharmap(FXFT_FaceRec* face,
+ int platform_id,
+ int encoding_id);
static const char* GetAdobeCharName(int iBaseEncoding,
const std::vector<ByteString>& charnames,
uint32_t charcode);
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 7292d06..fbf303a 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -71,7 +71,7 @@
}
return;
}
- FXFT_Face face = m_Font.GetFace();
+ FXFT_FaceRec* face = m_Font.GetFace();
int err = FXFT_Load_Glyph(
face, glyph_index,
FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 0cb8d19..ed3a0cb 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -43,7 +43,7 @@
#endif // defined(OS_MACOSX)
-bool FT_UseType1Charmap(FXFT_Face face) {
+bool FT_UseType1Charmap(FXFT_FaceRec* face) {
if (FXFT_Get_Face_CharmapCount(face) == 0) {
return false;
}
diff --git a/core/fxge/android/cfpf_skiafont.h b/core/fxge/android/cfpf_skiafont.h
index 0bb70d4..a00a93e 100644
--- a/core/fxge/android/cfpf_skiafont.h
+++ b/core/fxge/android/cfpf_skiafont.h
@@ -43,7 +43,7 @@
private:
UnownedPtr<CFPF_SkiaFontMgr> const m_pFontMgr;
UnownedPtr<const CFPF_SkiaPathFont> const m_pFont;
- const FXFT_Face m_Face;
+ FXFT_FaceRec* const m_Face;
const uint32_t m_dwStyle;
const uint8_t m_uCharset;
};
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index ee4fdd9..7e09533 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -332,8 +332,8 @@
return pRet;
}
-FXFT_Face CFPF_SkiaFontMgr::GetFontFace(ByteStringView bsFile,
- int32_t iFaceIndex) {
+FXFT_FaceRec* CFPF_SkiaFontMgr::GetFontFace(ByteStringView bsFile,
+ int32_t iFaceIndex) {
if (bsFile.IsEmpty())
return nullptr;
if (iFaceIndex < 0)
@@ -341,7 +341,7 @@
FXFT_Open_Args args;
args.flags = FT_OPEN_PATHNAME;
args.pathname = const_cast<FT_String*>(bsFile.unterminated_c_str());
- FXFT_Face face;
+ FXFT_FaceRec* face;
if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face))
return nullptr;
FXFT_Set_Pixel_Sizes(face, 0, 64);
@@ -377,7 +377,7 @@
}
void CFPF_SkiaFontMgr::ScanFile(const ByteString& file) {
- FXFT_Face face = GetFontFace(file.AsStringView(), 0);
+ FXFT_FaceRec* face = GetFontFace(file.AsStringView(), 0);
if (!face)
return;
@@ -386,7 +386,7 @@
}
std::unique_ptr<CFPF_SkiaPathFont> CFPF_SkiaFontMgr::ReportFace(
- FXFT_Face face,
+ FXFT_FaceRec* face,
const ByteString& file) {
uint32_t dwStyle = 0;
if (FXFT_Is_Face_Bold(face))
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
index 3cd8165..0a8e370 100644
--- a/core/fxge/android/cfpf_skiafontmgr.h
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -28,12 +28,12 @@
uint32_t dwStyle);
bool InitFTLibrary();
- FXFT_Face GetFontFace(ByteStringView bsFile, int32_t iFaceIndex);
+ FXFT_FaceRec* GetFontFace(ByteStringView bsFile, int32_t iFaceIndex);
private:
void ScanPath(const ByteString& path);
void ScanFile(const ByteString& file);
- std::unique_ptr<CFPF_SkiaPathFont> ReportFace(FXFT_Face face,
+ std::unique_ptr<CFPF_SkiaPathFont> ReportFace(FXFT_FaceRec* face,
const ByteString& file);
bool m_bLoaded = false;
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index 3b427c2..c2df552 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -55,10 +55,10 @@
void FTStreamClose(FXFT_Stream stream) {}
-FXFT_Face LoadFileImp(FXFT_Library library,
- const RetainPtr<IFX_SeekableReadStream>& pFile,
- int32_t faceIndex,
- std::unique_ptr<FXFT_StreamRec>* stream) {
+FXFT_FaceRec* LoadFileImp(FXFT_Library library,
+ const RetainPtr<IFX_SeekableReadStream>& pFile,
+ int32_t faceIndex,
+ std::unique_ptr<FXFT_StreamRec>* stream) {
auto stream1 = pdfium::MakeUnique<FXFT_StreamRec>();
stream1->base = nullptr;
stream1->size = static_cast<unsigned long>(pFile->GetSize());
@@ -71,7 +71,7 @@
args.flags = FT_OPEN_STREAM;
args.stream = stream1.get();
- FXFT_Face face;
+ FXFT_FaceRec* face;
if (FXFT_Open_Face(library, &args, faceIndex, &face))
return nullptr;
@@ -321,7 +321,7 @@
}
#if !defined(OS_WIN)
-void CFX_Font::SetFace(FXFT_Face face) {
+void CFX_Font::SetFace(FXFT_FaceRec* face) {
ClearGlyphCache();
m_Face = face;
}
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h
index 69f53a4..39e68a7 100644
--- a/core/fxge/cfx_font.h
+++ b/core/fxge/cfx_font.h
@@ -49,14 +49,14 @@
bool bVertical);
bool LoadEmbedded(pdfium::span<const uint8_t> src_span);
- FXFT_Face GetFace() const { return m_Face.Get(); }
+ FXFT_FaceRec* GetFace() const { return m_Face.Get(); }
CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); }
#ifdef PDF_ENABLE_XFA
bool LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, int nFaceIndex);
#if !defined(OS_WIN)
- void SetFace(FXFT_Face face);
+ void SetFace(FXFT_FaceRec* face);
void SetSubstFont(std::unique_ptr<CFX_SubstFont> subst);
#endif // !defined(OS_WIN)
#endif // PDF_ENABLE_XFA
diff --git a/core/fxge/cfx_fontcache.cpp b/core/fxge/cfx_fontcache.cpp
index a99cabb..7610f47 100644
--- a/core/fxge/cfx_fontcache.cpp
+++ b/core/fxge/cfx_fontcache.cpp
@@ -20,7 +20,7 @@
CFX_FontCache::~CFX_FontCache() = default;
RetainPtr<CFX_GlyphCache> CFX_FontCache::GetGlyphCache(const CFX_Font* pFont) {
- FXFT_Face face = pFont->GetFace();
+ FXFT_FaceRec* face = pFont->GetFace();
const bool bExternal = !face;
auto& map = bExternal ? m_ExtGlyphCacheMap : m_GlyphCacheMap;
auto it = map.find(face);
diff --git a/core/fxge/cfx_fontcache.h b/core/fxge/cfx_fontcache.h
index 635da03..55a74c6 100644
--- a/core/fxge/cfx_fontcache.h
+++ b/core/fxge/cfx_fontcache.h
@@ -27,8 +27,8 @@
#endif
private:
- std::map<FXFT_Face, CFX_GlyphCache::ObservedPtr> m_GlyphCacheMap;
- std::map<FXFT_Face, CFX_GlyphCache::ObservedPtr> m_ExtGlyphCacheMap;
+ std::map<FXFT_FaceRec*, CFX_GlyphCache::ObservedPtr> m_GlyphCacheMap;
+ std::map<FXFT_FaceRec*, CFX_GlyphCache::ObservedPtr> m_ExtGlyphCacheMap;
};
#endif // CORE_FXGE_CFX_FONTCACHE_H_
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index b3a828e..65baeba 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -350,11 +350,11 @@
return ByteString();
}
-FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
- int iBaseFont,
- int italic_angle,
- int weight,
- int pitch_family) {
+FXFT_FaceRec* CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
+ int iBaseFont,
+ int italic_angle,
+ int weight,
+ int pitch_family) {
if (iBaseFont < kNumStandardFonts) {
if (m_FoxitFaces[iBaseFont])
return m_FoxitFaces[iBaseFont];
@@ -386,13 +386,13 @@
return m_MMFaces[0];
}
-FXFT_Face CFX_FontMapper::FindSubstFont(const ByteString& name,
- bool bTrueType,
- uint32_t flags,
- int weight,
- int italic_angle,
- int WindowCP,
- CFX_SubstFont* pSubstFont) {
+FXFT_FaceRec* CFX_FontMapper::FindSubstFont(const ByteString& name,
+ bool bTrueType,
+ uint32_t flags,
+ int weight,
+ int italic_angle,
+ int WindowCP,
+ CFX_SubstFont* pSubstFont) {
if (weight == 0)
weight = FXFONT_FW_NORMAL;
@@ -638,7 +638,7 @@
m_pFontInfo->DeleteFont(hFont);
return nullptr;
}
- FXFT_Face face = nullptr;
+ FXFT_FaceRec* face = nullptr;
if (ttc_size)
face = GetCachedTTCFace(hFont, kTableTTCF, ttc_size, font_size);
else
@@ -671,7 +671,7 @@
return pdfium::CollectionSize<int>(m_FaceArray);
}
-bool CFX_FontMapper::IsBuiltinFace(const FXFT_Face face) const {
+bool CFX_FontMapper::IsBuiltinFace(const FXFT_FaceRec* face) const {
for (size_t i = 0; i < MM_FACE_COUNT; ++i) {
if (m_MMFaces[i] == face)
return true;
@@ -683,10 +683,10 @@
return false;
}
-FXFT_Face CFX_FontMapper::GetCachedTTCFace(void* hFont,
- const uint32_t tableTTCF,
- uint32_t ttc_size,
- uint32_t font_size) {
+FXFT_FaceRec* CFX_FontMapper::GetCachedTTCFace(void* hFont,
+ const uint32_t tableTTCF,
+ uint32_t ttc_size,
+ uint32_t font_size) {
uint32_t checksum = 0;
{
uint8_t buffer[1024];
@@ -696,8 +696,8 @@
checksum += pBuffer[i];
}
uint8_t* pIgnore = nullptr;
- FXFT_Face face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum,
- ttc_size - font_size, &pIgnore);
+ FXFT_FaceRec* face = m_pFontMgr->GetCachedTTCFace(
+ ttc_size, checksum, ttc_size - font_size, &pIgnore);
if (face)
return face;
@@ -708,13 +708,13 @@
ttc_size, ttc_size - font_size);
}
-FXFT_Face CFX_FontMapper::GetCachedFace(void* hFont,
- ByteString SubstName,
- int weight,
- bool bItalic,
- uint32_t font_size) {
+FXFT_FaceRec* CFX_FontMapper::GetCachedFace(void* hFont,
+ ByteString SubstName,
+ int weight,
+ bool bItalic,
+ uint32_t font_size) {
uint8_t* pIgnore = nullptr;
- FXFT_Face face =
+ FXFT_FaceRec* face =
m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, &pIgnore);
if (face)
return face;
diff --git a/core/fxge/cfx_fontmapper.h b/core/fxge/cfx_fontmapper.h
index f318476..8096976 100644
--- a/core/fxge/cfx_fontmapper.h
+++ b/core/fxge/cfx_fontmapper.h
@@ -30,15 +30,15 @@
void AddInstalledFont(const ByteString& name, int charset);
void LoadInstalledFonts();
- FXFT_Face FindSubstFont(const ByteString& face_name,
- bool bTrueType,
- uint32_t flags,
- int weight,
- int italic_angle,
- int CharsetCP,
- CFX_SubstFont* pSubstFont);
+ FXFT_FaceRec* FindSubstFont(const ByteString& face_name,
+ bool bTrueType,
+ uint32_t flags,
+ int weight,
+ int italic_angle,
+ int CharsetCP,
+ CFX_SubstFont* pSubstFont);
- bool IsBuiltinFace(const FXFT_Face face) const;
+ bool IsBuiltinFace(const FXFT_FaceRec* face) const;
int GetFaceSize() const;
ByteString GetFaceName(int index) const { return m_FaceArray[index].name; }
@@ -51,20 +51,20 @@
ByteString GetPSNameFromTT(void* hFont);
ByteString MatchInstalledFonts(const ByteString& norm_name);
- FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont,
- int iBaseFont,
- int italic_angle,
- int weight,
- int picthfamily);
- FXFT_Face GetCachedTTCFace(void* hFont,
- const uint32_t tableTTCF,
- uint32_t ttc_size,
- uint32_t font_size);
- FXFT_Face GetCachedFace(void* hFont,
- ByteString SubstName,
- int weight,
- bool bItalic,
- uint32_t font_size);
+ FXFT_FaceRec* UseInternalSubst(CFX_SubstFont* pSubstFont,
+ int iBaseFont,
+ int italic_angle,
+ int weight,
+ int picthfamily);
+ FXFT_FaceRec* GetCachedTTCFace(void* hFont,
+ const uint32_t tableTTCF,
+ uint32_t ttc_size,
+ uint32_t font_size);
+ FXFT_FaceRec* GetCachedFace(void* hFont,
+ ByteString SubstName,
+ int weight,
+ bool bItalic,
+ uint32_t font_size);
struct FaceData {
ByteString name;
@@ -76,8 +76,8 @@
std::vector<FaceData> m_FaceArray;
std::unique_ptr<SystemFontInfoIface> m_pFontInfo;
UnownedPtr<CFX_FontMgr> const m_pFontMgr;
- FXFT_Face m_MMFaces[MM_FACE_COUNT];
- FXFT_Face m_FoxitFaces[FOXIT_FACE_COUNT];
+ FXFT_FaceRec* m_MMFaces[MM_FACE_COUNT];
+ FXFT_FaceRec* m_FoxitFaces[FOXIT_FACE_COUNT];
};
#endif // CORE_FXGE_CFX_FONTMAPPER_H_
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index ce52ce3..9e0494e 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -101,22 +101,22 @@
m_pBuiltinMapper->SetSystemFontInfo(std::move(pFontInfo));
}
-FXFT_Face CFX_FontMgr::FindSubstFont(const ByteString& face_name,
- bool bTrueType,
- uint32_t flags,
- int weight,
- int italic_angle,
- int CharsetCP,
- CFX_SubstFont* pSubstFont) {
+FXFT_FaceRec* CFX_FontMgr::FindSubstFont(const ByteString& face_name,
+ bool bTrueType,
+ uint32_t flags,
+ int weight,
+ int italic_angle,
+ int CharsetCP,
+ CFX_SubstFont* pSubstFont) {
InitFTLibrary();
return m_pBuiltinMapper->FindSubstFont(face_name, bTrueType, flags, weight,
italic_angle, CharsetCP, pSubstFont);
}
-FXFT_Face CFX_FontMgr::GetCachedFace(const ByteString& face_name,
- int weight,
- bool bItalic,
- uint8_t** pFontData) {
+FXFT_FaceRec* CFX_FontMgr::GetCachedFace(const ByteString& face_name,
+ int weight,
+ bool bItalic,
+ uint8_t** pFontData) {
auto it = m_FaceMap.find(KeyNameFromFace(face_name, weight, bItalic));
if (it == m_FaceMap.end())
return nullptr;
@@ -127,7 +127,7 @@
return pFontDesc->GetFace(0);
}
-FXFT_Face CFX_FontMgr::AddCachedFace(
+FXFT_FaceRec* CFX_FontMgr::AddCachedFace(
const ByteString& face_name,
int weight,
bool bItalic,
@@ -136,7 +136,7 @@
int face_index) {
InitFTLibrary();
- FXFT_Face face = nullptr;
+ FXFT_FaceRec* face = nullptr;
int ret =
FXFT_New_Memory_Face(m_FTLibrary, pData.get(), size, face_index, &face);
if (ret)
@@ -153,10 +153,10 @@
return pResult->GetFace(0);
}
-FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size,
- uint32_t checksum,
- int font_offset,
- uint8_t** pFontData) {
+FXFT_FaceRec* CFX_FontMgr::GetCachedTTCFace(int ttc_size,
+ uint32_t checksum,
+ int font_offset,
+ uint8_t** pFontData) {
auto it = m_FaceMap.find(KeyNameFromSize(ttc_size, checksum));
if (it == m_FaceMap.end())
return nullptr;
@@ -173,14 +173,14 @@
return pFontDesc->GetFace(face_index);
}
-FXFT_Face CFX_FontMgr::AddCachedTTCFace(
+FXFT_FaceRec* CFX_FontMgr::AddCachedTTCFace(
int ttc_size,
uint32_t checksum,
std::unique_ptr<uint8_t, FxFreeDeleter> pData,
uint32_t size,
int font_offset) {
int face_index = GetTTCIndex(pData.get(), ttc_size, font_offset);
- FXFT_Face face =
+ FXFT_FaceRec* face =
GetFixedFace({pData.get(), static_cast<size_t>(ttc_size)}, face_index);
auto pFontDesc = pdfium::MakeUnique<CTTFontDesc>(std::move(pData));
pFontDesc->SetFace(face_index, face);
@@ -188,10 +188,10 @@
return face;
}
-FXFT_Face CFX_FontMgr::GetFixedFace(pdfium::span<const uint8_t> span,
- int face_index) {
+FXFT_FaceRec* CFX_FontMgr::GetFixedFace(pdfium::span<const uint8_t> span,
+ int face_index) {
InitFTLibrary();
- FXFT_Face face = nullptr;
+ FXFT_FaceRec* face = nullptr;
if (FXFT_New_Memory_Face(m_FTLibrary, span.data(), span.size(), face_index,
&face)) {
return nullptr;
@@ -199,7 +199,7 @@
return FXFT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face;
}
-void CFX_FontMgr::ReleaseFace(FXFT_Face face) {
+void CFX_FontMgr::ReleaseFace(FXFT_FaceRec* face) {
if (!face)
return;
bool bNeedFaceDone = true;
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index 6e9ced8..aba9102 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -30,35 +30,35 @@
void InitFTLibrary();
- FXFT_Face GetCachedFace(const ByteString& face_name,
- int weight,
- bool bItalic,
- uint8_t** pFontData);
- FXFT_Face AddCachedFace(const ByteString& face_name,
- int weight,
- bool bItalic,
- std::unique_ptr<uint8_t, FxFreeDeleter> pData,
- uint32_t size,
- int face_index);
- FXFT_Face GetCachedTTCFace(int ttc_size,
- uint32_t checksum,
- int font_offset,
- uint8_t** pFontData);
- FXFT_Face AddCachedTTCFace(int ttc_size,
- uint32_t checksum,
- std::unique_ptr<uint8_t, FxFreeDeleter> pData,
- uint32_t size,
- int font_offset);
- FXFT_Face GetFixedFace(pdfium::span<const uint8_t> span, int face_index);
- void ReleaseFace(FXFT_Face face);
+ FXFT_FaceRec* GetCachedFace(const ByteString& face_name,
+ int weight,
+ bool bItalic,
+ uint8_t** pFontData);
+ FXFT_FaceRec* AddCachedFace(const ByteString& face_name,
+ int weight,
+ bool bItalic,
+ std::unique_ptr<uint8_t, FxFreeDeleter> pData,
+ uint32_t size,
+ int face_index);
+ FXFT_FaceRec* GetCachedTTCFace(int ttc_size,
+ uint32_t checksum,
+ int font_offset,
+ uint8_t** pFontData);
+ FXFT_FaceRec* AddCachedTTCFace(int ttc_size,
+ uint32_t checksum,
+ std::unique_ptr<uint8_t, FxFreeDeleter> pData,
+ uint32_t size,
+ int font_offset);
+ FXFT_FaceRec* GetFixedFace(pdfium::span<const uint8_t> span, int face_index);
+ void ReleaseFace(FXFT_FaceRec* face);
void SetSystemFontInfo(std::unique_ptr<SystemFontInfoIface> pFontInfo);
- FXFT_Face FindSubstFont(const ByteString& face_name,
- bool bTrueType,
- uint32_t flags,
- int weight,
- int italic_angle,
- int CharsetCP,
- CFX_SubstFont* pSubstFont);
+ FXFT_FaceRec* FindSubstFont(const ByteString& face_name,
+ bool bTrueType,
+ uint32_t flags,
+ int weight,
+ int italic_angle,
+ int CharsetCP,
+ CFX_SubstFont* pSubstFont);
// Always present.
CFX_FontMapper* GetBuiltinMapper() const { return m_pBuiltinMapper.get(); }
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index 0156e85..d526e3a 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -95,7 +95,7 @@
} // namespace
-CFX_GlyphCache::CFX_GlyphCache(FXFT_Face face) : m_Face(face) {}
+CFX_GlyphCache::CFX_GlyphCache(FXFT_FaceRec* face) : m_Face(face) {}
CFX_GlyphCache::~CFX_GlyphCache() = default;
diff --git a/core/fxge/cfx_glyphcache.h b/core/fxge/cfx_glyphcache.h
index 0fb7899..ede2fd0 100644
--- a/core/fxge/cfx_glyphcache.h
+++ b/core/fxge/cfx_glyphcache.h
@@ -49,7 +49,7 @@
#endif
private:
- explicit CFX_GlyphCache(FXFT_Face face);
+ explicit CFX_GlyphCache(FXFT_FaceRec* face);
using SizeGlyphCache = std::map<uint32_t, std::unique_ptr<CFX_GlyphBitmap>>;
// <glyph_index, width, weight, angle, vertical>
@@ -77,7 +77,7 @@
void InitPlatform();
void DestroyPlatform();
- FXFT_Face const m_Face;
+ FXFT_FaceRec* const m_Face;
std::map<ByteString, SizeGlyphCache> m_SizeMap;
std::map<PathMapKey, std::unique_ptr<CFX_PathData>> m_PathMap;
#if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_
diff --git a/core/fxge/cfx_unicodeencoding.cpp b/core/fxge/cfx_unicodeencoding.cpp
index ecf1e72b..d3df0a7 100644
--- a/core/fxge/cfx_unicodeencoding.cpp
+++ b/core/fxge/cfx_unicodeencoding.cpp
@@ -17,7 +17,7 @@
CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {}
uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) {
- FXFT_Face face = m_pFont->GetFace();
+ FXFT_FaceRec* face = m_pFont->GetFace();
if (!face)
return charcode;
diff --git a/core/fxge/cfx_unicodeencodingex.cpp b/core/fxge/cfx_unicodeencodingex.cpp
index 138f9d1..99cc2cc 100644
--- a/core/fxge/cfx_unicodeencodingex.cpp
+++ b/core/fxge/cfx_unicodeencodingex.cpp
@@ -42,7 +42,7 @@
CFX_UnicodeEncodingEx::~CFX_UnicodeEncodingEx() {}
uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) {
- FXFT_Face face = m_pFont->GetFace();
+ FXFT_FaceRec* face = m_pFont->GetFace();
FT_UInt nIndex = FXFT_Get_Char_Index(face, charcode);
if (nIndex > 0)
return nIndex;
@@ -71,7 +71,7 @@
m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) {
return Unicode;
}
- FXFT_Face face = m_pFont->GetFace();
+ FXFT_FaceRec* face = m_pFont->GetFace();
int nmaps = FXFT_Get_Face_CharmapCount(face);
for (int i = 0; i < nmaps; i++) {
int nEncodingID =
diff --git a/core/fxge/cttfontdesc.cpp b/core/fxge/cttfontdesc.cpp
index 3d0b27b..7a05023 100644
--- a/core/fxge/cttfontdesc.cpp
+++ b/core/fxge/cttfontdesc.cpp
@@ -25,7 +25,7 @@
}
}
-void CTTFontDesc::SetFace(size_t index, FXFT_Face face) {
+void CTTFontDesc::SetFace(size_t index, FXFT_FaceRec* face) {
ASSERT(index < FX_ArraySize(m_TTCFaces));
m_TTCFaces[index] = face;
}
@@ -35,7 +35,7 @@
++m_RefCount;
}
-CTTFontDesc::ReleaseStatus CTTFontDesc::ReleaseFace(FXFT_Face face) {
+CTTFontDesc::ReleaseStatus CTTFontDesc::ReleaseFace(FXFT_FaceRec* face) {
if (!pdfium::ContainsValue(m_TTCFaces, face))
return kNotAppropriate;
@@ -43,7 +43,7 @@
return --m_RefCount == 0 ? kReleased : kNotReleased;
}
-FXFT_Face CTTFontDesc::GetFace(size_t index) const {
+FXFT_FaceRec* CTTFontDesc::GetFace(size_t index) const {
ASSERT(index < FX_ArraySize(m_TTCFaces));
return m_TTCFaces[index];
}
diff --git a/core/fxge/cttfontdesc.h b/core/fxge/cttfontdesc.h
index 868e782..624b576 100644
--- a/core/fxge/cttfontdesc.h
+++ b/core/fxge/cttfontdesc.h
@@ -24,20 +24,20 @@
explicit CTTFontDesc(std::unique_ptr<uint8_t, FxFreeDeleter> pData);
~CTTFontDesc();
- void SetFace(size_t index, FXFT_Face face);
+ void SetFace(size_t index, FXFT_FaceRec* face);
void AddRef();
// May not decrement refcount, depending on the value of |face|.
- ReleaseStatus ReleaseFace(FXFT_Face face);
+ ReleaseStatus ReleaseFace(FXFT_FaceRec* face);
uint8_t* FontData() const { return m_pFontData.get(); }
- FXFT_Face GetFace(size_t index) const;
+ FXFT_FaceRec* GetFace(size_t index) const;
private:
int m_RefCount = 1;
std::unique_ptr<uint8_t, FxFreeDeleter> const m_pFontData;
- FXFT_Face m_TTCFaces[16];
+ FXFT_FaceRec* m_TTCFaces[16];
};
#endif // CORE_FXGE_CTTFONTDESC_H_
diff --git a/core/fxge/fx_freetype.h b/core/fxge/fx_freetype.h
index cac3364..49d7538 100644
--- a/core/fxge/fx_freetype.h
+++ b/core/fxge/fx_freetype.h
@@ -18,7 +18,6 @@
using FXFT_LibraryRec = struct FT_LibraryRec_;
using FXFT_Library = FXFT_LibraryRec*;
using FXFT_FaceRec = struct FT_FaceRec_;
-using FXFT_Face = FXFT_FaceRec*;
using FXFT_MM_Var = FT_MM_Var*;
using FXFT_Open_Args = FT_Open_Args;
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index b223765..c362974 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -31,7 +31,7 @@
namespace {
bool VerifyUnicode(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode) {
- FXFT_Face pFace = pFont->GetDevFont()->GetFace();
+ FXFT_FaceRec* pFace = pFont->GetDevFont()->GetFace();
FXFT_CharMap charmap = FXFT_Get_Face_Charmap(pFace);
if (FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE) != 0)
return false;
@@ -398,7 +398,7 @@
return results;
}
-void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB) {
+void GetUSBCSB(FXFT_FaceRec* pFace, uint32_t* USB, uint32_t* CSB) {
TT_OS2* pOS2 = static_cast<TT_OS2*>(FT_Get_Sfnt_Table(pFace, ft_sfnt_os2));
if (!pOS2) {
USB[0] = 0;
@@ -417,7 +417,7 @@
CSB[1] = pOS2->ulCodePageRange2;
}
-uint32_t GetFlags(FXFT_Face pFace) {
+uint32_t GetFlags(FXFT_FaceRec* pFace) {
uint32_t flags = 0;
if (FXFT_Is_Face_Bold(pFace))
flags |= FXFONT_BOLD;
@@ -476,8 +476,8 @@
return nullptr;
}
-FXFT_Face LoadFace(const RetainPtr<IFX_SeekableReadStream>& pFontStream,
- int32_t iFaceIndex) {
+FXFT_FaceRec* LoadFace(const RetainPtr<IFX_SeekableReadStream>& pFontStream,
+ int32_t iFaceIndex) {
if (!pFontStream)
return nullptr;
@@ -507,7 +507,7 @@
ftArgs.flags |= FT_OPEN_STREAM;
ftArgs.stream = ftStream;
- FXFT_Face pFace = nullptr;
+ FXFT_FaceRec* pFace = nullptr;
if (FXFT_Open_Face(library, &ftArgs, iFaceIndex, &pFace)) {
ft_sfree(ftStream);
return nullptr;
@@ -524,7 +524,7 @@
if (!pFileRead)
return false;
- FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex);
+ FXFT_FaceRec* pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex);
if (!pFace)
return false;
@@ -743,7 +743,8 @@
std::sort(pMatchedFonts->begin(), pMatchedFonts->end());
}
-void CFGAS_FontMgr::RegisterFace(FXFT_Face pFace, const WideString* pFaceName) {
+void CFGAS_FontMgr::RegisterFace(FXFT_FaceRec* pFace,
+ const WideString* pFaceName) {
if ((pFace->face_flags & FT_FACE_FLAG_SCALABLE) == 0)
return;
@@ -778,7 +779,7 @@
int32_t index = 0;
int32_t num_faces = 0;
do {
- FXFT_Face pFace = LoadFace(pFontStream, index++);
+ FXFT_FaceRec* pFace = LoadFace(pFontStream, index++);
if (!pFace)
continue;
// All faces keep number of faces. It can be retrieved from any one face.
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index 5461cf2..5a92ba3 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -133,7 +133,7 @@
#else // defined(OS_WIN)
bool EnumFontsFromFontMapper();
bool EnumFontsFromFiles();
- void RegisterFace(FXFT_Face pFace, const WideString* pFaceName);
+ void RegisterFace(FXFT_FaceRec* pFace, const WideString* pFaceName);
void RegisterFaces(const RetainPtr<IFX_SeekableReadStream>& pFontStream,
const WideString* pFaceName);
void MatchFonts(std::vector<CFX_FontDescriptorInfo>* MatchedFonts,