Remove fx_freetype definitions that are no-ops.
Keep the ones that actually manipulate their arguments.
Change-Id: I260ac32dc71d5820740db8ee0ed68cd076c00c3d
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55790
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 d47e7ce..3e3edb7 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -180,25 +180,25 @@
int encoding;
switch (coding) {
case CIDCODING_GB:
- encoding = FXFT_ENCODING_GB2312;
+ encoding = FT_ENCODING_GB2312;
break;
case CIDCODING_BIG5:
- encoding = FXFT_ENCODING_BIG5;
+ encoding = FT_ENCODING_BIG5;
break;
case CIDCODING_JIS:
- encoding = FXFT_ENCODING_SJIS;
+ encoding = FT_ENCODING_SJIS;
break;
case CIDCODING_KOREA:
- encoding = FXFT_ENCODING_JOHAB;
+ encoding = FT_ENCODING_JOHAB;
break;
default:
- encoding = FXFT_ENCODING_UNICODE;
+ encoding = FT_ENCODING_UNICODE;
}
int err = FXFT_Select_Charmap(face, encoding);
if (err)
- err = FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE);
+ err = FXFT_Select_Charmap(face, FT_ENCODING_UNICODE);
if (err && FXFT_Get_Face_Charmaps(face))
- FXFT_Set_Charmap(face, *FXFT_Get_Face_Charmaps(face));
+ FT_Set_Charmap(face, *FXFT_Get_Face_Charmaps(face));
}
bool IsMetricForCID(const uint32_t* pEntry, uint16_t CID) {
@@ -384,7 +384,7 @@
}
if (m_Font.GetFace()) {
if (m_bType1)
- FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE);
+ FXFT_Select_Charmap(m_Font.GetFace(), FT_ENCODING_UNICODE);
else
FT_UseCIDCharmap(m_Font.GetFace(), m_pCMap->GetCoding());
}
@@ -429,14 +429,14 @@
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);
+ int err =
+ FT_Load_Glyph(face, glyph_index, FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (!err) {
- FXFT_Glyph glyph;
- err = FXFT_Get_Glyph(face->glyph, &glyph);
+ FT_Glyph glyph;
+ err = FT_Get_Glyph(face->glyph, &glyph);
if (!err) {
- FXFT_BBox cbox;
- FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
+ FT_BBox cbox;
+ FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_PIXELS, &cbox);
cbox.xMin = pdfium::clamp(cbox.xMin, kMinCBox, kMaxCBox);
cbox.xMax = pdfium::clamp(cbox.xMax, kMinCBox, kMaxCBox);
cbox.yMin = pdfium::clamp(cbox.yMin, kMinCBox, kMaxCBox);
@@ -455,11 +455,11 @@
static_cast<int>(FXFT_Get_Face_Ascender(face)));
rect.bottom = std::max(
rect.bottom, static_cast<int>(FXFT_Get_Face_Descender(face)));
- FXFT_Done_Glyph(glyph);
+ FT_Done_Glyph(glyph);
}
}
} else {
- int err = FXFT_Load_Glyph(face, glyph_index, FXFT_LOAD_NO_SCALE);
+ int err = FT_Load_Glyph(face, glyph_index, FT_LOAD_NO_SCALE);
if (err == 0) {
rect = FX_RECT(TT2PDF(FXFT_Get_Glyph_HoriBearingX(face), face),
TT2PDF(FXFT_Get_Glyph_HoriBearingY(face), face),
@@ -555,7 +555,7 @@
*pVertGlyph = false;
FXFT_FaceRec* face = m_Font.GetFace();
- int index = FXFT_Get_Char_Index(face, unicode);
+ int index = FT_Get_Char_Index(face, unicode);
if (unicode == 0x2502)
return index;
@@ -567,13 +567,13 @@
if (!m_Font.GetSubData()) {
unsigned long length = 0;
- int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
- nullptr, &length);
+ int error = FT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
+ nullptr, &length);
if (!error)
m_Font.SetSubData(FX_Alloc(uint8_t, length));
}
- int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
- m_Font.GetSubData(), nullptr);
+ int error = FT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
+ m_Font.GetSubData(), nullptr);
if (error || !m_Font.GetSubData())
return index;
@@ -647,15 +647,15 @@
return charcode ? static_cast<int>(charcode) : -1;
if (iBaseEncoding == PDFFONT_ENCODING_STANDARD)
- return FXFT_Get_Char_Index(face, name_unicode);
+ return FT_Get_Char_Index(face, name_unicode);
if (iBaseEncoding == PDFFONT_ENCODING_WINANSI) {
- index = FXFT_Get_Char_Index(face, name_unicode);
+ index = FT_Get_Char_Index(face, name_unicode);
} else {
ASSERT(iBaseEncoding == PDFFONT_ENCODING_MACROMAN);
uint32_t maccode =
- FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN, name_unicode);
- index = maccode ? FXFT_Get_Char_Index(face, maccode)
+ FT_CharCodeFromUnicode(FT_ENCODING_APPLE_ROMAN, name_unicode);
+ index = maccode ? FT_Get_Char_Index(face, maccode)
: FXFT_Get_Name_Index(face, name);
}
if (index == 0 || index == 0xffff)
@@ -674,7 +674,7 @@
if (!face)
return unicode;
- int err = FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE);
+ int err = FXFT_Select_Charmap(face, FT_ENCODING_UNICODE);
if (err) {
int i;
for (i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) {
@@ -683,12 +683,12 @@
static_cast<wchar_t>(charcode));
if (ret == 0)
continue;
- FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]);
+ FT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[i]);
unicode = static_cast<wchar_t>(ret);
break;
}
if (i == FXFT_Get_Face_CharmapCount(face) && i) {
- FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
+ FT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
unicode = static_cast<wchar_t>(charcode);
}
}
@@ -713,7 +713,7 @@
return cid;
}
if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmap(m_Font.GetFace())) ==
- FXFT_ENCODING_UNICODE) {
+ FT_ENCODING_UNICODE) {
WideString unicode_str = UnicodeFromCharCode(charcode);
if (unicode_str.IsEmpty())
return -1;
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 9a23217..7c1b15a 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -389,7 +389,7 @@
WideString str = UnicodeFromCharCode(charcode);
uint32_t unicode = !str.IsEmpty() ? str[0] : charcode;
int glyph =
- FXFT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), unicode);
+ FT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), unicode);
if (glyph == 0)
return -1;
@@ -422,7 +422,7 @@
for (int i = 0; i < FXFT_Get_Face_CharmapCount(face); i++) {
if (FXFT_Get_Charmap_PlatformID(pCharMap[i]) == platform_id &&
FXFT_Get_Charmap_EncodingID(pCharMap[i]) == encoding_id) {
- FXFT_Set_Charmap(face, pCharMap[i]);
+ FT_Set_Charmap(face, pCharMap[i]);
return true;
}
}
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index df34012..f1f7d06 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -1731,19 +1731,19 @@
uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode) {
switch (encoding) {
- case FXFT_ENCODING_UNICODE:
+ case FT_ENCODING_UNICODE:
return unicode;
- case FXFT_ENCODING_ADOBE_STANDARD:
+ case FT_ENCODING_ADOBE_STANDARD:
return PDF_FindCode(StandardEncoding, unicode);
- case FXFT_ENCODING_ADOBE_EXPERT:
+ case FT_ENCODING_ADOBE_EXPERT:
return PDF_FindCode(MacExpertEncoding, unicode);
- case FXFT_ENCODING_ADOBE_LATIN_1:
+ case FT_ENCODING_ADOBE_LATIN_1:
return PDF_FindCode(AdobeWinAnsiEncoding, unicode);
- case FXFT_ENCODING_APPLE_ROMAN:
+ case FT_ENCODING_APPLE_ROMAN:
return PDF_FindCode(MacRomanEncoding, unicode);
- case FXFT_ENCODING_ADOBE_CUSTOM:
+ case FT_ENCODING_ADOBE_CUSTOM:
return PDF_FindCode(PDFDocEncoding, unicode);
- case FXFT_ENCODING_MS_SYMBOL:
+ case FT_ENCODING_MS_SYMBOL:
return PDF_FindCode(MSSymbolEncoding, unicode);
}
return 0;
@@ -1803,15 +1803,15 @@
wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode) {
switch (encoding) {
- case FXFT_ENCODING_UNICODE:
+ case FT_ENCODING_UNICODE:
return (uint16_t)charcode;
- case FXFT_ENCODING_ADOBE_STANDARD:
+ case FT_ENCODING_ADOBE_STANDARD:
return StandardEncoding[(uint8_t)charcode];
- case FXFT_ENCODING_ADOBE_EXPERT:
+ case FT_ENCODING_ADOBE_EXPERT:
return MacExpertEncoding[(uint8_t)charcode];
- case FXFT_ENCODING_ADOBE_LATIN_1:
+ case FT_ENCODING_ADOBE_LATIN_1:
return AdobeWinAnsiEncoding[(uint8_t)charcode];
- case FXFT_ENCODING_APPLE_ROMAN:
+ case FT_ENCODING_APPLE_ROMAN:
return MacRomanEncoding[(uint8_t)charcode];
case PDFFONT_ENCODING_PDFDOC:
return PDFDocEncoding[(uint8_t)charcode];
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index fbf303a..bf8a25e 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -72,9 +72,9 @@
return;
}
FXFT_FaceRec* face = m_Font.GetFace();
- int err = FXFT_Load_Glyph(
- face, glyph_index,
- FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
+ int err =
+ FT_Load_Glyph(face, glyph_index,
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (err)
return;
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index ec3e05b..a499917 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -100,32 +100,31 @@
const char* name = GetAdobeCharName(baseEncoding, m_CharNames, charcode);
if (!name) {
m_GlyphIndex[charcode] =
- m_pFontFile ? FXFT_Get_Char_Index(m_Font.GetFace(), charcode) : -1;
+ m_pFontFile ? FT_Get_Char_Index(m_Font.GetFace(), charcode) : -1;
continue;
}
m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
if (bMSSymbol) {
for (size_t j = 0; j < FX_ArraySize(kPrefix); j++) {
uint16_t unicode = kPrefix[j] * 256 + charcode;
- m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFace(), unicode);
if (m_GlyphIndex[charcode])
break;
}
} else if (m_Encoding.UnicodeFromCharCode(charcode)) {
if (bMSUnicode) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(
m_Font.GetFace(), m_Encoding.UnicodeFromCharCode(charcode));
} else if (bMacRoman) {
uint32_t maccode =
- FT_CharCodeFromUnicode(FXFT_ENCODING_APPLE_ROMAN,
+ FT_CharCodeFromUnicode(FT_ENCODING_APPLE_ROMAN,
m_Encoding.UnicodeFromCharCode(charcode));
if (!maccode) {
m_GlyphIndex[charcode] =
FXFT_Get_Name_Index(m_Font.GetFace(), name);
} else {
m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.GetFace(), maccode);
+ FT_Get_Char_Index(m_Font.GetFace(), maccode);
}
}
}
@@ -134,7 +133,7 @@
continue;
}
if (strcmp(name, ".notdef") == 0) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 32);
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFace(), 32);
continue;
}
m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.GetFace(), name);
@@ -144,7 +143,7 @@
WideString wsUnicode = UnicodeFromCharCode(charcode);
if (!wsUnicode.IsEmpty()) {
m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.GetFace(), wsUnicode[0]);
+ FT_Get_Char_Index(m_Font.GetFace(), wsUnicode[0]);
m_Encoding.SetUnicode(charcode, wsUnicode[0]);
}
}
@@ -155,7 +154,7 @@
for (int charcode = 0; charcode < 256; charcode++) {
for (size_t j = 0; j < FX_ArraySize(kPrefix); j++) {
uint16_t unicode = kPrefix[j] * 256 + charcode;
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFace(), unicode);
if (m_GlyphIndex[charcode]) {
bFound = true;
break;
@@ -174,7 +173,7 @@
for (int charcode = 0; charcode < 256; charcode++) {
m_Encoding.SetUnicode(
charcode,
- FT_UnicodeFromCharCode(FXFT_ENCODING_APPLE_ROMAN, charcode));
+ FT_UnicodeFromCharCode(FT_ENCODING_APPLE_ROMAN, charcode));
}
}
return;
@@ -183,9 +182,9 @@
if (FT_UseTTCharmap(m_Font.GetFace(), 1, 0)) {
bool bFound = false;
for (int charcode = 0; charcode < 256; charcode++) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
- m_Encoding.SetUnicode(charcode, FT_UnicodeFromCharCode(
- FXFT_ENCODING_APPLE_ROMAN, charcode));
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFace(), charcode);
+ m_Encoding.SetUnicode(
+ charcode, FT_UnicodeFromCharCode(FT_ENCODING_APPLE_ROMAN, charcode));
if (m_GlyphIndex[charcode]) {
bFound = true;
}
@@ -193,7 +192,7 @@
if (m_pFontFile || bFound)
return;
}
- if (FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE) == 0) {
+ if (FXFT_Select_Charmap(m_Font.GetFace(), FT_ENCODING_UNICODE) == 0) {
bool bFound = false;
const uint16_t* pUnicodes = PDF_UnicodesForPredefinedCharSet(baseEncoding);
for (uint32_t charcode = 0; charcode < 256; charcode++) {
@@ -206,7 +205,7 @@
else if (pUnicodes)
m_Encoding.SetUnicode(charcode, pUnicodes[charcode]);
}
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(
m_Font.GetFace(), m_Encoding.UnicodeFromCharCode(charcode));
if (m_GlyphIndex[charcode])
bFound = true;
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index ed3a0cb..a519fba 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -49,14 +49,14 @@
}
if (FXFT_Get_Face_CharmapCount(face) == 1 &&
FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) ==
- FXFT_ENCODING_UNICODE) {
+ FT_ENCODING_UNICODE) {
return false;
}
if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[0]) ==
- FXFT_ENCODING_UNICODE) {
- FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[1]);
+ FT_ENCODING_UNICODE) {
+ FT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[1]);
} else {
- FXFT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
+ FT_Set_Charmap(face, FXFT_Get_Face_Charmaps(face)[0]);
}
return true;
}
@@ -145,8 +145,7 @@
const uint8_t prefix[4] = {0x00, 0xf0, 0xf1, 0xf2};
for (int j = 0; j < 4; j++) {
uint16_t unicode = prefix[j] * 256 + charcode;
- m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.GetFace(), unicode);
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFace(), unicode);
#if defined(OS_MACOSX)
CalcExtGID(charcode);
#endif
@@ -164,7 +163,7 @@
return;
}
}
- FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE);
+ FXFT_Select_Charmap(m_Font.GetFace(), FT_ENCODING_UNICODE);
if (m_BaseEncoding == 0)
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
@@ -175,14 +174,14 @@
continue;
m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(
m_Font.GetFace(), m_Encoding.UnicodeFromCharCode(charcode));
#if defined(OS_MACOSX)
CalcExtGID(charcode);
#endif
if (m_GlyphIndex[charcode] == 0 && strcmp(name, ".notdef") == 0) {
m_Encoding.SetUnicode(charcode, 0x20);
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(m_Font.GetFace(), 0x20);
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFace(), 0x20);
#if defined(OS_MACOSX)
CalcExtGID(charcode);
#endif
@@ -207,7 +206,7 @@
SetExtGID(name, charcode);
} else {
m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
+ FT_Get_Char_Index(m_Font.GetFace(), charcode);
wchar_t unicode = 0;
if (m_GlyphIndex[charcode]) {
unicode =
@@ -215,8 +214,8 @@
}
char name_glyph[256];
memset(name_glyph, 0, sizeof(name_glyph));
- FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
- name_glyph, 256);
+ FT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
+ name_glyph, 256);
name_glyph[255] = 0;
if (unicode == 0 && name_glyph[0] != 0)
unicode = PDF_UnicodeFromAdobeName(name_glyph);
@@ -229,7 +228,7 @@
}
bool bUnicode =
- FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE) == 0;
+ FXFT_Select_Charmap(m_Font.GetFace(), FT_ENCODING_UNICODE) == 0;
for (uint32_t charcode = 0; charcode < 256; charcode++) {
const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
@@ -247,14 +246,14 @@
continue;
if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(
m_Font.GetFace(),
bUnicode ? m_Encoding.UnicodeFromCharCode(charcode) : charcode);
CalcExtGID(charcode);
} else {
m_Encoding.SetUnicode(charcode, 0x20);
m_GlyphIndex[charcode] =
- bUnicode ? FXFT_Get_Char_Index(m_Font.GetFace(), 0x20) : 0xffff;
+ bUnicode ? FT_Get_Char_Index(m_Font.GetFace(), 0x20) : 0xffff;
CalcExtGID(charcode);
}
}
@@ -269,16 +268,15 @@
m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
m_GlyphIndex[charcode] = FXFT_Get_Name_Index(m_Font.GetFace(), name);
} else {
- m_GlyphIndex[charcode] =
- FXFT_Get_Char_Index(m_Font.GetFace(), charcode);
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(m_Font.GetFace(), charcode);
if (m_GlyphIndex[charcode]) {
wchar_t unicode =
FT_UnicodeFromCharCode(PDFFONT_ENCODING_STANDARD, charcode);
if (unicode == 0) {
char name_glyph[256];
memset(name_glyph, 0, sizeof(name_glyph));
- FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
- name_glyph, 256);
+ FT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode],
+ name_glyph, 256);
name_glyph[255] = 0;
if (name_glyph[0] != 0)
unicode = PDF_UnicodeFromAdobeName(name_glyph);
@@ -296,7 +294,7 @@
}
bool bUnicode =
- FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE) == 0;
+ FXFT_Select_Charmap(m_Font.GetFace(), FT_ENCODING_UNICODE) == 0;
for (int charcode = 0; charcode < 256; charcode++) {
const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
if (!name)
@@ -308,7 +306,7 @@
continue;
if (strcmp(name, ".notdef") != 0 && strcmp(name, "space") != 0) {
- m_GlyphIndex[charcode] = FXFT_Get_Char_Index(
+ m_GlyphIndex[charcode] = FT_Get_Char_Index(
m_Font.GetFace(),
bUnicode ? m_Encoding.UnicodeFromCharCode(charcode) : charcode);
} else {
@@ -334,8 +332,7 @@
void CPDF_Type1Font::CalcExtGID(uint32_t charcode) {
char name_glyph[256];
- FXFT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph,
- 256);
+ FT_Get_Glyph_Name(m_Font.GetFace(), m_GlyphIndex[charcode], name_glyph, 256);
name_glyph[255] = 0;
SetExtGID(name_glyph, charcode);
}
diff --git a/core/fxge/android/cfpf_skiafont.cpp b/core/fxge/android/cfpf_skiafont.cpp
index faed7ca..926cf3e 100644
--- a/core/fxge/android/cfpf_skiafont.cpp
+++ b/core/fxge/android/cfpf_skiafont.cpp
@@ -28,7 +28,7 @@
CFPF_SkiaFont::~CFPF_SkiaFont() {
if (m_Face)
- FXFT_Done_Face(m_Face);
+ FT_Done_Face(m_Face);
}
ByteString CFPF_SkiaFont::GetFamilyName() {
@@ -40,23 +40,22 @@
ByteString CFPF_SkiaFont::GetPsName() {
if (!m_Face)
return ByteString();
- return FXFT_Get_Postscript_Name(m_Face);
+ return FT_Get_Postscript_Name(m_Face);
}
int32_t CFPF_SkiaFont::GetGlyphIndex(wchar_t wUnicode) {
if (!m_Face)
return wUnicode;
- if (FXFT_Select_Charmap(m_Face, FXFT_ENCODING_UNICODE))
+ if (FXFT_Select_Charmap(m_Face, FT_ENCODING_UNICODE))
return 0;
- return FXFT_Get_Char_Index(m_Face, wUnicode);
+ return FT_Get_Char_Index(m_Face, wUnicode);
}
int32_t CFPF_SkiaFont::GetGlyphWidth(int32_t iGlyphIndex) {
if (!m_Face)
return 0;
- if (FXFT_Load_Glyph(
- m_Face, iGlyphIndex,
- FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
+ if (FT_Load_Glyph(m_Face, iGlyphIndex,
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
return 0;
}
return FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
@@ -81,20 +80,20 @@
if (!m_Face)
return false;
if (FXFT_Is_Face_Tricky(m_Face)) {
- if (FXFT_Set_Char_Size(m_Face, 0, 1000 * 64, 72, 72))
+ if (FT_Set_Char_Size(m_Face, 0, 1000 * 64, 72, 72))
return false;
- if (FXFT_Load_Glyph(m_Face, iGlyphIndex,
- FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
- FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
+ if (FT_Load_Glyph(m_Face, iGlyphIndex,
+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
+ FT_Set_Pixel_Sizes(m_Face, 0, 64);
return false;
}
- FXFT_Glyph glyph;
- if (FXFT_Get_Glyph(m_Face->glyph, &glyph)) {
- FXFT_Set_Pixel_Sizes(m_Face, 0, 64);
+ FT_Glyph glyph;
+ if (FT_Get_Glyph(m_Face->glyph, &glyph)) {
+ FT_Set_Pixel_Sizes(m_Face, 0, 64);
return false;
}
- FXFT_BBox cbox;
- FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
+ FT_BBox cbox;
+ FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_PIXELS, &cbox);
int32_t x_ppem = m_Face->size->metrics.x_ppem;
int32_t y_ppem = m_Face->size->metrics.y_ppem;
rtBBox.left = FPF_EM_ADJUST(x_ppem, cbox.xMin);
@@ -103,12 +102,11 @@
rtBBox.bottom = FPF_EM_ADJUST(y_ppem, cbox.yMin);
rtBBox.top = std::min(rtBBox.top, GetAscent());
rtBBox.bottom = std::max(rtBBox.bottom, GetDescent());
- FXFT_Done_Glyph(glyph);
- return FXFT_Set_Pixel_Sizes(m_Face, 0, 64) == 0;
+ FT_Done_Glyph(glyph);
+ return FT_Set_Pixel_Sizes(m_Face, 0, 64) == 0;
}
- if (FXFT_Load_Glyph(
- m_Face, iGlyphIndex,
- FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
+ if (FT_Load_Glyph(m_Face, iGlyphIndex,
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
return false;
}
rtBBox.left = FPF_EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
@@ -162,7 +160,7 @@
return 0;
FT_ULong ulSize = pdfium::base::checked_cast<FT_ULong>(dwSize);
- if (FXFT_Load_Sfnt_Table(m_Face, dwTable, 0, pBuffer, &ulSize))
+ if (FT_Load_Sfnt_Table(m_Face, dwTable, 0, pBuffer, &ulSize))
return 0;
return pdfium::base::checked_cast<uint32_t>(ulSize);
}
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 7e09533..597e9f0 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -233,12 +233,12 @@
m_FamilyFonts.clear();
m_FontFaces.clear();
if (m_FTLibrary)
- FXFT_Done_FreeType(m_FTLibrary);
+ FT_Done_FreeType(m_FTLibrary);
}
bool CFPF_SkiaFontMgr::InitFTLibrary() {
if (!m_FTLibrary)
- FXFT_Init_FreeType(&m_FTLibrary);
+ FT_Init_FreeType(&m_FTLibrary);
return !!m_FTLibrary;
}
@@ -338,13 +338,13 @@
return nullptr;
if (iFaceIndex < 0)
return nullptr;
- FXFT_Open_Args args;
+ FT_Open_Args args;
args.flags = FT_OPEN_PATHNAME;
args.pathname = const_cast<FT_String*>(bsFile.unterminated_c_str());
FXFT_FaceRec* face;
- if (FXFT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face))
+ if (FT_Open_Face(m_FTLibrary, &args, iFaceIndex, &face))
return nullptr;
- FXFT_Set_Pixel_Sizes(face, 0, 64);
+ FT_Set_Pixel_Sizes(face, 0, 64);
return face;
}
@@ -382,7 +382,7 @@
return;
m_FontFaces.push_back(ReportFace(face, file));
- FXFT_Done_Face(face);
+ FT_Done_Face(face);
}
std::unique_ptr<CFPF_SkiaPathFont> CFPF_SkiaFontMgr::ReportFace(
diff --git a/core/fxge/android/cfpf_skiafontmgr.h b/core/fxge/android/cfpf_skiafontmgr.h
index 0a8e370..49d1516 100644
--- a/core/fxge/android/cfpf_skiafontmgr.h
+++ b/core/fxge/android/cfpf_skiafontmgr.h
@@ -37,7 +37,7 @@
const ByteString& file);
bool m_bLoaded = false;
- FXFT_Library m_FTLibrary = nullptr;
+ FXFT_LibraryRec* m_FTLibrary = nullptr;
std::vector<std::unique_ptr<CFPF_SkiaPathFont>> m_FontFaces;
std::map<uint32_t, std::unique_ptr<CFPF_SkiaFont>> m_FamilyFonts;
};
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index c2df552..aea8f16 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -41,7 +41,7 @@
#ifdef PDF_ENABLE_XFA
-unsigned long FTStreamRead(FXFT_Stream stream,
+unsigned long FTStreamRead(FXFT_StreamRec* stream,
unsigned long offset,
unsigned char* buffer,
unsigned long count) {
@@ -53,9 +53,9 @@
return pFile && pFile->ReadBlockAtOffset(buffer, offset, count) ? count : 0;
}
-void FTStreamClose(FXFT_Stream stream) {}
+void FTStreamClose(FXFT_StreamRec* stream) {}
-FXFT_FaceRec* LoadFileImp(FXFT_Library library,
+FXFT_FaceRec* LoadFileImp(FXFT_LibraryRec* library,
const RetainPtr<IFX_SeekableReadStream>& pFile,
int32_t faceIndex,
std::unique_ptr<FXFT_StreamRec>* stream) {
@@ -67,12 +67,12 @@
stream1->close = FTStreamClose;
stream1->read = FTStreamRead;
- FXFT_Open_Args args;
+ FT_Open_Args args;
args.flags = FT_OPEN_STREAM;
args.stream = stream1.get();
FXFT_FaceRec* face;
- if (FXFT_Open_Face(library, &args, faceIndex, &face))
+ if (FT_Open_Face(library, &args, faceIndex, &face))
return nullptr;
if (stream)
@@ -100,7 +100,7 @@
points.resize(size);
}
-int Outline_MoveTo(const FXFT_Vector* to, void* user) {
+int Outline_MoveTo(const FT_Vector* to, void* user) {
OUTLINE_PARAMS* param = static_cast<OUTLINE_PARAMS*>(user);
Outline_CheckEmptyContour(param);
@@ -115,7 +115,7 @@
return 0;
}
-int Outline_LineTo(const FXFT_Vector* to, void* user) {
+int Outline_LineTo(const FT_Vector* to, void* user) {
OUTLINE_PARAMS* param = static_cast<OUTLINE_PARAMS*>(user);
param->m_pPath->AppendPoint(
@@ -127,9 +127,7 @@
return 0;
}
-int Outline_ConicTo(const FXFT_Vector* control,
- const FXFT_Vector* to,
- void* user) {
+int Outline_ConicTo(const FT_Vector* control, const FT_Vector* to, void* user) {
OUTLINE_PARAMS* param = static_cast<OUTLINE_PARAMS*>(user);
param->m_pPath->AppendPoint(
@@ -153,9 +151,9 @@
return 0;
}
-int Outline_CubicTo(const FXFT_Vector* control1,
- const FXFT_Vector* control2,
- const FXFT_Vector* to,
+int Outline_CubicTo(const FT_Vector* control1,
+ const FT_Vector* control2,
+ const FT_Vector* to,
void* user) {
OUTLINE_PARAMS* param = static_cast<OUTLINE_PARAMS*>(user);
@@ -316,7 +314,7 @@
return false;
m_pOwnedStream = std::move(stream);
- FXFT_Set_Pixel_Sizes(m_Face.Get(), 0, 64);
+ FT_Set_Pixel_Sizes(m_Face.Get(), 0, 64);
return true;
}
@@ -345,7 +343,7 @@
void CFX_Font::DeleteFace() {
ClearGlyphCache();
if (m_bEmbedded)
- FXFT_Done_Face(m_Face.Release());
+ FT_Done_Face(m_Face.Release());
else
CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face.Release());
}
@@ -374,9 +372,9 @@
return 0;
if (m_pSubstFont && m_pSubstFont->m_bFlagMM)
AdjustMMParams(glyph_index, 0, 0);
- int err = FXFT_Load_Glyph(
- m_Face.Get(), glyph_index,
- FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
+ int err =
+ FT_Load_Glyph(m_Face.Get(), glyph_index,
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (err)
return 0;
@@ -398,7 +396,7 @@
}
bool CFX_Font::IsTTFont() const {
- return m_Face && FXFT_Is_Face_TT_OT(m_Face.Get()) == FXFT_FACE_FLAG_SFNT;
+ return m_Face && FXFT_Is_Face_TT_OT(m_Face.Get()) == FT_FACE_FLAG_SFNT;
}
int CFX_Font::GetAscent() const {
@@ -428,22 +426,22 @@
return false;
if (FXFT_Is_Face_Tricky(m_Face.Get())) {
- int error = FXFT_Set_Char_Size(m_Face.Get(), 0, 1000 * 64, 72, 72);
+ int error = FT_Set_Char_Size(m_Face.Get(), 0, 1000 * 64, 72, 72);
if (error)
return false;
- error = FXFT_Load_Glyph(m_Face.Get(), glyph_index,
- FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
+ error = FT_Load_Glyph(m_Face.Get(), glyph_index,
+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
if (error)
return false;
- FXFT_BBox cbox;
+ FT_BBox cbox;
FT_Glyph glyph;
- error = FXFT_Get_Glyph(m_Face->glyph, &glyph);
+ error = FT_Get_Glyph(m_Face->glyph, &glyph);
if (error)
return false;
- FXFT_Glyph_Get_CBox(glyph, FXFT_GLYPH_BBOX_PIXELS, &cbox);
+ FT_Glyph_Get_CBox(glyph, FT_GLYPH_BBOX_PIXELS, &cbox);
int pixel_size_x = m_Face->size->metrics.x_ppem,
pixel_size_y = m_Face->size->metrics.y_ppem;
if (pixel_size_x == 0 || pixel_size_y == 0) {
@@ -463,11 +461,10 @@
std::max(pBBox->bottom,
static_cast<int32_t>(FXFT_Get_Face_Descender(m_Face.Get())));
FT_Done_Glyph(glyph);
- return FXFT_Set_Pixel_Sizes(m_Face.Get(), 0, 64) == 0;
+ return FT_Set_Pixel_Sizes(m_Face.Get(), 0, 64) == 0;
}
- if (FXFT_Load_Glyph(
- m_Face.Get(), glyph_index,
- FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
+ if (FT_Load_Glyph(m_Face.Get(), glyph_index,
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH)) {
return false;
}
int em = FXFT_Get_Face_UnitsPerEM(m_Face.Get());
@@ -492,7 +489,7 @@
bool CFX_Font::IsItalic() const {
if (!m_Face)
return false;
- if (FXFT_Is_Face_Italic(m_Face.Get()) == FXFT_STYLE_FLAG_ITALIC)
+ if (FXFT_Is_Face_Italic(m_Face.Get()) == FT_STYLE_FLAG_ITALIC)
return true;
ByteString str(FXFT_Get_Face_Style_Name(m_Face.Get()));
@@ -501,7 +498,7 @@
}
bool CFX_Font::IsBold() const {
- return m_Face && FXFT_Is_Face_Bold(m_Face.Get()) == FXFT_STYLE_FLAG_BOLD;
+ return m_Face && FXFT_Is_Face_Bold(m_Face.Get()) == FT_STYLE_FLAG_BOLD;
}
bool CFX_Font::IsFixedWidth() const {
@@ -512,7 +509,7 @@
if (!m_Face)
return ByteString();
- ByteString psName = FXFT_Get_Postscript_Name(m_Face.Get());
+ ByteString psName = FT_Get_Postscript_Name(m_Face.Get());
if (psName.IsEmpty())
psName = kUntitledFontName;
return psName;
@@ -595,8 +592,8 @@
int dest_width,
int weight) const {
ASSERT(dest_width >= 0);
- FXFT_MM_Var pMasters = nullptr;
- FXFT_Get_MM_Var(m_Face.Get(), &pMasters);
+ FXFT_MM_VarPtr pMasters = nullptr;
+ FT_Get_MM_Var(m_Face.Get(), &pMasters);
if (!pMasters)
return;
@@ -612,15 +609,15 @@
int min_param = FXFT_Get_MM_Axis_Min(FXFT_Get_MM_Axis(pMasters, 1)) / 65536;
int max_param = FXFT_Get_MM_Axis_Max(FXFT_Get_MM_Axis(pMasters, 1)) / 65536;
coords[1] = min_param;
- FXFT_Set_MM_Design_Coordinates(m_Face.Get(), 2, coords);
- FXFT_Load_Glyph(m_Face.Get(), glyph_index,
- FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
+ FT_Set_MM_Design_Coordinates(m_Face.Get(), 2, coords);
+ FT_Load_Glyph(m_Face.Get(), glyph_index,
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
int min_width = FXFT_Get_Glyph_HoriAdvance(m_Face.Get()) * 1000 /
FXFT_Get_Face_UnitsPerEM(m_Face.Get());
coords[1] = max_param;
- FXFT_Set_MM_Design_Coordinates(m_Face.Get(), 2, coords);
- FXFT_Load_Glyph(m_Face.Get(), glyph_index,
- FXFT_LOAD_NO_SCALE | FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
+ FT_Set_MM_Design_Coordinates(m_Face.Get(), 2, coords);
+ FT_Load_Glyph(m_Face.Get(), glyph_index,
+ FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH);
int max_width = FXFT_Get_Glyph_HoriAdvance(m_Face.Get()) * 1000 /
FXFT_Get_Face_UnitsPerEM(m_Face.Get());
if (max_width == min_width) {
@@ -632,7 +629,7 @@
coords[1] = param;
}
FXFT_Free(m_Face.Get(), pMasters);
- FXFT_Set_MM_Design_Coordinates(m_Face.Get(), 2, coords);
+ FT_Set_MM_Design_Coordinates(m_Face.Get(), 2, coords);
}
CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index,
@@ -640,8 +637,8 @@
if (!m_Face)
return nullptr;
- FXFT_Set_Pixel_Sizes(m_Face.Get(), 0, 64);
- FXFT_Matrix ft_matrix = {65536, 0, 0, 65536};
+ FT_Set_Pixel_Sizes(m_Face.Get(), 0, 64);
+ FT_Matrix ft_matrix = {65536, 0, 0, 65536};
if (m_pSubstFont) {
if (m_pSubstFont->m_ItalicAngle) {
int skew = m_pSubstFont->m_ItalicAngle;
@@ -662,10 +659,10 @@
AdjustMMParams(glyph_index, dest_width, m_pSubstFont->m_Weight);
}
ScopedFontTransform scoped_transform(m_Face.Get(), &ft_matrix);
- int load_flags = FXFT_LOAD_NO_BITMAP;
+ int load_flags = FT_LOAD_NO_BITMAP;
if (!(m_Face->face_flags & FT_FACE_FLAG_SFNT) || !FT_IS_TRICKY(m_Face.Get()))
load_flags |= FT_LOAD_NO_HINTING;
- if (FXFT_Load_Glyph(m_Face.Get(), glyph_index, load_flags))
+ if (FT_Load_Glyph(m_Face.Get(), glyph_index, load_flags))
return nullptr;
if (m_pSubstFont && !m_pSubstFont->m_bFlagMM &&
m_pSubstFont->m_Weight > 400) {
@@ -676,10 +673,10 @@
level = s_WeightPow_SHIFTJIS[index] * 2 * 65536 / 36655;
else
level = s_WeightPow[index] * 2;
- FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face.Get()), level);
+ FT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face.Get()), level);
}
- FXFT_Outline_Funcs funcs;
+ FT_Outline_Funcs funcs;
funcs.move_to = Outline_MoveTo;
funcs.line_to = Outline_LineTo;
funcs.conic_to = Outline_ConicTo;
@@ -693,7 +690,7 @@
params.m_CurX = params.m_CurY = 0;
params.m_CoordUnit = 64 * 64.0;
- FXFT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face.Get()), &funcs, ¶ms);
+ FT_Outline_Decompose(FXFT_Get_Glyph_Outline(m_Face.Get()), &funcs, ¶ms);
if (pPath->GetPoints().empty())
return nullptr;
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 65baeba..9e792d0 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -265,12 +265,12 @@
CFX_FontMapper::~CFX_FontMapper() {
for (size_t i = 0; i < FX_ArraySize(m_FoxitFaces); ++i) {
if (m_FoxitFaces[i])
- FXFT_Done_Face(m_FoxitFaces[i]);
+ FT_Done_Face(m_FoxitFaces[i]);
}
if (m_MMFaces[0])
- FXFT_Done_Face(m_MMFaces[0]);
+ FT_Done_Face(m_MMFaces[0]);
if (m_MMFaces[1])
- FXFT_Done_Face(m_MMFaces[1]);
+ FT_Done_Face(m_MMFaces[1]);
}
void CFX_FontMapper::SetSystemFontInfo(
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index 9e0494e..aff16d1 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -84,14 +84,14 @@
// be destroyed first.
m_FaceMap.clear();
m_pBuiltinMapper.reset();
- FXFT_Done_FreeType(m_FTLibrary);
+ FT_Done_FreeType(m_FTLibrary);
}
void CFX_FontMgr::InitFTLibrary() {
if (m_FTLibrary)
return;
- FXFT_Init_FreeType(&m_FTLibrary);
+ FT_Init_FreeType(&m_FTLibrary);
m_FTLibrarySupportsHinting =
SetLcdFilterMode() || FreeTypeVersionSupportsHinting();
}
@@ -138,11 +138,11 @@
FXFT_FaceRec* face = nullptr;
int ret =
- FXFT_New_Memory_Face(m_FTLibrary, pData.get(), size, face_index, &face);
+ FT_New_Memory_Face(m_FTLibrary, pData.get(), size, face_index, &face);
if (ret)
return nullptr;
- ret = FXFT_Set_Pixel_Sizes(face, 64, 64);
+ ret = FT_Set_Pixel_Sizes(face, 64, 64);
if (ret)
return nullptr;
@@ -192,11 +192,11 @@
int face_index) {
InitFTLibrary();
FXFT_FaceRec* face = nullptr;
- if (FXFT_New_Memory_Face(m_FTLibrary, span.data(), span.size(), face_index,
- &face)) {
+ if (FT_New_Memory_Face(m_FTLibrary, span.data(), span.size(), face_index,
+ &face)) {
return nullptr;
}
- return FXFT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face;
+ return FT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face;
}
void CFX_FontMgr::ReleaseFace(FXFT_FaceRec* face) {
@@ -213,7 +213,7 @@
break;
}
if (bNeedFaceDone && !m_pBuiltinMapper->IsBuiltinFace(face))
- FXFT_Done_Face(face);
+ FT_Done_Face(face);
}
// static
@@ -235,7 +235,7 @@
FT_Int major;
FT_Int minor;
FT_Int patch;
- FXFT_Library_Version(m_FTLibrary, &major, &minor, &patch);
+ FT_Library_Version(m_FTLibrary, &major, &minor, &patch);
// Freetype versions >= 2.8.1 support hinting even if subpixel rendering is
// disabled. https://sourceforge.net/projects/freetype/files/freetype2/2.8.1/
return major > 2 || (major == 2 && minor > 8) ||
@@ -243,6 +243,6 @@
}
bool CFX_FontMgr::SetLcdFilterMode() const {
- return FXFT_Library_SetLcdFilter(m_FTLibrary, FT_LCD_FILTER_DEFAULT) !=
+ return FT_Library_SetLcdFilter(m_FTLibrary, FT_LCD_FILTER_DEFAULT) !=
FT_Err_Unimplemented_Feature;
}
diff --git a/core/fxge/cfx_fontmgr.h b/core/fxge/cfx_fontmgr.h
index aba9102..f021866 100644
--- a/core/fxge/cfx_fontmgr.h
+++ b/core/fxge/cfx_fontmgr.h
@@ -63,7 +63,7 @@
// Always present.
CFX_FontMapper* GetBuiltinMapper() const { return m_pBuiltinMapper.get(); }
- FXFT_Library GetFTLibrary() const { return m_FTLibrary; }
+ FXFT_LibraryRec* GetFTLibrary() const { return m_FTLibrary; }
bool FTLibrarySupportsHinting() const { return m_FTLibrarySupportsHinting; }
private:
@@ -72,7 +72,7 @@
std::unique_ptr<CFX_FontMapper> m_pBuiltinMapper;
std::map<ByteString, std::unique_ptr<CTTFontDesc>> m_FaceMap;
- FXFT_Library m_FTLibrary = nullptr;
+ FXFT_LibraryRec* m_FTLibrary = nullptr;
bool m_FTLibrarySupportsHinting = false;
};
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index d526e3a..9cb0401 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -109,7 +109,7 @@
if (!m_Face)
return nullptr;
- FXFT_Matrix ft_matrix;
+ FT_Matrix ft_matrix;
ft_matrix.xx = matrix.a / 64 * 65536;
ft_matrix.xy = matrix.c / 64 * 65536;
ft_matrix.yx = matrix.b / 64 * 65536;
@@ -144,17 +144,16 @@
}
ScopedFontTransform scoped_transform(m_Face, &ft_matrix);
int load_flags = (m_Face->face_flags & FT_FACE_FLAG_SFNT)
- ? FXFT_LOAD_NO_BITMAP
- : (FXFT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING);
- int error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags);
+ ? FT_LOAD_NO_BITMAP
+ : (FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING);
+ int error = FT_Load_Glyph(m_Face, glyph_index, load_flags);
if (error) {
// if an error is returned, try to reload glyphs without hinting.
if (load_flags & FT_LOAD_NO_HINTING || load_flags & FT_LOAD_NO_SCALE)
return nullptr;
load_flags |= FT_LOAD_NO_HINTING;
- error = FXFT_Load_Glyph(m_Face, glyph_index, load_flags);
-
+ error = FT_Load_Glyph(m_Face, glyph_index, load_flags);
if (error)
return nullptr;
}
@@ -177,14 +176,15 @@
(abs(static_cast<int>(ft_matrix.xx)) +
abs(static_cast<int>(ft_matrix.xy))) /
36655;
- FXFT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face),
- level.ValueOrDefault(0));
+ FT_Outline_Embolden(FXFT_Get_Glyph_Outline(m_Face),
+ level.ValueOrDefault(0));
}
- FXFT_Library_SetLcdFilter(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(),
- FT_LCD_FILTER_DEFAULT);
+ FT_Library_SetLcdFilter(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(),
+ FT_LCD_FILTER_DEFAULT);
error = FXFT_Render_Glyph(m_Face, anti_alias);
if (error)
return nullptr;
+
int bmwidth = FXFT_Get_Bitmap_Width(FXFT_Get_Glyph_Bitmap(m_Face));
int bmheight = FXFT_Get_Bitmap_Rows(FXFT_Get_Glyph_Bitmap(m_Face));
if (bmwidth > kMaxGlyphDimension || bmheight > kMaxGlyphDimension)
@@ -194,16 +194,16 @@
FXFT_Get_Glyph_BitmapLeft(m_Face), FXFT_Get_Glyph_BitmapTop(m_Face));
pGlyphBitmap->GetBitmap()->Create(
dib_width, bmheight,
- anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask);
+ anti_alias == FT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask);
int dest_pitch = pGlyphBitmap->GetBitmap()->GetPitch();
int src_pitch = FXFT_Get_Bitmap_Pitch(FXFT_Get_Glyph_Bitmap(m_Face));
uint8_t* pDestBuf = pGlyphBitmap->GetBitmap()->GetBuffer();
uint8_t* pSrcBuf = static_cast<uint8_t*>(
FXFT_Get_Bitmap_Buffer(FXFT_Get_Glyph_Bitmap(m_Face)));
- if (anti_alias != FXFT_RENDER_MODE_MONO &&
+ if (anti_alias != FT_RENDER_MODE_MONO &&
FXFT_Get_Bitmap_PixelMode(FXFT_Get_Glyph_Bitmap(m_Face)) ==
- FXFT_PIXEL_MODE_MONO) {
- int bytes = anti_alias == FXFT_RENDER_MODE_LCD ? 3 : 1;
+ FT_PIXEL_MODE_MONO) {
+ int bytes = anti_alias == FT_RENDER_MODE_LCD ? 3 : 1;
for (int i = 0; i < bmheight; i++) {
for (int n = 0; n < bmwidth; n++) {
uint8_t data =
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index f97b92f..171924d 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -897,7 +897,7 @@
nullptr, nullptr, fill_color, 0, nullptr, nPathFlags);
}
}
- int anti_alias = FXFT_RENDER_MODE_MONO;
+ int anti_alias = FT_RENDER_MODE_MONO;
bool bNormal = false;
if ((text_flags & FXTEXT_NOSMOOTH) == 0) {
if (m_DeviceClass == FXDC_DISPLAY && m_bpp > 1) {
@@ -907,14 +907,14 @@
// 6225973, 6243070, 6393145, 6421054, 6282327, and 6624828; the latest
// one expires 10/7/19. This makes LCD antialiasing very ugly, so we
// instead fall back on NORMAL antialiasing.
- anti_alias = FXFT_RENDER_MODE_NORMAL;
+ anti_alias = FT_RENDER_MODE_NORMAL;
} else if ((m_RenderCaps & (FXRC_ALPHA_OUTPUT | FXRC_CMYK_OUTPUT))) {
- anti_alias = FXFT_RENDER_MODE_LCD;
+ anti_alias = FT_RENDER_MODE_LCD;
bNormal = true;
} else if (m_bpp < 16) {
- anti_alias = FXFT_RENDER_MODE_NORMAL;
+ anti_alias = FT_RENDER_MODE_NORMAL;
} else {
- anti_alias = FXFT_RENDER_MODE_LCD;
+ anti_alias = FT_RENDER_MODE_LCD;
bool bClearType = false;
if (pFont->GetFace())
@@ -931,7 +931,7 @@
const TextCharPos& charpos = pCharPos[i];
glyph.m_fOrigin = text2Device.Transform(charpos.m_Origin);
- if (anti_alias < FXFT_RENDER_MODE_LCD)
+ if (anti_alias < FT_RENDER_MODE_LCD)
glyph.m_Origin.x = FXSYS_round(glyph.m_fOrigin.x);
else
glyph.m_Origin.x = static_cast<int>(floor(glyph.m_fOrigin.x));
@@ -951,7 +951,7 @@
charpos.m_FontCharWidth, anti_alias, &nativetext_flags);
}
}
- if (anti_alias < FXFT_RENDER_MODE_LCD && glyphs.size() > 1)
+ if (anti_alias < FT_RENDER_MODE_LCD && glyphs.size() > 1)
AdjustGlyphSpace(&glyphs);
FX_RECT bmp_rect = GetGlyphsBBox(glyphs, anti_alias);
@@ -963,7 +963,7 @@
int pixel_height = bmp_rect.Height();
int pixel_left = bmp_rect.left;
int pixel_top = bmp_rect.top;
- if (anti_alias == FXFT_RENDER_MODE_MONO) {
+ if (anti_alias == FT_RENDER_MODE_MONO) {
auto bitmap = pdfium::MakeRetain<CFX_DIBitmap>();
if (!bitmap->Create(pixel_width, pixel_height, FXDIB_1bppMask))
return false;
@@ -1005,7 +1005,7 @@
int r = 0;
int g = 0;
int b = 0;
- if (anti_alias == FXFT_RENDER_MODE_LCD)
+ if (anti_alias == FT_RENDER_MODE_LCD)
std::tie(a, r, g, b) = ArgbDecode(fill_color);
for (const TextGlyphPos& glyph : glyphs) {
@@ -1019,7 +1019,7 @@
const RetainPtr<CFX_DIBitmap>& pGlyph = glyph.m_pGlyph->GetBitmap();
int ncols = pGlyph->GetWidth();
int nrows = pGlyph->GetHeight();
- if (anti_alias == FXFT_RENDER_MODE_NORMAL) {
+ if (anti_alias == FT_RENDER_MODE_NORMAL) {
if (!bitmap->CompositeMask(point.value().x, point.value().y, ncols, nrows,
pGlyph, fill_color, 0, 0, BlendMode::kNormal,
nullptr, false)) {
diff --git a/core/fxge/cfx_unicodeencoding.cpp b/core/fxge/cfx_unicodeencoding.cpp
index d3df0a7..79c0620 100644
--- a/core/fxge/cfx_unicodeencoding.cpp
+++ b/core/fxge/cfx_unicodeencoding.cpp
@@ -21,16 +21,16 @@
if (!face)
return charcode;
- if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0)
- return FXFT_Get_Char_Index(face, charcode);
+ if (FT_Select_Charmap(face, FT_ENCODING_UNICODE) == 0)
+ return FT_Get_Char_Index(face, charcode);
if (m_pFont->GetSubstFont() &&
m_pFont->GetSubstFont()->m_Charset == FX_CHARSET_Symbol) {
uint32_t index = 0;
- if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0)
- index = FXFT_Get_Char_Index(face, charcode);
- if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN))
- return FXFT_Get_Char_Index(face, charcode);
+ if (FT_Select_Charmap(face, FT_ENCODING_MS_SYMBOL) == 0)
+ index = FT_Get_Char_Index(face, charcode);
+ if (!index && !FT_Select_Charmap(face, FT_ENCODING_APPLE_ROMAN))
+ return FT_Get_Char_Index(face, charcode);
}
return charcode;
}
diff --git a/core/fxge/cfx_unicodeencodingex.cpp b/core/fxge/cfx_unicodeencodingex.cpp
index 99cc2cc..5daeef8 100644
--- a/core/fxge/cfx_unicodeencodingex.cpp
+++ b/core/fxge/cfx_unicodeencodingex.cpp
@@ -43,7 +43,7 @@
uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) {
FXFT_FaceRec* face = m_pFont->GetFace();
- FT_UInt nIndex = FXFT_Get_Char_Index(face, charcode);
+ FT_UInt nIndex = FT_Get_Char_Index(face, charcode);
if (nIndex > 0)
return nIndex;
int nmaps = FXFT_Get_Face_CharmapCount(face);
@@ -56,7 +56,7 @@
int error = FXFT_Select_Charmap(face, nEncodingID);
if (error)
continue;
- nIndex = FXFT_Get_Char_Index(face, charcode);
+ nIndex = FT_Get_Char_Index(face, charcode);
if (nIndex > 0) {
m_nEncodingID = nEncodingID;
return nIndex;
diff --git a/core/fxge/cttfontdesc.cpp b/core/fxge/cttfontdesc.cpp
index 7a05023..ff01e4f 100644
--- a/core/fxge/cttfontdesc.cpp
+++ b/core/fxge/cttfontdesc.cpp
@@ -21,7 +21,7 @@
ASSERT(m_RefCount == 0);
for (size_t i = 0; i < FX_ArraySize(m_TTCFaces); i++) {
if (m_TTCFaces[i])
- FXFT_Done_Face(m_TTCFaces[i]);
+ FT_Done_Face(m_TTCFaces[i]);
}
}
diff --git a/core/fxge/fx_font.cpp b/core/fxge/fx_font.cpp
index c8eb169..a79bfca 100644
--- a/core/fxge/fx_font.cpp
+++ b/core/fxge/fx_font.cpp
@@ -37,7 +37,7 @@
continue;
int char_width = glyph.m_pGlyph->GetBitmap()->GetWidth();
- if (anti_alias == FXFT_RENDER_MODE_LCD)
+ if (anti_alias == FT_RENDER_MODE_LCD)
char_width /= 3;
FX_SAFE_INT32 char_right = point.value().x;
diff --git a/core/fxge/fx_freetype.h b/core/fxge/fx_freetype.h
index 49d7538..0832d50 100644
--- a/core/fxge/fx_freetype.h
+++ b/core/fxge/fx_freetype.h
@@ -16,177 +16,67 @@
#include FT_TRUETYPE_TABLES_H
using FXFT_LibraryRec = struct FT_LibraryRec_;
-using FXFT_Library = FXFT_LibraryRec*;
using FXFT_FaceRec = struct FT_FaceRec_;
+using FXFT_StreamRec = struct FT_StreamRec_;
+using FXFT_MM_VarPtr = FT_MM_Var*;
-using FXFT_MM_Var = FT_MM_Var*;
-using FXFT_Open_Args = FT_Open_Args;
-using FXFT_StreamRec = FT_StreamRec;
-using FXFT_Stream = FT_StreamRec*;
-using FXFT_BBox = FT_BBox;
-using FXFT_Glyph = FT_Glyph;
-using FXFT_CharMap = FT_CharMap;
-
-using FXFT_Matrix = FT_Matrix;
-using FXFT_Vector = FT_Vector;
-using FXFT_Outline_Funcs = FT_Outline_Funcs;
-
-#define FXFT_ENCODING_UNICODE FT_ENCODING_UNICODE
-#define FXFT_ENCODING_ADOBE_STANDARD FT_ENCODING_ADOBE_STANDARD
-#define FXFT_ENCODING_ADOBE_EXPERT FT_ENCODING_ADOBE_EXPERT
-#define FXFT_ENCODING_ADOBE_LATIN_1 FT_ENCODING_ADOBE_LATIN_1
-#define FXFT_ENCODING_APPLE_ROMAN FT_ENCODING_APPLE_ROMAN
-#define FXFT_ENCODING_ADOBE_CUSTOM FT_ENCODING_ADOBE_CUSTOM
-#define FXFT_ENCODING_MS_SYMBOL FT_ENCODING_MS_SYMBOL
-#define FXFT_ENCODING_GB2312 FT_ENCODING_GB2312
-#define FXFT_ENCODING_BIG5 FT_ENCODING_BIG5
-#define FXFT_ENCODING_SJIS FT_ENCODING_SJIS
-#define FXFT_ENCODING_JOHAB FT_ENCODING_JOHAB
-
-#define FXFT_LOAD_NO_SCALE FT_LOAD_NO_SCALE
-#define FXFT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH \
- FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH
-#define FXFT_LOAD_NO_BITMAP FT_LOAD_NO_BITMAP
-
-#define FXFT_RENDER_MODE_LCD FT_RENDER_MODE_LCD
-#define FXFT_RENDER_MODE_MONO FT_RENDER_MODE_MONO
-#define FXFT_RENDER_MODE_NORMAL FT_RENDER_MODE_NORMAL
-
-#define FXFT_PIXEL_MODE_MONO FT_PIXEL_MODE_MONO
-
-#define FXFT_STYLE_FLAG_ITALIC FT_STYLE_FLAG_ITALIC
-#define FXFT_STYLE_FLAG_BOLD FT_STYLE_FLAG_BOLD
-
-#define FXFT_FACE_FLAG_SFNT FT_FACE_FLAG_SFNT
-#define FXFT_FACE_FLAG_TRICKY (1L << 13)
-
-#define FXFT_GLYPH_BBOX_PIXELS FT_GLYPH_BBOX_PIXELS
-
-#define FXFT_Init_FreeType(library) \
- FT_Init_FreeType(reinterpret_cast<FT_Library*>(library))
-#define FXFT_Done_FreeType(library) \
- FT_Done_FreeType(static_cast<FT_Library>(library))
-#define FXFT_Library_Version(library, amajor, aminor, apatch) \
- FT_Library_Version(reinterpret_cast<FT_Library>(library), amajor, aminor, \
- apatch)
-#define FXFT_New_Memory_Face(library, base, size, index, face) \
- FT_New_Memory_Face(static_cast<FT_Library>(library), base, size, index, \
- static_cast<FT_Face*>(face))
-#define FXFT_Open_Face(library, args, index, face) \
- FT_Open_Face(static_cast<FT_Library>(library), args, index, \
- static_cast<FT_Face*>(face))
-#define FXFT_Done_Face(face) FT_Done_Face(static_cast<FT_Face>(face))
-#define FXFT_Select_Charmap(face, encoding) \
- FT_Select_Charmap(static_cast<FT_Face>(face), \
- static_cast<FT_Encoding>(encoding))
-#define FXFT_Set_Charmap(face, charmap) \
- FT_Set_Charmap(static_cast<FT_Face>(face), static_cast<FT_CharMap>(charmap))
-#define FXFT_Load_Glyph(face, glyph_index, flags) \
- FT_Load_Glyph(static_cast<FT_Face>(face), glyph_index, flags)
-#define FXFT_Get_Char_Index(face, code) \
- FT_Get_Char_Index(static_cast<FT_Face>(face), code)
-#define FXFT_Get_Glyph_Name(face, index, buffer, size) \
- FT_Get_Glyph_Name(static_cast<FT_Face>(face), index, buffer, size)
+#define FXFT_Select_Charmap(face, encoding) \
+ FT_Select_Charmap(face, static_cast<FT_Encoding>(encoding))
#define FXFT_Get_Name_Index(face, name) \
- FT_Get_Name_Index(static_cast<FT_Face>(face), const_cast<char*>(name))
+ FT_Get_Name_Index(face, const_cast<char*>(name))
+#define FXFT_Get_Glyph_Outline(face) &((face)->glyph->outline)
+#define FXFT_Render_Glyph(face, mode) \
+ FT_Render_Glyph((face)->glyph, static_cast<enum FT_Render_Mode_>(mode))
+
#define FXFT_Has_Glyph_Names(face) \
- ((static_cast<FT_Face>(face)->face_flags) & FT_FACE_FLAG_GLYPH_NAMES)
-#define FXFT_Get_Postscript_Name(face) \
- FT_Get_Postscript_Name(static_cast<FT_Face>(face))
-#define FXFT_Load_Sfnt_Table(face, tag, offset, buffer, length) \
- FT_Load_Sfnt_Table(static_cast<FT_Face>(face), tag, offset, buffer, length)
-#define FXFT_Get_First_Char(face, glyph_index) \
- FT_Get_First_Char(static_cast<FT_Face>(face), glyph_index)
-#define FXFT_Get_Next_Char(face, code, glyph_index) \
- FT_Get_Next_Char(static_cast<FT_Face>(face), code, glyph_index)
+ (((face)->face_flags) & FT_FACE_FLAG_GLYPH_NAMES)
#define FXFT_Clear_Face_External_Stream(face) \
- (static_cast<FT_Face>(face)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM)
+ ((face)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM)
#define FXFT_Get_Face_External_Stream(face) \
- ((static_cast<FT_Face>(face)->face_flags) & FT_FACE_FLAG_EXTERNAL_STREAM)
-#define FXFT_Is_Face_TT_OT(face) \
- ((static_cast<FT_Face>(face)->face_flags) & FT_FACE_FLAG_SFNT)
-#define FXFT_Is_Face_Tricky(face) \
- ((static_cast<FT_Face>(face)->face_flags) & FXFT_FACE_FLAG_TRICKY)
+ (((face)->face_flags) & FT_FACE_FLAG_EXTERNAL_STREAM)
+#define FXFT_Is_Face_TT_OT(face) (((face)->face_flags) & FT_FACE_FLAG_SFNT)
+#define FXFT_Is_Face_Tricky(face) (((face)->face_flags) & FT_FACE_FLAG_TRICKY)
#define FXFT_Is_Face_fixedwidth(face) \
- ((static_cast<FT_Face>(face)->face_flags) & FT_FACE_FLAG_FIXED_WIDTH)
-#define FXFT_Get_Face_Stream_Base(face) static_cast<FT_Face>(face)->stream->base
-#define FXFT_Get_Face_Stream_Size(face) static_cast<FT_Face>(face)->stream->size
-#define FXFT_Get_Face_Family_Name(face) static_cast<FT_Face>(face)->family_name
-#define FXFT_Get_Face_Style_Name(face) static_cast<FT_Face>(face)->style_name
-#define FXFT_Is_Face_Italic(face) \
- ((static_cast<FT_Face>(face)->style_flags) & FT_STYLE_FLAG_ITALIC)
-#define FXFT_Is_Face_Bold(face) \
- ((static_cast<FT_Face>(face)->style_flags) & FT_STYLE_FLAG_BOLD)
-#define FXFT_Get_Face_Charmaps(face) static_cast<FT_Face>(face)->charmaps
-#define FXFT_Get_Glyph_HoriBearingX(face) \
- static_cast<FT_Face>(face)->glyph->metrics.horiBearingX
-#define FXFT_Get_Glyph_HoriBearingY(face) \
- static_cast<FT_Face>(face)->glyph->metrics.horiBearingY
-#define FXFT_Get_Glyph_Width(face) \
- static_cast<FT_Face>(face)->glyph->metrics.width
-#define FXFT_Get_Glyph_Height(face) \
- static_cast<FT_Face>(face)->glyph->metrics.height
-#define FXFT_Get_Face_CharmapCount(face) \
- static_cast<FT_Face>(face)->num_charmaps
-#define FXFT_Get_Charmap_Encoding(charmap) \
- static_cast<FT_CharMap>(charmap)->encoding
-#define FXFT_Get_Face_Charmap(face) static_cast<FT_Face>(face)->charmap
-#define FXFT_Get_Charmap_PlatformID(charmap) \
- static_cast<FT_CharMap>(charmap)->platform_id
-#define FXFT_Get_Charmap_EncodingID(charmap) \
- static_cast<FT_CharMap>(charmap)->encoding_id
-#define FXFT_Get_Face_UnitsPerEM(face) static_cast<FT_Face>(face)->units_per_EM
-#define FXFT_Get_Face_xMin(face) static_cast<FT_Face>(face)->bbox.xMin
-#define FXFT_Get_Face_xMax(face) static_cast<FT_Face>(face)->bbox.xMax
-#define FXFT_Get_Face_yMin(face) static_cast<FT_Face>(face)->bbox.yMin
-#define FXFT_Get_Face_yMax(face) static_cast<FT_Face>(face)->bbox.yMax
-#define FXFT_Get_Face_Height(face) static_cast<FT_Face>(face)->height
-#define FXFT_Get_Face_Ascender(face) static_cast<FT_Face>(face)->ascender
-#define FXFT_Get_Face_Descender(face) static_cast<FT_Face>(face)->descender
-#define FXFT_Get_Glyph_HoriAdvance(face) \
- static_cast<FT_Face>(face)->glyph->metrics.horiAdvance
-#define FXFT_Get_MM_Axis(var, index) static_cast<FT_MM_Var*>(var)->axis[index]
+ (((face)->face_flags) & FT_FACE_FLAG_FIXED_WIDTH)
+#define FXFT_Get_Face_Stream_Base(face) (face)->stream->base
+#define FXFT_Get_Face_Stream_Size(face) (face)->stream->size
+#define FXFT_Get_Face_Family_Name(face) (face)->family_name
+#define FXFT_Get_Face_Style_Name(face) (face)->style_name
+#define FXFT_Is_Face_Italic(face) (((face)->style_flags) & FT_STYLE_FLAG_ITALIC)
+#define FXFT_Is_Face_Bold(face) (((face)->style_flags) & FT_STYLE_FLAG_BOLD)
+#define FXFT_Get_Face_Charmaps(face) (face)->charmaps
+#define FXFT_Get_Glyph_HoriBearingX(face) (face)->glyph->metrics.horiBearingX
+#define FXFT_Get_Glyph_HoriBearingY(face) (face)->glyph->metrics.horiBearingY
+#define FXFT_Get_Glyph_Width(face) (face)->glyph->metrics.width
+#define FXFT_Get_Glyph_Height(face) (face)->glyph->metrics.height
+#define FXFT_Get_Face_CharmapCount(face) (face)->num_charmaps
+#define FXFT_Get_Charmap_Encoding(charmap) (charmap)->encoding
+#define FXFT_Get_Face_Charmap(face) (face)->charmap
+#define FXFT_Get_Charmap_PlatformID(charmap) (charmap)->platform_id
+#define FXFT_Get_Charmap_EncodingID(charmap) (charmap)->encoding_id
+#define FXFT_Get_Face_UnitsPerEM(face) (face)->units_per_EM
+#define FXFT_Get_Face_xMin(face) (face)->bbox.xMin
+#define FXFT_Get_Face_xMax(face) (face)->bbox.xMax
+#define FXFT_Get_Face_yMin(face) (face)->bbox.yMin
+#define FXFT_Get_Face_yMax(face) (face)->bbox.yMax
+#define FXFT_Get_Face_Height(face) (face)->height
+#define FXFT_Get_Face_Ascender(face) (face)->ascender
+#define FXFT_Get_Face_Descender(face) (face)->descender
+#define FXFT_Get_Glyph_HoriAdvance(face) (face)->glyph->metrics.horiAdvance
+#define FXFT_Get_MM_Axis(var, index) (var)->axis[index]
#define FXFT_Get_MM_Axis_Min(axis) (axis).minimum
#define FXFT_Get_MM_Axis_Max(axis) (axis).maximum
#define FXFT_Get_MM_Axis_Def(axis) (axis).def
-#define FXFT_Free(face, p) \
- static_cast<FT_Face>(face)->memory->free(static_cast<FT_Face>(face)->memory, \
- p)
-#define FXFT_Get_Glyph_Outline(face) \
- &(static_cast<FT_Face>(face)->glyph->outline)
-#define FXFT_Render_Glyph(face, mode) \
- FT_Render_Glyph(static_cast<FT_Face>(face)->glyph, \
- static_cast<enum FT_Render_Mode_>(mode))
-#define FXFT_Get_MM_Var(face, p) FT_Get_MM_Var(static_cast<FT_Face>(face), p)
-#define FXFT_Set_MM_Design_Coordinates(face, n, p) \
- FT_Set_MM_Design_Coordinates(static_cast<FT_Face>(face), n, p)
-#define FXFT_Set_Pixel_Sizes(face, w, h) \
- FT_Set_Pixel_Sizes(static_cast<FT_Face>(face), w, h)
-#define FXFT_Set_Transform(face, m, d) \
- FT_Set_Transform(static_cast<FT_Face>(face), m, d)
-#define FXFT_Outline_Embolden(outline, s) FT_Outline_Embolden(outline, s)
-#define FXFT_Get_Glyph_Bitmap(face) static_cast<FT_Face>(face)->glyph->bitmap
+#define FXFT_Free(face, p) (face)->memory->free((face)->memory, p)
+#define FXFT_Get_Glyph_Outline(face) &((face)->glyph->outline)
+#define FXFT_Get_Glyph_Bitmap(face) (face)->glyph->bitmap
#define FXFT_Get_Bitmap_Width(bitmap) (bitmap).width
#define FXFT_Get_Bitmap_Rows(bitmap) (bitmap).rows
#define FXFT_Get_Bitmap_PixelMode(bitmap) (bitmap).pixel_mode
#define FXFT_Get_Bitmap_Pitch(bitmap) (bitmap).pitch
#define FXFT_Get_Bitmap_Buffer(bitmap) (bitmap).buffer
-#define FXFT_Get_Glyph_BitmapLeft(face) \
- static_cast<FT_Face>(face)->glyph->bitmap_left
-#define FXFT_Get_Glyph_BitmapTop(face) \
- static_cast<FT_Face>(face)->glyph->bitmap_top
-#define FXFT_Outline_Decompose(outline, funcs, params) \
- FT_Outline_Decompose(outline, funcs, params)
-#define FXFT_Set_Char_Size(face, char_width, char_height, horz_resolution, \
- vert_resolution) \
- FT_Set_Char_Size(face, char_width, char_height, horz_resolution, \
- vert_resolution)
-#define FXFT_Get_Glyph(slot, aglyph) FT_Get_Glyph(slot, aglyph)
-#define FXFT_Glyph_Get_CBox(glyph, bbox_mode, acbox) \
- FT_Glyph_Get_CBox(glyph, bbox_mode, acbox)
-#define FXFT_Done_Glyph(glyph) FT_Done_Glyph(glyph)
-#define FXFT_Library_SetLcdFilter(library, filter) \
- FT_Library_SetLcdFilter(static_cast<FT_Library>(library), filter)
+#define FXFT_Get_Glyph_BitmapLeft(face) (face)->glyph->bitmap_left
+#define FXFT_Get_Glyph_BitmapTop(face) (face)->glyph->bitmap_top
int FXFT_unicode_from_adobe_name(const char* glyph_name);
void FXFT_adobe_name_from_unicode(char* name, wchar_t unicode);
diff --git a/core/fxge/scoped_font_transform.cpp b/core/fxge/scoped_font_transform.cpp
index 98c505e..ef3b5cf 100644
--- a/core/fxge/scoped_font_transform.cpp
+++ b/core/fxge/scoped_font_transform.cpp
@@ -9,19 +9,19 @@
namespace {
void ResetTransform(FT_Face face) {
- FXFT_Matrix matrix;
+ FT_Matrix matrix;
matrix.xx = 0x10000L;
matrix.xy = 0;
matrix.yx = 0;
matrix.yy = 0x10000L;
- FXFT_Set_Transform(face, &matrix, 0);
+ FT_Set_Transform(face, &matrix, 0);
}
} // namespace
-ScopedFontTransform::ScopedFontTransform(FT_Face face, FXFT_Matrix* matrix)
+ScopedFontTransform::ScopedFontTransform(FT_Face face, FT_Matrix* matrix)
: m_Face(face) {
- FXFT_Set_Transform(m_Face, matrix, 0);
+ FT_Set_Transform(m_Face, matrix, 0);
}
ScopedFontTransform::~ScopedFontTransform() {
diff --git a/core/fxge/scoped_font_transform.h b/core/fxge/scoped_font_transform.h
index 7dfc5b7..3f33f40 100644
--- a/core/fxge/scoped_font_transform.h
+++ b/core/fxge/scoped_font_transform.h
@@ -13,7 +13,7 @@
// goes out of scope.
class ScopedFontTransform {
public:
- ScopedFontTransform(FT_Face face, FXFT_Matrix* matrix);
+ ScopedFontTransform(FT_Face face, FT_Matrix* matrix);
~ScopedFontTransform();
private:
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index c333cbb..af1a830 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -275,7 +275,7 @@
pFontDict->SetNewFor<CPDF_Name>("BaseFont", name);
uint32_t dwGlyphIndex;
- uint32_t dwCurrentChar = FXFT_Get_First_Char(pFont->GetFace(), &dwGlyphIndex);
+ uint32_t dwCurrentChar = FT_Get_First_Char(pFont->GetFace(), &dwGlyphIndex);
static constexpr uint32_t kMaxSimpleFontChar = 0xFF;
if (dwCurrentChar > kMaxSimpleFontChar || dwGlyphIndex == 0)
return nullptr;
@@ -288,7 +288,7 @@
static_cast<uint32_t>(std::numeric_limits<int>::max()));
widthsArray->AddNew<CPDF_Number>(static_cast<int>(width));
uint32_t nextChar =
- FXFT_Get_Next_Char(pFont->GetFace(), dwCurrentChar, &dwGlyphIndex);
+ FT_Get_Next_Char(pFont->GetFace(), dwCurrentChar, &dwGlyphIndex);
// Simple fonts have 1-byte charcodes only.
if (nextChar > kMaxSimpleFontChar || dwGlyphIndex == 0)
break;
@@ -346,7 +346,7 @@
pFontDesc->GetObjNum());
uint32_t dwGlyphIndex;
- uint32_t dwCurrentChar = FXFT_Get_First_Char(pFont->GetFace(), &dwGlyphIndex);
+ uint32_t dwCurrentChar = FT_Get_First_Char(pFont->GetFace(), &dwGlyphIndex);
static constexpr uint32_t kMaxUnicode = 0x10FFFF;
// If it doesn't have a single char, just fail
if (dwGlyphIndex == 0 || dwCurrentChar > kMaxUnicode)
@@ -362,7 +362,7 @@
widths[dwGlyphIndex] = pFont->GetGlyphWidth(dwGlyphIndex);
to_unicode[dwGlyphIndex] = dwCurrentChar;
dwCurrentChar =
- FXFT_Get_Next_Char(pFont->GetFace(), dwCurrentChar, &dwGlyphIndex);
+ FT_Get_Next_Char(pFont->GetFace(), dwCurrentChar, &dwGlyphIndex);
if (dwGlyphIndex == 0)
break;
}
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index c362974..47a709e 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -32,12 +32,12 @@
bool VerifyUnicode(const RetainPtr<CFGAS_GEFont>& pFont, wchar_t wcUnicode) {
FXFT_FaceRec* pFace = pFont->GetDevFont()->GetFace();
- FXFT_CharMap charmap = FXFT_Get_Face_Charmap(pFace);
- if (FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE) != 0)
+ FT_CharMap charmap = FXFT_Get_Face_Charmap(pFace);
+ if (FXFT_Select_Charmap(pFace, FT_ENCODING_UNICODE) != 0)
return false;
- if (FXFT_Get_Char_Index(pFace, wcUnicode) == 0) {
- FXFT_Set_Charmap(pFace, charmap);
+ if (FT_Get_Char_Index(pFace, wcUnicode) == 0) {
+ FT_Set_Charmap(pFace, charmap);
return false;
}
return true;
@@ -341,7 +341,7 @@
extern "C" {
-unsigned long ftStreamRead(FXFT_Stream stream,
+unsigned long ftStreamRead(FXFT_StreamRec* stream,
unsigned long offset,
unsigned char* buffer,
unsigned long count) {
@@ -356,7 +356,7 @@
return count;
}
-void ftStreamClose(FXFT_Stream stream) {}
+void ftStreamClose(FXFT_StreamRec* stream) {}
} // extern "C"
@@ -484,7 +484,7 @@
CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr();
pFontMgr->InitFTLibrary();
- FXFT_Library library = pFontMgr->GetFTLibrary();
+ FXFT_LibraryRec* library = pFontMgr->GetFTLibrary();
if (!library)
return nullptr;
@@ -492,8 +492,8 @@
// Ultimately, we want to change this to:
// FXFT_Stream ftStream = FX_Alloc(FXFT_StreamRec, 1);
// https://bugs.chromium.org/p/pdfium/issues/detail?id=690
- FXFT_Stream ftStream =
- static_cast<FXFT_Stream>(ft_scalloc(sizeof(FXFT_StreamRec), 1));
+ FXFT_StreamRec* ftStream =
+ static_cast<FXFT_StreamRec*>(ft_scalloc(sizeof(FXFT_StreamRec), 1));
memset(ftStream, 0, sizeof(FXFT_StreamRec));
ftStream->base = nullptr;
ftStream->descriptor.pointer = static_cast<void*>(pFontStream.Get());
@@ -502,18 +502,18 @@
ftStream->read = ftStreamRead;
ftStream->close = ftStreamClose;
- FXFT_Open_Args ftArgs;
- memset(&ftArgs, 0, sizeof(FXFT_Open_Args));
+ FT_Open_Args ftArgs;
+ memset(&ftArgs, 0, sizeof(FT_Open_Args));
ftArgs.flags |= FT_OPEN_STREAM;
ftArgs.stream = ftStream;
FXFT_FaceRec* pFace = nullptr;
- if (FXFT_Open_Face(library, &ftArgs, iFaceIndex, &pFace)) {
+ if (FT_Open_Face(library, &ftArgs, iFaceIndex, &pFace)) {
ft_sfree(ftStream);
return nullptr;
}
- FXFT_Set_Pixel_Sizes(pFace, 0, 64);
+ FT_Set_Pixel_Sizes(pFace, 0, 64);
return pFace;
}
@@ -528,13 +528,13 @@
if (!pFace)
return false;
- FT_Error retCharmap = FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE);
- FT_Error retIndex = FXFT_Get_Char_Index(pFace, wcUnicode);
+ FT_Error retCharmap = FXFT_Select_Charmap(pFace, FT_ENCODING_UNICODE);
+ FT_Error retIndex = FT_Get_Char_Index(pFace, wcUnicode);
if (FXFT_Get_Face_External_Stream(pFace))
FXFT_Clear_Face_External_Stream(pFace);
- FXFT_Done_Face(pFace);
+ FT_Done_Face(pFace);
return !retCharmap && retIndex;
}
@@ -758,17 +758,17 @@
std::vector<uint8_t> table;
unsigned long nLength = 0;
- unsigned int error = FXFT_Load_Sfnt_Table(pFace, dwTag, 0, nullptr, &nLength);
+ unsigned int error = FT_Load_Sfnt_Table(pFace, dwTag, 0, nullptr, &nLength);
if (error == 0 && nLength != 0) {
table.resize(nLength);
- if (FXFT_Load_Sfnt_Table(pFace, dwTag, 0, table.data(), nullptr))
+ if (FT_Load_Sfnt_Table(pFace, dwTag, 0, table.data(), nullptr))
table.clear();
}
pFont->m_wsFamilyNames = GetNames(table.empty() ? nullptr : table.data());
pFont->m_wsFamilyNames.push_back(WideString::FromUTF8(pFace->family_name));
pFont->m_wsFaceName =
pFaceName ? *pFaceName
- : WideString::FromDefANSI(FXFT_Get_Postscript_Name(pFace));
+ : WideString::FromDefANSI(FT_Get_Postscript_Name(pFace));
pFont->m_nFaceIndex = pFace->face_index;
m_InstalledFonts.push_back(std::move(pFont));
}
@@ -788,7 +788,7 @@
RegisterFace(pFace, pFaceName);
if (FXFT_Get_Face_External_Stream(pFace))
FXFT_Clear_Face_External_Stream(pFace);
- FXFT_Done_Face(pFace);
+ FT_Done_Face(pFace);
} while (index < num_faces);
}