Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page.cpp

Issue 1729823004: refactor CPDF_Font and subclasses (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_page/fpdf_page.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index d589d5809f5a758c404570028ab1d2361691bcae..f05c4bea92a1f8aa9c9ddcc80b155aaee1f3328d 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -71,17 +71,17 @@ void CPDF_TextObject::GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const {
return;
}
CPDF_Font* pFont = m_TextState.GetFont();
- if (pFont->GetFontType() != PDFFONT_CIDFONT) {
+ if (!pFont->IsCIDFont()) {
return;
}
- if (!((CPDF_CIDFont*)pFont)->IsVertWriting()) {
+ if (!pFont->AsCIDFont()->IsVertWriting()) {
return;
}
- FX_WORD CID = ((CPDF_CIDFont*)pFont)->CIDFromCharCode(pInfo->m_CharCode);
+ FX_WORD CID = pFont->AsCIDFont()->CIDFromCharCode(pInfo->m_CharCode);
pInfo->m_OriginY = pInfo->m_OriginX;
pInfo->m_OriginX = 0;
short vx, vy;
- ((CPDF_CIDFont*)pFont)->GetVertOrigin(CID, vx, vy);
+ pFont->AsCIDFont()->GetVertOrigin(CID, vx, vy);
FX_FLOAT fontsize = m_TextState.GetFontSize();
pInfo->m_OriginX -= fontsize * vx / 1000;
pInfo->m_OriginY -= fontsize * vy / 1000;
@@ -214,7 +214,7 @@ FX_FLOAT CPDF_TextObject::GetCharWidth(FX_DWORD charcode) const {
FX_FLOAT fontsize = m_TextState.GetFontSize() / 1000;
CPDF_Font* pFont = m_TextState.GetFont();
FX_BOOL bVertWriting = FALSE;
- CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
+ CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
}
@@ -236,7 +236,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
FX_FLOAT max_y = -10000 * 1.0f;
CPDF_Font* pFont = m_TextState.GetFont();
FX_BOOL bVertWriting = FALSE;
- CPDF_CIDFont* pCIDFont = pFont->GetCIDFont();
+ CPDF_CIDFont* pCIDFont = pFont->AsCIDFont();
if (pCIDFont) {
bVertWriting = pCIDFont->IsVertWriting();
}
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698