diff options
author | Lei Zhang <thestig@chromium.org> | 2015-08-17 18:36:43 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-08-17 18:36:43 -0700 |
commit | 1b0023986bc22ce362097b25deb9746b693ef235 (patch) | |
tree | 4d18ffc5f9eff4ac4659531621be8d2c28e3c71c /core/src/fpdfapi/fpdf_edit | |
parent | a0f67247277f666d80899985eda3c19f3641b9bf (diff) | |
download | pdfium-1b0023986bc22ce362097b25deb9746b693ef235.tar.xz |
Merge to XFA: Cleanup CFX_UnicodeEncoding and remove IFX_FontEncoding.
Similarly, Clean up CFX_UnicodeEncodingEx and remove IFX_FontEncodingEx.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1296753003 .
(cherry picked from commit 52a48aadc19b2dee8abeb702269bb168eb6b6999)
Review URL: https://codereview.chromium.org/1297083002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_edit')
-rw-r--r-- | core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 925693079f..1ff9876acc 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -426,6 +426,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, return LoadFont(pBaseDict); } #endif + #if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_) uint32_t FX_GetLangHashCode(const FX_CHAR* pStr) { FXSYS_assert(pStr != NULL); @@ -791,9 +792,10 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, CFRelease(languages); return LoadFont(pBaseDict); } -#endif +#endif // (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_) + static void _InsertWidthArray1(CFX_Font* pFont, - IFX_FontEncoding* pEncoding, + CFX_UnicodeEncoding* pEncoding, FX_WCHAR start, FX_WCHAR end, CPDF_Array* pWidthArray) { @@ -821,6 +823,7 @@ static void _InsertWidthArray1(CFX_Font* pFont, } FX_Free(widths); } + CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { if (pFont == NULL) { return NULL; @@ -843,7 +846,8 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { } CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; pBaseDict->SetAtName("Type", "Font"); - IFX_FontEncoding* pEncoding = FXGE_CreateUnicodeEncoding(pFont); + nonstd::unique_ptr<CFX_UnicodeEncoding> pEncoding( + new CFX_UnicodeEncoding(pFont)); CPDF_Dictionary* pFontDict = pBaseDict; if (!bCJK) { CPDF_Array* pWidths = new CPDF_Array; @@ -921,35 +925,35 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { ordering = "CNS1"; supplement = 4; pWidthArray->AddInteger(1); - _InsertWidthArray1(pFont, pEncoding, 0x20, 0x7e, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0x20, 0x7e, pWidthArray); break; case FXFONT_GB2312_CHARSET: cmap = bVert ? "GBK-EUC-V" : "GBK-EUC-H"; ordering = "GB1", supplement = 2; pWidthArray->AddInteger(7716); - _InsertWidthArray1(pFont, pEncoding, 0x20, 0x20, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0x20, 0x20, pWidthArray); pWidthArray->AddInteger(814); - _InsertWidthArray1(pFont, pEncoding, 0x21, 0x7e, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0x21, 0x7e, pWidthArray); break; case FXFONT_HANGEUL_CHARSET: cmap = bVert ? "KSCms-UHC-V" : "KSCms-UHC-H"; ordering = "Korea1"; supplement = 2; pWidthArray->AddInteger(1); - _InsertWidthArray1(pFont, pEncoding, 0x20, 0x7e, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0x20, 0x7e, pWidthArray); break; case FXFONT_SHIFTJIS_CHARSET: cmap = bVert ? "90ms-RKSJ-V" : "90ms-RKSJ-H"; ordering = "Japan1"; supplement = 5; pWidthArray->AddInteger(231); - _InsertWidthArray1(pFont, pEncoding, 0x20, 0x7d, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0x20, 0x7d, pWidthArray); pWidthArray->AddInteger(326); - _InsertWidthArray1(pFont, pEncoding, 0xa0, 0xa0, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0xa0, 0xa0, pWidthArray); pWidthArray->AddInteger(327); - _InsertWidthArray1(pFont, pEncoding, 0xa1, 0xdf, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0xa1, 0xdf, pWidthArray); pWidthArray->AddInteger(631); - _InsertWidthArray1(pFont, pEncoding, 0x7e, 0x7e, pWidthArray); + _InsertWidthArray1(pFont, pEncoding.get(), 0x7e, 0x7e, pWidthArray); break; } pBaseDict->SetAtName("Subtype", "Type0"); @@ -1003,7 +1007,6 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) { } } } - delete pEncoding; pFontDesc->SetAtInteger("StemV", nStemV); AddIndirectObject(pFontDesc); pFontDict->SetAtReference("FontDescriptor", this, pFontDesc); |