summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-16 13:42:11 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-16 19:05:27 +0000
commit2c02faed1da2375a91c7f9c003beb606a0611074 (patch)
tree81529e4ecb5e30bcd7274ae91376776f928d6e7f /core/fpdfapi/render
parentabf240c57ff461f04a1766cce585cf54521e2170 (diff)
downloadpdfium-2c02faed1da2375a91c7f9c003beb606a0611074.tar.xz
Change FXTEXT_CHARPOS to use CFX_PointF
This CL updates the Origin x,y coordinates in FXTEXT_CHARPOS to be an CFX_PointF. Change-Id: I67281db2cb82687e12490145f7c99aee908e5fa8 Reviewed-on: https://pdfium-review.googlesource.com/2718 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_charposlist.cpp32
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp4
2 files changed, 20 insertions, 16 deletions
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index 64176fb054..639bdcf17b 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -32,10 +32,12 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes,
uint32_t CharCode = charCodes[iChar];
if (CharCode == static_cast<uint32_t>(-1))
continue;
+
bool bVert = false;
FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++];
if (pCIDFont)
charpos.m_bFontStyle = true;
+
charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert);
if (charpos.m_GlyphIndex != static_cast<uint32_t>(-1)) {
charpos.m_FallbackFontPosition = -1;
@@ -45,39 +47,41 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes,
charpos.m_GlyphIndex = pFont->FallbackGlyphFromCharcode(
charpos.m_FallbackFontPosition, CharCode);
}
+
// TODO(npm): Figure out how this affects m_ExtGID
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
charpos.m_ExtGID = pFont->GlyphFromCharCodeExt(CharCode);
#endif
- if (!pFont->IsEmbedded() && !pFont->IsCIDFont()) {
+ if (!pFont->IsEmbedded() && !pFont->IsCIDFont())
charpos.m_FontCharWidth = pFont->GetCharWidthF(CharCode);
- } else {
+ else
charpos.m_FontCharWidth = 0;
- }
- charpos.m_OriginX = iChar ? charPos[iChar - 1] : 0;
- charpos.m_OriginY = 0;
+
+ charpos.m_Origin = CFX_PointF(iChar ? charPos[iChar - 1] : 0, 0);
charpos.m_bGlyphAdjust = false;
- if (!pCIDFont) {
+ if (!pCIDFont)
continue;
- }
+
uint16_t CID = pCIDFont->CIDFromCharCode(CharCode);
if (bVertWriting) {
- charpos.m_OriginY = charpos.m_OriginX;
- charpos.m_OriginX = 0;
- short vx, vy;
+ charpos.m_Origin = CFX_PointF(0, charpos.m_Origin.x);
+
+ short vx;
+ short vy;
pCIDFont->GetVertOrigin(CID, vx, vy);
- charpos.m_OriginX -= FontSize * vx / 1000;
- charpos.m_OriginY -= FontSize * vy / 1000;
+ charpos.m_Origin.x -= FontSize * vx / 1000;
+ charpos.m_Origin.y -= FontSize * vy / 1000;
}
+
const uint8_t* pTransform = pCIDFont->GetCIDTransform(CID);
if (pTransform && !bVert) {
charpos.m_AdjustMatrix[0] = pCIDFont->CIDTransformToFloat(pTransform[0]);
charpos.m_AdjustMatrix[2] = pCIDFont->CIDTransformToFloat(pTransform[2]);
charpos.m_AdjustMatrix[1] = pCIDFont->CIDTransformToFloat(pTransform[1]);
charpos.m_AdjustMatrix[3] = pCIDFont->CIDTransformToFloat(pTransform[3]);
- charpos.m_OriginX +=
+ charpos.m_Origin.x +=
pCIDFont->CIDTransformToFloat(pTransform[4]) * FontSize;
- charpos.m_OriginY +=
+ charpos.m_Origin.y +=
pCIDFont->CIDTransformToFloat(pTransform[5]) * FontSize;
charpos.m_bGlyphAdjust = true;
}
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp
index 60b57600c2..fd44d42484 100644
--- a/core/fpdfapi/render/cpdf_renderstatus.cpp
+++ b/core/fpdfapi/render/cpdf_renderstatus.cpp
@@ -2001,8 +2001,8 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj,
charpos.m_AdjustMatrix[2], charpos.m_AdjustMatrix[3],
0, 0);
}
- matrix.Concat(CFX_Matrix(font_size, 0, 0, font_size, charpos.m_OriginX,
- charpos.m_OriginY));
+ matrix.Concat(CFX_Matrix(font_size, 0, 0, font_size, charpos.m_Origin.x,
+ charpos.m_Origin.y));
path.m_Path.Append(pPath, &matrix);
path.m_Matrix = *pTextMatrix;
path.m_bStroke = bStroke;