diff options
Diffstat (limited to 'core/fpdfapi/font/cpdf_cmapparser.cpp')
-rw-r--r-- | core/fpdfapi/font/cpdf_cmapparser.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp index a88448c5bd..5bfe17b34f 100644 --- a/core/fpdfapi/font/cpdf_cmapparser.cpp +++ b/core/fpdfapi/font/cpdf_cmapparser.cpp @@ -109,14 +109,17 @@ void CPDF_CMapParser::ParseWord(const ByteStringView& word) { m_Status = 0; } else if (m_Status == 7) { if (word == "endcodespacerange") { - size_t nSegs = m_CodeRanges.size(); + auto code_ranges = m_pCMap->GetMixedFourByteLeadingRanges(); + size_t nSegs = code_ranges.size(); if (nSegs == 1) { - m_pCMap->SetCodingScheme((m_CodeRanges[0].m_CharSize == 2) + m_pCMap->SetCodingScheme((code_ranges[0].m_CharSize == 2) ? CPDF_CMap::TwoBytes : CPDF_CMap::OneByte); } else if (nSegs > 1) { m_pCMap->SetCodingScheme(CPDF_CMap::MixedFourBytes); - m_pCMap->SetMixedFourByteLeadingRanges(m_CodeRanges); + for (auto range : m_PendingRanges) + m_pCMap->AppendMixedFourByteLeadingRanges(range); + m_PendingRanges.clear(); } m_Status = 0; } else { @@ -126,7 +129,7 @@ void CPDF_CMapParser::ParseWord(const ByteStringView& word) { if (m_CodeSeq % 2) { CPDF_CMap::CodeRange range; if (GetCodeRange(range, m_LastWord.AsStringView(), word)) - m_CodeRanges.push_back(range); + m_PendingRanges.push_back(range); } m_CodeSeq++; } |