summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-10-20 20:59:35 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-10-20 21:24:09 +0000
commit75444920325ba8a134eb16c4844f7fa15f34dd55 (patch)
treecf649a444ee98c3949f27bd68755a8f834e025a3 /src
parentDefine INKSCAPE_FONTSDIR and add USER/SYSTEM resource paths for fonts (diff)
downloadinkscape-75444920325ba8a134eb16c4844f7fa15f34dd55.tar.gz
inkscape-75444920325ba8a134eb16c4844f7fa15f34dd55.zip
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)
Diffstat (limited to 'src')
-rw-r--r--src/inkscape.cpp13
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp8
-rw-r--r--src/ui/dialog/inkscape-preferences.h2
3 files changed, 22 insertions, 1 deletions
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()
diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp
index d87a3d94a..5ceacd7b8 100644
--- a/src/ui/dialog/inkscape-preferences.cpp
+++ b/src/ui/dialog/inkscape-preferences.cpp
@@ -460,11 +460,17 @@ void InkscapePreferences::initPageTools()
_page_text.add_group_header( _("Text units"));
_font_unit_type.init( "/options/font/unitType", sizeLabels, sizeValues, G_N_ELEMENTS(sizeLabels), SP_CSS_UNIT_PT );
- _page_text.add_line( false, _("Text size unit type:"), _font_unit_type, "",
+ _page_text.add_line( true, _("Text size unit type:"), _font_unit_type, "",
_("Set the type of unit used in the text toolbar and text dialogs"), false);
_font_output_px.init ( _("Always output text size in pixels (px)"), "/options/font/textOutputPx", true);
// _page_text.add_line( false, "", _font_output_px, "", _("Always convert the text size units above into pixels (px) before saving to file"));
+ _page_text.add_group_header( _("Font directories"));
+ _font_fontsdir_system.init( _("Use Inkscape's fonts directory"), "/options/font/use_fontsdir_system", true);
+ _page_text.add_line( true, "", _font_fontsdir_system, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's global \"share\" directory"));
+ _font_fontsdir_user.init( _("Use user's fonts directory"), "/options/font/use_fontsdir_user", true);
+ _page_text.add_line( true, "", _font_fontsdir_user, "", _("Load additional fonts from \"fonts\" directory located in Inkscape's user configuration directory"));
+
this->AddNewObjectsStyle(_page_text, "/tools/text");
//Spray
diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h
index e6ba4e4b2..38b622095 100644
--- a/src/ui/dialog/inkscape-preferences.h
+++ b/src/ui/dialog/inkscape-preferences.h
@@ -328,6 +328,8 @@ protected:
UI::Widget::PrefCheckButton _font_dialog;
UI::Widget::PrefCombo _font_unit_type;
UI::Widget::PrefCheckButton _font_output_px;
+ UI::Widget::PrefCheckButton _font_fontsdir_system;
+ UI::Widget::PrefCheckButton _font_fontsdir_user;
UI::Widget::PrefCheckButton _misc_comment;
UI::Widget::PrefCheckButton _misc_default_metadata;