summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp5
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp8
-rw-r--r--core/fpdfapi/font/cpdf_font.h2
3 files changed, 5 insertions, 10 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 14e4ed32c5..e431b9bf57 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -279,9 +279,8 @@ void CPDF_PageContentGenerator::ProcessText(CFX_ByteTextBuf* buf,
<< " Tf ";
CFX_ByteString text;
for (uint32_t charcode : pTextObj->m_CharCodes) {
- if (charcode == CPDF_Font::kInvalidCharCode)
- continue;
- pFont->AppendChar(text, charcode);
+ if (charcode != CPDF_Font::kInvalidCharCode)
+ pFont->AppendChar(&text, charcode);
}
*buf << PDF_EncodeString(text, true) << " Tj ET\n";
}
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 60eb1b361d..a6a661b328 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -136,14 +136,10 @@ int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const {
return 1;
}
-void CPDF_Font::AppendChar(CFX_ByteString& str, uint32_t charcode) const {
+void CPDF_Font::AppendChar(CFX_ByteString* str, uint32_t charcode) const {
char buf[4];
int len = AppendChar(buf, charcode);
- if (len == 1) {
- str += buf[0];
- } else {
- str += CFX_ByteString(buf, len);
- }
+ *str += CFX_ByteStringC(buf, len);
}
CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index 8ef68e6031..de29db6e13 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -66,7 +66,7 @@ class CPDF_Font {
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
bool IsStandardFont() const;
FXFT_Face GetFace() const { return m_Font.GetFace(); }
- void AppendChar(CFX_ByteString& str, uint32_t charcode) const;
+ void AppendChar(CFX_ByteString* str, uint32_t charcode) const;
void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
int GetTypeAscent() const { return m_Ascent; }