PoDoFo 1.2.0
Loading...
Searching...
No Matches
PdfFontConfigWrapper.h
1// SPDX-FileCopyrightText: 2011 Dominik Seichter <domseichter@web.de>
2// SPDX-FileCopyrightText: 2020 Francesco Pretto <ceztko@gmail.com>
3// SPDX-License-Identifier: LGPL-2.0-or-later OR MPL-2.0
4
5#ifndef PDF_FONT_CONFIG_WRAPPER_H
6#define PDF_FONT_CONFIG_WRAPPER_H
7
8#include "PdfDeclarations.h"
9
10FORWARD_DECLARE_FCONFIG();
11
12namespace PoDoFo {
13
15{
16 None = 0,
18};
19
20struct PODOFO_API PdfFontConfigSearchParams final
21{
22 nullable<PdfFontStyle> Style;
23 PdfFontConfigSearchFlags Flags = PdfFontConfigSearchFlags::None;
25 std::string FontFamilyPattern;
26};
27
39{
40public:
42 PdfFontConfigWrapper(const std::string_view& configStr);
43
45
46#ifdef PODOFO_3RDPARTY_INTEROP_ENABLED
49
51#endif // PODOFO_3RDPARTY_INTEROP_ENABLED
52
54
64 std::string SearchFontPath(const std::string_view fontPattern, unsigned& faceIndex);
65 std::string SearchFontPath(const std::string_view fontPattern, const PdfFontConfigSearchParams& params,
66 unsigned& faceIndex);
67
68 void AddFontDirectory(const std::string_view& path);
69
70private:
72 const PdfFontConfigWrapper& operator=(const PdfFontConfigWrapper& rhs) = delete;
73
74 void createDefaultConfig();
75
76private:
77 FcConfig* m_FcConfig;
78};
79
80};
81
82ENABLE_BITMASK_OPERATORS(PoDoFo::PdfFontConfigSearchFlags);
83
84#endif // PDF_FONT_CONFIG_WRAPPER_H
This file should be included as the FIRST file in every header of PoDoFo lib.
This class initializes and destroys the FontConfig library.
Definition PdfFontConfigWrapper.h:39
std::string SearchFontPath(const std::string_view fontPattern, unsigned &faceIndex)
Get the path of a font file on a Unix system using fontconfig.
PdfFontConfigWrapper(const std::string_view &configStr)
Create a new FontConfigWrapper from a XML config string.
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:30
All classes, functions, types and enums of PoDoFo are members of these namespace.
Definition basetypes.h:13
PdfFontConfigSearchFlags
Definition PdfFontConfigWrapper.h:15
@ None
Do not add a default appearance.
@ SkipMatchPostScriptName
Skip matching postscript font name.