summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/font')
-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
6 files changed, 13 insertions, 12 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;