From 75444920325ba8a134eb16c4844f7fa15f34dd55 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Fri, 20 Oct 2017 22:59:35 +0200 Subject: Add preference to load additional fonts from 'fonts' directories - 'use_fontsdir_system' for /share/inkscape/fonts - 'use_fontsdir_user' for /inkscape/fonts in user config (both activated by default) --- src/inkscape.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/inkscape.cpp') diff --git a/src/inkscape.cpp b/src/inkscape.cpp index c6c43272c..0c3763c2b 100644 --- a/src/inkscape.cpp +++ b/src/inkscape.cpp @@ -47,6 +47,7 @@ #include "inkscape.h" #include "io/sys.h" #include "io/resource.h" +#include "libnrtype/FontFactory.h" #include "message-stack.h" #include "path-prefix.h" #include "resource-manager.h" @@ -429,6 +430,7 @@ Application::Application(const char* argv, bool use_gui) : _trackalt(FALSE), _use_gui(use_gui) { + using namespace Inkscape::IO::Resource; /* fixme: load application defaults */ segv_handler = signal (SIGSEGV, Application::crash_handler); @@ -499,6 +501,17 @@ Application::Application(const char* argv, bool use_gui) : Inkscape::Extension::init(); autosave_init(); + + /* Initialize font factory */ + font_factory *factory = font_factory::Default(); + if (prefs->getBool("/options/font/use_fontsdir_system", true)) { + char const *fontsdir = get_path(SYSTEM, FONTS); + factory->AddFontsDir(fontsdir); + } + if (prefs->getBool("/options/font/use_fontsdir_user", true)) { + char const *fontsdir = get_path(USER, FONTS); + factory->AddFontsDir(fontsdir); + } } Application::~Application() -- cgit v1.2.3