summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.h2
-rw-r--r--core/fpdfapi/font/cpdf_cmap.cpp5
-rw-r--r--core/fpdfapi/font/cpdf_cmap.h2
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp10
-rw-r--r--core/fpdfapi/font/cpdf_font.h2
-rw-r--r--core/fpdfapi/page/cpdf_textobject.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.cpp2
8 files changed, 15 insertions, 14 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index b25b728ce0..b73e0b8c56 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -736,8 +736,8 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
}
uint32_t CPDF_CIDFont::GetNextChar(const ByteStringView& pString,
- size_t& offset) const {
- return m_pCMap->GetNextChar(pString, offset);
+ size_t* pOffset) const {
+ return m_pCMap->GetNextChar(pString, pOffset);
}
int CPDF_CIDFont::GetCharSize(uint32_t charcode) const {
diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h
index 43c1184969..ab074fb6f0 100644
--- a/core/fpdfapi/font/cpdf_cidfont.h
+++ b/core/fpdfapi/font/cpdf_cidfont.h
@@ -47,7 +47,7 @@ class CPDF_CIDFont : public CPDF_Font {
uint32_t GetCharWidthF(uint32_t charcode) override;
FX_RECT GetCharBBox(uint32_t charcode) override;
uint32_t GetNextChar(const ByteStringView& pString,
- size_t& offset) const override;
+ size_t* pOffset) const override;
size_t CountChar(const ByteStringView& pString) const override;
int AppendChar(char* str, uint32_t charcode) const override;
bool IsVertWriting() const override;
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index f3ef829e20..ee8f264869 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -338,7 +338,8 @@ uint16_t CPDF_CMap::CIDFromCharCode(uint32_t charcode) const {
}
uint32_t CPDF_CMap::GetNextChar(const ByteStringView& pString,
- size_t& offset) const {
+ size_t* pOffset) const {
+ size_t& offset = *pOffset;
auto pBytes = pString.span();
switch (m_CodingScheme) {
case OneByte: {
@@ -422,7 +423,7 @@ size_t CPDF_CMap::CountChar(const ByteStringView& pString) const {
size_t count = 0;
size_t offset = 0;
while (offset < pString.GetLength()) {
- GetNextChar(pString, offset);
+ GetNextChar(pString, &offset);
count++;
}
return count;
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index 781f0f9439..b3c09d520f 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -62,7 +62,7 @@ class CPDF_CMap : public Retainable {
uint16_t CIDFromCharCode(uint32_t charcode) const;
int GetCharSize(uint32_t charcode) const;
- uint32_t GetNextChar(const ByteStringView& pString, size_t& offset) const;
+ uint32_t GetNextChar(const ByteStringView& pString, size_t* pOffset) const;
size_t CountChar(const ByteStringView& pString) const;
int AppendChar(char* str, uint32_t charcode) const;
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index a243ceb334..f75f696035 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -275,7 +275,7 @@ uint32_t CPDF_Font::GetStringWidth(const ByteStringView& pString) {
size_t offset = 0;
uint32_t width = 0;
while (offset < pString.GetLength())
- width += GetCharWidthF(GetNextChar(pString, offset));
+ width += GetCharWidthF(GetNextChar(pString, &offset));
return width;
}
@@ -330,13 +330,13 @@ std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc,
}
uint32_t CPDF_Font::GetNextChar(const ByteStringView& pString,
- size_t& offset) const {
+ size_t* pOffset) const {
if (pString.IsEmpty())
return 0;
- uint8_t ch = offset < pString.GetLength() ? pString[offset++]
- : pString[pString.GetLength() - 1];
- return static_cast<uint32_t>(ch);
+ size_t& offset = *pOffset;
+ return offset < pString.GetLength() ? pString[offset++]
+ : pString[pString.GetLength() - 1];
}
bool CPDF_Font::IsStandardFont() const {
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 0174a67ef8..f5d0bacfba 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -54,7 +54,7 @@ class CPDF_Font {
virtual bool IsVertWriting() const;
virtual bool IsUnicodeCompatible() const;
virtual uint32_t GetNextChar(const ByteStringView& pString,
- size_t& offset) const;
+ size_t* pOffset) const;
virtual size_t CountChar(const ByteStringView& pString) const;
virtual int AppendChar(char* buf, uint32_t charcode) const;
virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index 9da96f54f7..84428fee81 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -165,7 +165,7 @@ void CPDF_TextObject::SetSegments(const ByteString* pStrs,
size_t offset = 0;
while (offset < segment.GetLength()) {
ASSERT(index < m_CharCodes.size());
- m_CharCodes[index++] = pFont->GetNextChar(segment, offset);
+ m_CharCodes[index++] = pFont->GetNextChar(segment, &offset);
}
if (i != nSegs - 1) {
m_CharPos[index - 1] = kernings[i];
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 7aeddf0a61..dd25d03f7b 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -94,7 +94,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
positions.resize(nChars - 1);
float cur_pos = 0;
for (int i = 0; i < nChars; i++) {
- codes[i] = pFont->GetNextChar(str.AsStringView(), offset);
+ codes[i] = pFont->GetNextChar(str.AsStringView(), &offset);
if (i)
positions[i - 1] = cur_pos;
cur_pos += pFont->GetCharWidthF(codes[i]) * font_size / 1000;