PoDoFo 1.0.0-dev
Loading...
Searching...
No Matches
PdfFontMetricsStandard14.h
1
7#ifndef PDF_FONT_METRICS_STANDARD14_H
8#define PDF_FONT_METRICS_STANDARD14_H
9
10#include "PdfDeclarations.h"
11
12#include "PdfFontMetrics.h"
13#include <podofo/auxiliary/Rect.h>
14
15namespace PoDoFo {
16
17struct Standard14FontData;
18
22class PODOFO_API PdfFontMetricsStandard14 final : public PdfFontMetricsBase
23{
24 friend class PdfFont;
25private:
26 PdfFontMetricsStandard14(PdfStandard14FontType fontType,
28 GlyphMetricsListConstPtr parsedWidths = { });
29
30public:
34 static std::unique_ptr<const PdfFontMetricsStandard14> Create(
35 PdfStandard14FontType fontType);
36 static std::unique_ptr<const PdfFontMetricsStandard14> Create(
37 PdfStandard14FontType fontType, const PdfObject& fontObj);
38
39private:
40 static std::unique_ptr<const PdfFontMetricsStandard14> Create(
41 PdfStandard14FontType fontType, GlyphMetricsListConstPtr&& parsedWidths);
42
43public:
44 bool HasUnicodeMapping() const override;
45
46 bool TryGetGID(char32_t codePoint, unsigned& gid) const override;
47
48 bool TryGetFlags(PdfFontDescriptorFlags& value) const override;
49
50 bool TryGetBoundingBox(Corners& value) const override;
51
52 bool TryGetItalicAngle(double& value) const override;
53
54 bool TryGetAscent(double& value) const override;
55
56 bool TryGetDescent(double& value) const override;
57
58 bool TryGetCapHeight(double& value) const override;
59
60 bool TryGetStemV(double& value) const override;
61
62 double GetDefaultWidthRaw() const override;
63
64 double GetLineSpacing() const override;
65
66 double GetUnderlineThickness() const override;
67
68 double GetUnderlinePosition() const override;
69
70 double GetStrikeThroughPosition() const override;
71
72 double GetStrikeThroughThickness() const override;
73
74 std::string_view GetFontName() const override;
75
76 std::string_view GetFontFamilyName() const override;
77
78 PdfFontStretch GetFontStretch() const override;
79
80 int GetWeightRaw() const override;
81
82 double GetLeadingRaw() const override;
83
84 double GetXHeightRaw() const override;
85
86 double GetStemHRaw() const override;
87
88 double GetAvgWidthRaw() const override;
89
90 double GetMaxWidthRaw() const override;
91
92 PdfFontFileType GetFontFileType() const override;
93
94 bool IsStandard14FontMetrics(PdfStandard14FontType& std14Font) const override;
95
96 unsigned GetFontFileLength1() const override;
97
98 unsigned GetFontFileLength2() const override;
99
100 unsigned GetFontFileLength3() const override;
101
102 inline const Standard14FontData& GetRawData() const { return m_data; }
103
104protected:
105 std::string_view GetBaseFontName() const override;
106
107 unsigned GetGlyphCountFontProgram() const override;
108
109 bool TryGetGlyphWidthFontProgram(unsigned gid, double& width) const override;
110
111 bool getIsItalicHint() const override;
112
113 bool getIsBoldHint() const override;
114
115 datahandle getFontFileDataHandle() const override;
116
117private:
118 static std::unique_ptr<PdfFontMetricsStandard14> create(
119 PdfStandard14FontType fontType, const PdfObject* fontObj = nullptr);
120
121public:
122 static std::shared_ptr<const PdfFontMetricsStandard14> GetInstance(PdfStandard14FontType std14Font);
123
124private:
125 PdfStandard14FontType m_Std14FontType;
126 const Standard14FontData& m_data;
127
128 double m_Ascent;
129 double m_Descent;
130
131 double m_LineSpacing;
132 double m_UnderlineThickness;
133 double m_UnderlinePosition;
134 double m_StrikeThroughThickness;
135 double m_StrikeThroughPosition;
136};
137
138}
139
140#endif // PDF_FONT_METRICS_STANDARD14_H
SPDX-FileCopyrightText: (C) 2005 Dominik Seichter domseichter@web.de SPDX-FileCopyrightText: (C) 2020...
An unoriented rectangle defined by 2 points.
Definition Corners.h:20
This is the main class to handle the Standard14 metric data.
Definition PdfFontMetricsStandard14.h:23
Before you can draw text on a PDF document, you have to create a font object first.
Definition PdfFont.h:45
This class represents a PDF indirect Object in memory.
Definition PdfObject.h:35
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:38
A const data provider that can hold a view to a static segments or a shared buffer.
Definition basetypes.h:144
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.
PdfFontDescriptorFlags
Enum for the font descriptor flags.
Definition PdfDeclarations.h:252