summaryrefslogtreecommitdiff
path: root/src/lib/font_config.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2022-06-02 12:52:59 +0200
committerCarl Hetherington <cth@carlh.net>2022-06-07 17:01:06 +0200
commit9a7b67aee32a40539f29bc2d7017edd4a4f65f11 (patch)
tree1aaf01ecd62cce4d89e2fa5c8c9db1e79d5e6f53 /src/lib/font_config.h
parentab03306fdc02e49b0a3d5b45f103d317ff6611e5 (diff)
Move fontconfig-related code out to a class.
Diffstat (limited to 'src/lib/font_config.h')
-rw-r--r--src/lib/font_config.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/lib/font_config.h b/src/lib/font_config.h
new file mode 100644
index 000000000..7527d9127
--- /dev/null
+++ b/src/lib/font_config.h
@@ -0,0 +1,44 @@
+/*
+ Copyright (C) 2014-2021 Carl Hetherington <cth@carlh.net>
+
+ This file is part of DCP-o-matic.
+
+ DCP-o-matic is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ DCP-o-matic is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include <fontconfig/fontconfig.h>
+#include <boost/filesystem.hpp>
+#include <map>
+#include <string>
+
+
+/** Wrapper for the fontconfig library */
+class FontConfig
+{
+public:
+ static FontConfig* instance();
+
+ std::string make_font_available(boost::filesystem::path font_file);
+
+private:
+ FontConfig();
+
+ FcConfig* _config = nullptr;
+ std::map<boost::filesystem::path, std::string> _available_fonts;
+
+ static FontConfig* _instance;
+};
+