diff options
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 22 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.h | 9 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_interform.cpp | 2 |
3 files changed, 6 insertions, 27 deletions
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index 2a432623ff..a8d1f56b4e 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -809,23 +809,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) { } #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ -CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont, - bool bVert, - bool bTranslateName) { - LOGFONTA lfa; - memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); - ByteString face = WideString(pLogFont->lfFaceName).ToDefANSI(); - if (face.GetLength() >= LF_FACESIZE) - return nullptr; - - strncpy(lfa.lfFaceName, face.c_str(), - (face.GetLength() + 1) * sizeof(ByteString::CharType)); - return AddWindowsFont(&lfa, bVert, bTranslateName); -} - -CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, - bool bVert, - bool bTranslateName) { +CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont) { pLogFont->lfHeight = -1000; pLogFont->lfWidth = 0; HGDIOBJ hFont = CreateFontIndirectA(pLogFont); @@ -850,7 +834,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, const bool bCJK = FX_CharSetIsCJK(pLogFont->lfCharSet); ByteString basefont; - if (bTranslateName && bCJK) + if (bCJK) basefont = FPDF_GetPSNameFromTT(hDC); if (basefont.IsEmpty()) @@ -884,7 +868,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, pLogFont->lfItalic != 0, basefont, std::move(pWidths)); } else { pFontDict = - ProcessbCJK(pBaseDict, pLogFont->lfCharSet, bVert, basefont, + ProcessbCJK(pBaseDict, pLogFont->lfCharSet, false, basefont, [&hDC](wchar_t start, wchar_t end, CPDF_Array* widthArr) { InsertWidthArray(hDC, start, end, widthArr); }); diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h index 8261441f64..d42539fa7f 100644 --- a/core/fpdfapi/parser/cpdf_document.h +++ b/core/fpdfapi/parser/cpdf_document.h @@ -111,7 +111,6 @@ class CPDF_Document : public Observable<CPDF_Document>, const char* password); void LoadPages(); - void CreateNewDoc(); CPDF_Dictionary* CreateNewPage(int iPage); @@ -120,13 +119,9 @@ class CPDF_Document : public Observable<CPDF_Document>, CPDF_Font* AddStandardFont(const char* font, CPDF_FontEncoding* pEncoding); CPDF_Font* AddFont(CFX_Font* pFont, int charset, bool bVert); + #if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_ - CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, - bool bVert, - bool bTranslateName = false); - CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, - bool bVert, - bool bTranslateName = false); + CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont); #endif protected: diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index 8054aa8eb0..953c96234c 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -688,7 +688,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, if (!csFontName.IsEmpty()) { if (csFontName == CFX_Font::kDefaultAnsiFontName) return AddStandardFont(pDocument, csFontName); - return pDocument->AddWindowsFont(&lf, false, true); + return pDocument->AddWindowsFont(&lf); } #endif return nullptr; |