diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-15 12:22:48 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-15 16:48:44 +0000 |
commit | 42059a389449665cdd4056648f9551103bb9c72e (patch) | |
tree | 5b0fc3d3df02b3e6b380783911727c48e277a2ae /core/fpdfapi/font | |
parent | 2b63ae28236f71e4df9c26b66cfca2905ceec512 (diff) | |
download | pdfium-42059a389449665cdd4056648f9551103bb9c72e.tar.xz |
Cleanup nits from prior CLs
Change-Id: Ie69dfc32e7b526eca2ac6ae621eed879ad98476e
Reviewed-on: https://pdfium-review.googlesource.com/3054
Commit-Queue: dsinclair <dsinclair@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r-- | core/fpdfapi/font/cpdf_type3font.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp index 10a116ab46..b9a05a0588 100644 --- a/core/fpdfapi/font/cpdf_type3font.cpp +++ b/core/fpdfapi/font/cpdf_type3font.cpp @@ -44,22 +44,29 @@ CPDF_Type3Font* CPDF_Type3Font::AsType3Font() { bool CPDF_Type3Font::Load() { m_pFontResources = m_pFontDict->GetDictFor("Resources"); CPDF_Array* pMatrix = m_pFontDict->GetArrayFor("FontMatrix"); - float xscale = 1.0f, yscale = 1.0f; + float xscale = 1.0f; + float yscale = 1.0f; if (pMatrix) { m_FontMatrix = pMatrix->GetMatrix(); xscale = m_FontMatrix.a; yscale = m_FontMatrix.d; } + CPDF_Array* pBBox = m_pFontDict->GetArrayFor("FontBBox"); if (pBBox) { - m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000); - m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000); - m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000); - m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000); + m_FontBBox.left = + static_cast<int32_t>(pBBox->GetNumberAt(0) * xscale * 1000); + m_FontBBox.bottom = + static_cast<int32_t>(pBBox->GetNumberAt(1) * yscale * 1000); + m_FontBBox.right = + static_cast<int32_t>(pBBox->GetNumberAt(2) * xscale * 1000); + m_FontBBox.top = + static_cast<int32_t>(pBBox->GetNumberAt(3) * yscale * 1000); } + int StartChar = m_pFontDict->GetIntegerFor("FirstChar"); CPDF_Array* pWidthArray = m_pFontDict->GetArrayFor("Widths"); - if (pWidthArray && (StartChar >= 0 && StartChar < 256)) { + if (pWidthArray && StartChar >= 0 && StartChar < 256) { size_t count = pWidthArray->GetCount(); if (count > 256) count = 256; @@ -113,11 +120,12 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode) { return it->second.get(); float scale = m_FontMatrix.GetXUnit(); - pNewChar->m_Width = (int32_t)(pNewChar->m_Width * scale + 0.5f); + pNewChar->m_Width = static_cast<int32_t>(pNewChar->m_Width * scale + 0.5f); FX_RECT& rcBBox = pNewChar->m_BBox; - CFX_FloatRect char_rect( - (float)rcBBox.left / 1000.0f, (float)rcBBox.bottom / 1000.0f, - (float)rcBBox.right / 1000.0f, (float)rcBBox.top / 1000.0f); + CFX_FloatRect char_rect(static_cast<float>(rcBBox.left) / 1000.0f, + static_cast<float>(rcBBox.bottom) / 1000.0f, + static_cast<float>(rcBBox.right) / 1000.0f, + static_cast<float>(rcBBox.top) / 1000.0f); if (rcBBox.right <= rcBBox.left || rcBBox.bottom >= rcBBox.top) char_rect = pNewChar->m_pForm->CalcBoundingBox(); |