Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_bafontmap.h
Go to the documentation of this file.
1// Copyright 2014 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_FPDFDOC_CPDF_BAFONTMAP_H_
8#define CORE_FPDFDOC_CPDF_BAFONTMAP_H_
9
10#include <memory>
11#include <vector>
12
13#include "core/fpdfdoc/ipvt_fontmap.h"
14#include "core/fxcrt/fx_codepage.h"
15#include "core/fxcrt/retain_ptr.h"
16#include "core/fxcrt/unowned_ptr.h"
17
18class CPDF_Dictionary;
19class CPDF_Document;
20
21class CPDF_BAFontMap final : public IPVT_FontMap {
22 public:
24
26 RetainPtr<CPDF_Dictionary> pAnnotDict,
27 const ByteString& sAPType);
28 ~CPDF_BAFontMap() override;
29
30 // IPVT_FontMap:
31 RetainPtr<CPDF_Font> GetPDFFont(int32_t nFontIndex) override;
32 ByteString GetPDFFontAlias(int32_t nFontIndex) override;
33 int32_t GetWordFontIndex(uint16_t word,
34 FX_Charset nCharset,
35 int32_t nFontIndex) override;
36 int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override;
37 FX_Charset CharSetFromUnicode(uint16_t word, FX_Charset nOldCharset) override;
38
39 private:
40 struct Data {
41 Data();
42 ~Data();
43
45 RetainPtr<CPDF_Font> pFont;
46 ByteString sFontName;
47 };
48
49 struct Native {
50 FX_Charset nCharset;
51 ByteString sFontName;
52 };
53
54 RetainPtr<CPDF_Font> FindFontSameCharset(ByteString* sFontAlias,
55 FX_Charset nCharset);
56 RetainPtr<CPDF_Font> FindResFontSameCharset(const CPDF_Dictionary* pResDict,
57 ByteString* sFontAlias,
58 FX_Charset nCharset);
59 RetainPtr<CPDF_Font> GetAnnotDefaultFont(ByteString* sAlias);
60 void AddFontToAnnotDict(const RetainPtr<CPDF_Font>& pFont,
61 const ByteString& sAlias);
62
63 bool KnowWord(int32_t nFontIndex, uint16_t word);
64
65 int32_t GetFontIndex(const ByteString& sFontName,
66 FX_Charset nCharset,
67 bool bFind);
68 int32_t AddFontData(const RetainPtr<CPDF_Font>& pFont,
69 const ByteString& sFontAlias,
70 FX_Charset nCharset);
71
72 int32_t FindFont(const ByteString& sFontName, FX_Charset nCharset);
73 ByteString GetNativeFontName(FX_Charset nCharset);
74 ByteString GetCachedNativeFontName(FX_Charset nCharset);
75 RetainPtr<CPDF_Font> AddFontToDocument(ByteString sFontName,
76 FX_Charset nCharset);
77 RetainPtr<CPDF_Font> AddStandardFont(ByteString sFontName);
78 RetainPtr<CPDF_Font> AddSystemFont(ByteString sFontName, FX_Charset nCharset);
79
80 std::vector<std::unique_ptr<Data>> m_Data;
81 std::vector<std::unique_ptr<Native>> m_NativeFont;
82 UnownedPtr<CPDF_Document> const m_pDocument;
83 RetainPtr<CPDF_Dictionary> const m_pAnnotDict;
84 RetainPtr<CPDF_Font> m_pDefaultFont;
85 ByteString m_sDefaultFontName;
86 const ByteString m_sAPType;
87};
88
89#endif // CORE_FPDFDOC_CPDF_BAFONTMAP_H_
bool HasLocalizedFont(ByteStringView name) const
bool HasInstalledFont(ByteStringView name) const
static bool IsStandardFontName(const ByteString &name)
CFX_FontMapper * GetBuiltinMapper() const
Definition cfx_fontmgr.h:71
static ByteString GetDefaultFontNameByCharset(FX_Charset nCharset)
Definition cfx_font.cpp:103
static const char kDefaultAnsiFontName[]
Definition cfx_font.h:58
static const char kUniversalDefaultFontName[]
Definition cfx_font.h:59
static FX_Charset GetCharSetFromUnicode(uint16_t word)
Definition cfx_font.cpp:112
static CFX_GEModule * Get()
CFX_FontMgr * GetFontMgr() const
int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override
FX_Charset CharSetFromUnicode(uint16_t word, FX_Charset nOldCharset) override
RetainPtr< CPDF_Font > GetPDFFont(int32_t nFontIndex) override
~CPDF_BAFontMap() override
static FX_Charset GetNativeCharset()
CPDF_BAFontMap(CPDF_Document *pDocument, RetainPtr< CPDF_Dictionary > pAnnotDict, const ByteString &sAPType)
int32_t GetWordFontIndex(uint16_t word, FX_Charset nCharset, int32_t nFontIndex) override
ByteString GetPDFFontAlias(int32_t nFontIndex) override
CPDF_DefaultAppearance(const ByteString &csDA)
static CPDF_DocPageData * FromDocument(const CPDF_Document *pDoc)
CPDF_FontEncoding(FontEncoding predefined_encoding)
static RetainPtr< const CPDF_Object > GetFieldAttrForDict(const CPDF_Dictionary *pFieldDict, const ByteString &name)
static ByteString Format(const char *pFormat,...)
ByteString & operator+=(const ByteString &str)
bool operator==(const char *ptr) const
ByteString & operator=(ByteString &&that) noexcept
bool IsEmpty() const
Definition bytestring.h:119
FontEncoding
FX_CodePage FX_GetCodePageFromCharset(FX_Charset charset)
FX_Charset
Definition fx_codepage.h:70
FX_Charset FX_GetCharsetFromCodePage(FX_CodePage codepage)
FX_CodePage FX_GetACP()