7#ifndef PDF_FONT_METRICS_FREETYPE_H
8#define PDF_FONT_METRICS_FREETYPE_H
12#include "PdfFontMetrics.h"
17struct PdfEncodingLimits;
19class PODOFO_API PdfFontMetricsFreetype final :
public PdfFontMetrics
21 friend class PdfFontMetrics;
24 ~PdfFontMetricsFreetype();
26 std::unique_ptr<PdfCMapEncoding> CreateToUnicodeMap(
const PdfEncodingLimits& limitHints)
const override;
28 bool HasUnicodeMapping()
const override;
30 bool TryGetGID(
char32_t codePoint,
unsigned& gid)
const override;
32 double GetDefaultWidthRaw()
const override;
34 double GetLineSpacing()
const override;
36 double GetUnderlineThickness()
const override;
38 double GetUnderlinePosition()
const override;
40 double GetStrikeThroughPosition()
const override;
42 double GetStrikeThroughThickness()
const override;
44 std::string_view GetFontName()
const override;
46 std::string_view GetFontFamilyName()
const override;
48 unsigned char GetSubsetPrefixLength()
const override;
50 PdfFontStretch GetFontStretch()
const override;
52 bool TryGetFlags(PdfFontDescriptorFlags& value)
const override;
54 bool TryGetBoundingBox(Corners& value)
const override;
56 bool TryGetItalicAngle(
double& value)
const override;
58 bool TryGetAscent(
double& value)
const override;
60 bool TryGetDescent(
double& value)
const override;
62 bool TryGetCapHeight(
double& value)
const override;
64 bool TryGetStemV(
double& value)
const override;
66 double GetLeadingRaw()
const override;
68 int GetWeightRaw()
const override;
70 double GetXHeightRaw()
const override;
72 double GetStemHRaw()
const override;
74 double GetAvgWidthRaw()
const override;
76 double GetMaxWidthRaw()
const override;
80 unsigned GetFontFileLength1()
const override;
82 unsigned GetFontFileLength2()
const override;
84 unsigned GetFontFileLength3()
const override;
86 const datahandle& GetFontFileDataHandle()
const override;
88 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;
101 const PdfCIDToGIDMapConstPtr& getCIDToGIDMap()
const override;
104 PdfFontMetricsFreetype(FT_Face face,
const datahandle& data,
const PdfFontMetrics* refMetrics =
nullptr);
106 void init(
const PdfFontMetrics* refMetrics);
108 void ensureLengthsReady();
110 void initType1Lengths(
const bufferview& view);
112 bool tryBuildFallbackUnicodeMap();
117 PdfCIDToGIDMapConstPtr m_CIDToGIDMap;
120 unsigned char m_SubsetPrefixLength;
121 bool m_HasUnicodeMapping;
122 std::unique_ptr<std::unordered_map<uint32_t, unsigned>> m_fallbackUnicodeMap;
124 std::string m_FontBaseName;
125 std::string m_FontName;
126 std::string m_FontFamilyName;
131 double m_ItalicAngle;
138 PdfFontStretch m_FontStretch;
145 double m_DefaultWidth;
148 double m_LineSpacing;
149 double m_UnderlineThickness;
150 double m_UnderlinePosition;
151 double m_StrikeThroughThickness;
152 double m_StrikeThroughPosition;
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
PdfFontDescriptorFlags
Enum for the font descriptor flags.
Definition PdfDeclarations.h:252