PoDoFo 1.0.0-dev
Loading...
Searching...
No Matches
PdfFontMetricsObject.h
1
7#ifndef PDF_FONT_METRICS_OBJECT_H
8#define PDF_FONT_METRICS_OBJECT_H
9
10#include "PdfDeclarations.h"
11
12#include <array>
13
14#include "PdfFontMetrics.h"
15#include "PdfArray.h"
16#include "PdfName.h"
17#include "PdfString.h"
18
19
20namespace PoDoFo {
21
22class PODOFO_API PdfFontMetricsObject final : public PdfFontMetricsBase
23{
24private:
30 PdfFontMetricsObject(const PdfObject& font, const PdfObject* descriptor);
31
32public:
33 static std::unique_ptr<const PdfFontMetricsObject> Create(const PdfObject& font, const PdfObject* descriptor = nullptr);
34
35 bool HasUnicodeMapping() const override;
36
37 bool TryGetGID(char32_t codePoint, unsigned& gid) const override;
38
39 bool TryGetFlags(PdfFontDescriptorFlags& value) const override;
40
41 bool TryGetBoundingBox(Corners& value) const override;
42
43 bool TryGetItalicAngle(double& value) const override;
44
45 bool TryGetAscent(double& value) const override;
46
47 bool TryGetDescent(double& value) const override;
48
49 bool TryGetCapHeight(double& value) const override;
50
51 bool TryGetStemV(double& value) const override;
52
53 double GetDefaultWidthRaw() const override;
54
55 double GetLineSpacing() const override;
56
57 double GetUnderlineThickness() const override;
58
59 double GetUnderlinePosition() const override;
60
61 double GetStrikeThroughPosition() const override;
62
63 double GetStrikeThroughThickness() const override;
64
65 std::string_view GetFontName() const override;
66
67 std::string_view GetFontNameRaw() const override;
68
69 std::string_view GetFontFamilyName() const override;
70
71 unsigned char GetSubsetPrefixLength() const override;
72
73 PdfFontStretch GetFontStretch() const override;
74
75 double GetLeadingRaw() const override;
76
77 int GetWeightRaw() const override;
78
79 double GetXHeightRaw() const override;
80
81 double GetStemHRaw() const override;
82
83 double GetAvgWidthRaw() const override;
84
85 double GetMaxWidthRaw() const override;
86
87 PdfFontFileType GetFontFileType() const override;
88
89 const PdfObject* GetFontFileObject() const override;
90
91 unsigned GetFontFileLength1() const override;
92
93 unsigned GetFontFileLength2() const override;
94
95 unsigned GetFontFileLength3() const override;
96
97 const Matrix& GetMatrix() const override;
98
99 bool IsObjectLoaded() const override;
100
101protected:
102 std::string_view GetBaseFontName() const override;
103
104 bool getIsBoldHint() const override;
105
106 bool getIsItalicHint() const override;
107
108 datahandle getFontFileDataHandle() const override;
109
110 const PdfCIDToGIDMapConstPtr& getCIDToGIDMap() const override;
111
112private:
113 void processFontName();
114
115 Corners getBBox(const PdfObject& obj);
116
117 void tryLoadBuiltinTrueTypeCIDToGIDMap();
118
119private:
120 std::shared_ptr<charbuff> m_Data;
121 PdfCIDToGIDMapConstPtr m_CIDToGIDMap;
122 Matrix m_Matrix;
123
124 std::string m_FontName;
125 std::string m_FontNameRaw;
126 std::string m_FontBaseName;
127 std::string m_FontFamilyName;
128 unsigned char m_SubsetPrefixLength;
129 bool m_IsItalicHint;
130 bool m_IsBoldHint;
131 bool m_HasBBox;
132 PdfFontStretch m_FontStretch;
133 short m_Weight;
134
135 nullable<PdfFontDescriptorFlags> m_Flags;
136 Corners m_BBox;
137 double m_ItalicAngle;
138 double m_Ascent;
139 double m_Descent;
140 double m_Leading;
141 double m_CapHeight;
142 double m_XHeight;
143 double m_StemV;
144 double m_StemH;
145 double m_AvgWidth;
146 double m_MaxWidth;
147 double m_DefaultWidth;
148
149 const PdfObject* m_FontFileObject;
150 nullable<PdfFontFileType> m_FontFileType;
151
152 unsigned m_Length1;
153 unsigned m_Length2;
154 unsigned m_Length3;
155
156 double m_LineSpacing;
157 double m_UnderlineThickness;
158 double m_UnderlinePosition;
159 double m_StrikeThroughThickness;
160 double m_StrikeThroughPosition;
161};
162
163};
164
165#endif // PDF_FONT_METRICS_OBJECT_H
SPDX-FileCopyrightText: (C) 2005 Dominik Seichter domseichter@web.de SPDX-FileCopyrightText: (C) 2020...
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition basetypes.h:16
PdfFontFileType
Definition PdfDeclarations.h:296
@ Create
Create a new file or truncate existing one for writing/reading.