From 2334660053e044ca79a1831a6c73f69891f039e0 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Tue, 30 Jan 2018 21:42:41 +0000 Subject: Use unsigned for char width MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: 806612 Change-Id: I22bd9046dd37a1b596762c46a6b29a323d6e9fa1 Reviewed-on: https://pdfium-review.googlesource.com/24410 Reviewed-by: dsinclair Commit-Queue: Nicolás Peña Moreno --- core/fpdfapi/render/cpdf_charposlist.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'core/fpdfapi/render') diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp index c0c700c0ca..ddb215c48b 100644 --- a/core/fpdfapi/render/cpdf_charposlist.cpp +++ b/core/fpdfapi/render/cpdf_charposlist.cpp @@ -69,8 +69,8 @@ void CPDF_CharPosList::Load(const std::vector& charCodes, float scalingFactor = 1.0f; if (!pFont->IsEmbedded() && pFont->HasFontWidths() && !bVertWriting && !pCurrentFont->GetSubstFont()->m_bFlagMM) { - int pdfGlyphWidth = pFont->GetCharWidthF(CharCode); - int ftGlyphWidth = + uint32_t pdfGlyphWidth = pFont->GetCharWidthF(CharCode); + uint32_t ftGlyphWidth = pCurrentFont ? pCurrentFont->GetGlyphWidth(charpos.m_GlyphIndex) : 0; if (ftGlyphWidth && pdfGlyphWidth > ftGlyphWidth + 1) { // Move the initial x position by half of the excess (transformed to @@ -80,7 +80,6 @@ void CPDF_CharPosList::Load(const std::vector& charCodes, } else if (pdfGlyphWidth && ftGlyphWidth && pdfGlyphWidth < ftGlyphWidth) { scalingFactor = static_cast(pdfGlyphWidth) / ftGlyphWidth; - ASSERT(scalingFactor >= 0.0f); charpos.m_AdjustMatrix[0] = scalingFactor; charpos.m_AdjustMatrix[1] = 0.0f; charpos.m_AdjustMatrix[2] = 0.0f; -- cgit v1.2.3