diff options
author | Nicolas Pena <npm@chromium.org> | 2017-05-26 14:38:03 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-26 18:52:27 +0000 |
commit | 169b30187bf5798a6106b5ab16288c9d86861f8b (patch) | |
tree | 19aa282b55c43eda4f8ebf1a8fd70acf6296aad0 /core/fpdfapi/font/cpdf_cmapparser.h | |
parent | f677e18c985646c4ae1c5ec36445cdbf6bf78a6a (diff) | |
download | pdfium-169b30187bf5798a6106b5ab16288c9d86861f8b.tar.xz |
Use proper file names in core/fpdfapi/font
This CL splits up font_int.h into files by classes. It also renames the
unittests to match the class being tested. Finally, it renames the ttgsubtable
files to match the class name.
Change-Id: I6187caa9e82d12b9a66e955113fe327d52042ae0
Reviewed-on: https://pdfium-review.googlesource.com/6090
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/font/cpdf_cmapparser.h')
-rw-r--r-- | core/fpdfapi/font/cpdf_cmapparser.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/core/fpdfapi/font/cpdf_cmapparser.h b/core/fpdfapi/font/cpdf_cmapparser.h new file mode 100644 index 0000000000..184ef75043 --- /dev/null +++ b/core/fpdfapi/font/cpdf_cmapparser.h @@ -0,0 +1,52 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_FONT_CPDF_CMAPPARSER_H_ +#define CORE_FPDFAPI_FONT_CPDF_CMAPPARSER_H_ + +#include <map> +#include <utility> +#include <vector> + +#include "core/fpdfapi/font/cpdf_cidfont.h" +#include "core/fpdfapi/font/cpdf_cmap.h" +#include "core/fxcrt/cfx_unowned_ptr.h" +#include "core/fxcrt/fx_basic.h" + +class CPDF_CMapParser { + public: + explicit CPDF_CMapParser(CPDF_CMap* pMap); + ~CPDF_CMapParser(); + + void ParseWord(const CFX_ByteStringC& str); + bool HasAdditionalMappings() const { + return !m_AdditionalCharcodeToCIDMappings.empty(); + } + std::vector<CPDF_CMap::CIDRange> TakeAdditionalMappings() { + return std::move(m_AdditionalCharcodeToCIDMappings); + } + + static CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering); + + private: + friend class cpdf_cmapparser_CMap_GetCode_Test; + friend class cpdf_cmapparser_CMap_GetCodeRange_Test; + + static uint32_t CMap_GetCode(const CFX_ByteStringC& word); + static bool CMap_GetCodeRange(CPDF_CMap::CodeRange& range, + const CFX_ByteStringC& first, + const CFX_ByteStringC& second); + + CFX_UnownedPtr<CPDF_CMap> const m_pCMap; + int m_Status; + int m_CodeSeq; + uint32_t m_CodePoints[4]; + std::vector<CPDF_CMap::CodeRange> m_CodeRanges; + std::vector<CPDF_CMap::CIDRange> m_AdditionalCharcodeToCIDMappings; + CFX_ByteString m_LastWord; +}; + +#endif // CORE_FPDFAPI_FONT_CPDF_CMAPPARSER_H_ |