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_type3font.h
Go to the documentation of this file.
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_FPDFAPI_FONT_CPDF_TYPE3FONT_H_
8#define CORE_FPDFAPI_FONT_CPDF_TYPE3FONT_H_
9
10#include <stdint.h>
11
12#include <map>
13#include <memory>
14
15#include "core/fpdfapi/font/cpdf_simplefont.h"
16#include "core/fxcrt/fx_coordinates.h"
17#include "core/fxcrt/retain_ptr.h"
18#include "core/fxcrt/unowned_ptr.h"
19
20class CPDF_Dictionary;
21class CPDF_Document;
22class CPDF_Type3Char;
23
24class CPDF_Type3Font final : public CPDF_SimpleFont {
25 public:
27 ~CPDF_Type3Font() override;
28
29 // CPDF_Font:
30 bool IsType3Font() const override;
31 const CPDF_Type3Font* AsType3Font() const override;
32 CPDF_Type3Font* AsType3Font() override;
33 void WillBeDestroyed() override;
34 int GetCharWidthF(uint32_t charcode) override;
35 FX_RECT GetCharBBox(uint32_t charcode) override;
36
37 void SetPageResources(CPDF_Dictionary* pResources) {
38 m_pPageResources.Reset(pResources);
39 }
40 CPDF_Type3Char* LoadChar(uint32_t charcode);
42
43 CFX_Matrix& GetFontMatrix() { return m_FontMatrix; }
44
45 private:
46 CPDF_Type3Font(CPDF_Document* pDocument,
47 RetainPtr<CPDF_Dictionary> pFontDict,
48 FormFactoryIface* pFormFactory);
49
50 // CPDF_Font:
51 bool Load() override;
52
53 // CPDF_SimpleFont:
54 void LoadGlyphMap() override;
55
56 // The depth char loading is in, to avoid recurive calling LoadChar().
57 int m_CharLoadingDepth = 0;
58 CFX_Matrix m_FontMatrix;
59 UnownedPtr<FormFactoryIface> const m_pFormFactory;
60 RetainPtr<CPDF_Dictionary> m_pCharProcs;
61 RetainPtr<CPDF_Dictionary> m_pPageResources;
62 RetainPtr<CPDF_Dictionary> m_pFontResources;
63 std::map<uint32_t, std::unique_ptr<CPDF_Type3Char>> m_CacheMap;
64 int m_CharWidthL[256] = {};
65};
66
67#endif // CORE_FPDFAPI_FONT_CPDF_TYPE3FONT_H_
FX_Charset m_Charset
bool KeyExist(const ByteString &key) const
int GetIntegerFor(const ByteString &key) const
RetainPtr< const CPDF_Stream > GetStreamFor(const ByteString &key) const
int GetIntegerFor(const ByteString &key, int default_int) const
static CPDF_FontGlobals * GetInstance()
virtual FX_RECT GetCharBBox(uint32_t charcode)=0
virtual bool IsTrueTypeFont() const
Definition cpdf_font.cpp:67
virtual const CPDF_CIDFont * AsCIDFont() const
int m_ItalicAngle
Definition cpdf_font.h:182
virtual void WillBeDestroyed()
int FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode)
void LoadFontDescriptor(const CPDF_Dictionary *pFontDesc)
virtual CPDF_CIDFont * AsCIDFont()
absl::optional< FX_Charset > GetSubstFontCharset() const
virtual bool IsType1Font() const
Definition cpdf_font.cpp:63
virtual bool IsVertWriting() const
CPDF_Font(CPDF_Document *pDocument, RetainPtr< CPDF_Dictionary > pFontDict)
Definition cpdf_font.cpp:52
~CPDF_Font() override
Definition cpdf_font.cpp:58
void LoadUnicodeMap() const
static RetainPtr< CPDF_Font > Create(CPDF_Document *pDoc, RetainPtr< CPDF_Dictionary > pFontDict, FormFactoryIface *pFactory)
virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const
virtual const CPDF_TrueTypeFont * AsTrueTypeFont() const
Definition cpdf_font.cpp:87
virtual const CPDF_Type1Font * AsType1Font() const
Definition cpdf_font.cpp:79
int m_Flags
Definition cpdf_font.h:178
virtual bool IsCIDFont() const
Definition cpdf_font.cpp:75
int m_StemV
Definition cpdf_font.h:179
virtual WideString UnicodeFromCharCode(uint32_t charcode) const
virtual const CPDF_Type3Font * AsType3Font() const
Definition cpdf_font.cpp:95
static RetainPtr< CPDF_Font > GetStockFont(CPDF_Document *pDoc, ByteStringView fontname)
static bool UseTTCharmap(const RetainPtr< CFX_Face > &face, int platform_id, int encoding_id)
virtual size_t CountChar(ByteStringView pString) const
void AppendChar(ByteString *str, uint32_t charcode) const
int GetStringWidth(ByteStringView pString)
virtual CPDF_Type1Font * AsType1Font()
Definition cpdf_font.cpp:83
virtual bool HasFontWidths() const
virtual bool IsType3Font() const
Definition cpdf_font.cpp:71
virtual CPDF_Type3Font * AsType3Font()
Definition cpdf_font.cpp:99
virtual CPDF_TrueTypeFont * AsTrueTypeFont()
Definition cpdf_font.cpp:91
FX_RECT m_FontBBox
Definition cpdf_font.h:183
int GetFontWeight() const
virtual int AppendChar(char *buf, uint32_t charcode) const
int m_Ascent
Definition cpdf_font.h:180
int m_Descent
Definition cpdf_font.h:181
virtual uint32_t GetNextChar(ByteStringView pString, size_t *pOffset) const
bool m_bToUnicodeLoaded
Definition cpdf_font.h:177
uint32_t FallbackFontFromCharcode(uint32_t charcode)
bool IsStandardFont() const
static FX_RECT GetCharBBoxForFace(const RetainPtr< CFX_Face > &face)
void CheckFontMetrics()
CFX_Font * GetFontFallback(int position)
size_t GetUnicodeCountByCharcodeForTesting(uint32_t charcode) const
uint32_t ReverseLookup(wchar_t unicode) const
CPDF_ToUnicodeMap(RetainPtr< const CPDF_Stream > pStream)
WideString Lookup(uint32_t charcode) const
bool IsBase14Font() const
CPDF_Type3Font * AsType3Font() override
void WillBeDestroyed() override
bool IsType3Font() const override
void SetPageResources(CPDF_Dictionary *pResources)
CPDF_Type3Char * LoadChar(uint32_t charcode)
void LoadGlyphMap() override
FX_RECT GetCharBBox(uint32_t charcode) override
~CPDF_Type3Font() override
CFX_Matrix & GetFontMatrix()
int GetCharWidthF(uint32_t charcode) override
const CPDF_Type3Font * AsType3Font() const override
bool Load() override
bool operator==(const ByteString &other) const
bool operator==(const char *ptr) const
CharType operator[](const size_t index) const
Definition widestring.h:146
bool IsEmpty() const
Definition widestring.h:118
const char * CharNameFromPredefinedCharSet(FontEncoding encoding, uint8_t charcode)
FontEncoding
#define FXFONT_USEEXTERNATTR
Definition fx_font.h:39
#define FXFONT_NONSYMBOLIC
Definition fx_font.h:32
#define FXFONT_FW_NORMAL
Definition fx_font.h:22
#define FXFONT_ITALIC
Definition fx_font.h:33
#define FXFT_Get_Glyph_Width(face)
Definition fx_freetype.h:58
#define FXFT_Get_Glyph_Height(face)
Definition fx_freetype.h:59
#define FXFT_Get_Glyph_HoriBearingX(face)
Definition fx_freetype.h:56
#define FXFT_Get_Glyph_HoriBearingY(face)
Definition fx_freetype.h:57
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:224
FX_RECT & operator=(const FX_RECT &that)=default
int32_t bottom
int32_t right
int32_t top
int32_t left