5#ifndef PDF_FONT_METRICS_FREETYPE_H
6#define PDF_FONT_METRICS_FREETYPE_H
10#include "PdfFontMetrics.h"
15struct PdfEncodingLimits;
17class PODOFO_API PdfFontMetricsFreetype final :
public PdfFontMetrics
19 friend class PdfFontMetrics;
22 ~PdfFontMetricsFreetype();
24 std::unique_ptr<PdfCMapEncoding> CreateToUnicodeMap(
const PdfEncodingLimits& limitHints)
const override;
26 bool HasUnicodeMapping()
const override;
28 bool TryGetGID(
char32_t codePoint,
unsigned& gid)
const override;
30 double GetDefaultWidthRaw()
const override;
32 double GetLineSpacing()
const override;
34 double GetUnderlineThickness()
const override;
36 double GetUnderlinePosition()
const override;
38 double GetStrikeThroughPosition()
const override;
40 double GetStrikeThroughThickness()
const override;
42 std::string_view GetFontName()
const override;
44 std::string_view GetFontFamilyName()
const override;
46 unsigned char GetSubsetPrefixLength()
const override;
48 PdfFontStretch GetFontStretch()
const override;
50 bool TryGetFlags(PdfFontDescriptorFlags& value)
const override;
52 bool TryGetBoundingBox(Corners& value)
const override;
54 bool TryGetItalicAngle(
double& value)
const override;
56 bool TryGetAscent(
double& value)
const override;
58 bool TryGetDescent(
double& value)
const override;
60 bool TryGetCapHeight(
double& value)
const override;
62 bool TryGetStemV(
double& value)
const override;
64 double GetLeadingRaw()
const override;
66 int GetWeightRaw()
const override;
68 double GetXHeightRaw()
const override;
70 double GetStemHRaw()
const override;
72 double GetAvgWidthRaw()
const override;
74 double GetMaxWidthRaw()
const override;
78 unsigned GetFontFileLength1()
const override;
80 unsigned GetFontFileLength2()
const override;
82 unsigned GetFontFileLength3()
const override;
84 const datahandle& GetFontFileDataHandle()
const override;
86#ifdef PODOFO_3RDPARTY_INTEROP_ENABLED
87 FT_Face GetFaceHandle()
const override;
91 std::string_view GetBaseFontName()
const override;
93 unsigned GetGlyphCountFontProgram()
const override;
95 bool TryGetGlyphWidthFontProgram(
unsigned gid,
double& width)
const override;
97 bool getIsBoldHint()
const override;
99 bool getIsItalicHint()
const override;
102 PdfFontMetricsFreetype(FT_Face face,
const datahandle& data,
const PdfFontMetrics* refMetrics =
nullptr);
104 void init(
const PdfFontMetrics* refMetrics);
106 void ensureLengthsReady();
108 void initType1Lengths(
const bufferview& view);
110 bool tryBuildFallbackUnicodeMap();
117 unsigned char m_SubsetPrefixLength;
118 bool m_HasUnicodeMapping;
119 std::unique_ptr<std::unordered_map<uint32_t, unsigned>> m_fallbackUnicodeMap;
121 std::string m_FontBaseName;
122 std::string m_FontName;
123 std::string m_FontFamilyName;
128 double m_ItalicAngle;
135 PdfFontStretch m_FontStretch;
142 double m_DefaultWidth;
145 double m_LineSpacing;
146 double m_UnderlineThickness;
147 double m_UnderlinePosition;
148 double m_StrikeThroughThickness;
149 double m_StrikeThroughPosition;
This file should be included as the FIRST file in every header of PoDoFo lib.
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
PdfFontFileType
Definition PdfDeclarations.h:276
PdfFontDescriptorFlags
Enum for the font descriptor flags.
Definition PdfDeclarations.h:233