PoDoFo  1.0.0-dev
PdfFontConfigWrapper.h
1 
7 #ifndef PDF_FONT_CONFIG_WRAPPER_H
8 #define PDF_FONT_CONFIG_WRAPPER_H
9 
10 #include "PdfDeclarations.h"
11 
12 FORWARD_DECLARE_FCONFIG();
13 
14 namespace PoDoFo {
15 
16 enum class PdfFontConfigSearchFlags : uint8_t
17 {
18  None = 0,
20 };
21 
22 struct PODOFO_API PdfFontConfigSearchParams final
23 {
24  nullable<PdfFontStyle> Style;
25  PdfFontConfigSearchFlags Flags = PdfFontConfigSearchFlags::None;
27  std::string FontFamilyPattern;
28 };
29 
42 class PODOFO_API PdfFontConfigWrapper final
43 {
44 public:
48  PdfFontConfigWrapper(const std::string_view& configStr);
49 
53  PdfFontConfigWrapper(FcConfig* fcConfig = nullptr);
54 
56 
68  std::string SearchFontPath(const std::string_view fontPattern, unsigned& faceIndex);
69  std::string SearchFontPath(const std::string_view fontPattern, const PdfFontConfigSearchParams& params,
70  unsigned& faceIndex);
71 
72  void AddFontDirectory(const std::string_view& path);
73 
74  FcConfig* GetFcConfig();
75 
76 private:
77  PdfFontConfigWrapper(const PdfFontConfigWrapper& rhs) = delete;
78  const PdfFontConfigWrapper& operator=(const PdfFontConfigWrapper& rhs) = delete;
79 
80  void createDefaultConfig();
81 
82 private:
83  FcConfig* m_FcConfig;
84 };
85 
86 };
87 
88 ENABLE_BITMASK_OPERATORS(PoDoFo::PdfFontConfigSearchFlags);
89 
90 #endif // PDF_FONT_CONFIG_WRAPPER_H
SPDX-FileCopyrightText: (C) 2005 Dominik Seichter domseichter@web.de SPDX-FileCopyrightText: (C) 2020...
This class initializes and destroys the FontConfig library.
Definition: PdfFontConfigWrapper.h:43
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.
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition: basetypes.h:16
@ None
Do not add a default appearrance.
PdfFontConfigSearchFlags
Definition: PdfFontConfigWrapper.h:17
@ SkipMatchPostScriptName
Skip matching postscript font name.