1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 04-only-use-valid-font-families-in-text-tool.dpatch by Thomas Viehmann
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Patch to check font family against existing fonts in text tool.
6
## DP: (closes: #496784)
10
--- inkscape-0.46.orig/src/style.cpp
11
+++ inkscape-0.46/src/style.cpp
13
#include <sigc++/functors/ptr_fun.h>
14
#include <sigc++/adaptors/bind.h>
16
+#include "libnrtype/font-lister.h"
18
using Inkscape::CSSOStringStream;
21
@@ -2666,9 +2668,10 @@
23
sp_text_style_clear(ts);
25
- ts->font_specification.value = g_strdup("Bitstream Vera Sans");
26
- ts->font.value = g_strdup("Bitstream Vera Sans");
27
- ts->font_family.value = g_strdup("Bitstream Vera Sans");
28
+ Glib::ustring family = Inkscape::FontLister::get_instance()->get_family_name_or_any("Bitstream Vera Sans");
29
+ ts->font_specification.value = g_strdup(family.c_str());
30
+ ts->font.value = g_strdup(family.c_str());
31
+ ts->font_family.value = g_strdup(family.c_str());
35
--- inkscape-0.46.orig/src/libnrtype/font-lister.h
36
+++ inkscape-0.46/src/libnrtype/font-lister.h
38
return (*iter).second;
42
+ get_family_name_or_any(Glib::ustring family)
44
+ IterMapType::iterator iter = font_list_store_iter_map.find(family);
45
+ if (iter == font_list_store_iter_map.end ()) iter = font_list_store_iter_map.begin();
46
+ if (iter == font_list_store_iter_map.end ()) throw FAMILY_NOT_FOUND;
47
+ return (*iter).first;
51
get_name_list () const
53
--- inkscape-0.46.orig/src/widgets/toolbox.cpp
54
+++ inkscape-0.46/src/widgets/toolbox.cpp
56
font_instance * font = font_factory::Default()->FaceFromStyle(query);
58
familyName = font_factory::Default()->GetUIFamilyString(font->descr);
59
+ familyName = Inkscape::FontLister::get_instance()->get_family_name_or_any(familyName);