xref: /aosp_15_r20/external/pdfium/core/fxge/cfx_unicodeencodingex.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXGE_CFX_UNICODEENCODINGEX_H_
8 #define CORE_FXGE_CFX_UNICODEENCODINGEX_H_
9 
10 #include <stdint.h>
11 
12 #include <memory>
13 
14 #include "core/fxge/cfx_unicodeencoding.h"
15 
16 class CFX_UnicodeEncodingEx final : public CFX_UnicodeEncoding {
17  public:
18   static constexpr uint32_t kInvalidCharCode = static_cast<uint32_t>(-1);
19 
20   CFX_UnicodeEncodingEx(CFX_Font* pFont, uint32_t EncodingID);
21   ~CFX_UnicodeEncodingEx() override;
22 
23   // CFX_UnicodeEncoding:
24   uint32_t GlyphFromCharCode(uint32_t charcode) override;
25 
26   // Returns |kInvalidCharCode| on error.
27   uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
28 
29  private:
30   uint32_t m_nEncodingID;
31 };
32 
33 std::unique_ptr<CFX_UnicodeEncodingEx> FX_CreateFontEncodingEx(CFX_Font* pFont);
34 
35 #endif  // CORE_FXGE_CFX_UNICODEENCODINGEX_H_
36