Re: [inkscape] Impossible to change font if ttf-bitstream-vera is not installed.
Hi Charles, Wolfram,
how about fixing #496784 with the attached [even better with
attachment...]? This seems to work for me and also work in cases where
the default font has gone missing for other reasons.
Kind regards
T.
--
Thomas Viehmann, http://thomas.viehmann.net/
diff -u inkscape-0.46/debian/changelog inkscape-0.46/debian/changelog
--- inkscape-0.46/debian/changelog
+++ inkscape-0.46/debian/changelog
@@ -1,3 +1,11 @@
+inkscape (0.46-2.2) unstable; urgency=low
+
+ * Non-maintainer upload.
+ * Take any font for the toolbar if we cannot find the one we are
+ looking for. Closes: #496784
+
+ -- Thomas Viehmann <tv@beamnet.de> Wed, 22 Oct 2008 00:38:42 +0200
+
inkscape (0.46-2.1) unstable; urgency=low
* Non-maintainer upload.
diff -u inkscape-0.46/debian/patches/00list inkscape-0.46/debian/patches/00list
--- inkscape-0.46/debian/patches/00list
+++ inkscape-0.46/debian/patches/00list
@@ -3,0 +4 @@
+04-only-use-valid-font-families-in-text-tool
only in patch2:
unchanged:
--- inkscape-0.46.orig/debian/patches/04-only-use-valid-font-families-in-text-tool.dpatch
+++ inkscape-0.46/debian/patches/04-only-use-valid-font-families-in-text-tool.dpatch
@@ -0,0 +1,62 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 04-only-use-valid-font-families-in-text-tool.dpatch by Thomas Viehmann
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Patch to check font family against existing fonts in text tool.
+## DP: (closes: #496784)
+
+@DPATCH@
+
+--- inkscape-0.46.orig/src/style.cpp
++++ inkscape-0.46/src/style.cpp
+@@ -50,6 +50,8 @@
+ #include <sigc++/functors/ptr_fun.h>
+ #include <sigc++/adaptors/bind.h>
+
++#include "libnrtype/font-lister.h"
++
+ using Inkscape::CSSOStringStream;
+ using std::vector;
+
+@@ -2666,9 +2668,10 @@
+ ts->refcount = 1;
+ sp_text_style_clear(ts);
+
+- ts->font_specification.value = g_strdup("Bitstream Vera Sans");
+- ts->font.value = g_strdup("Bitstream Vera Sans");
+- ts->font_family.value = g_strdup("Bitstream Vera Sans");
++ Glib::ustring family = Inkscape::FontLister::get_instance()->get_family_name_or_any("Bitstream Vera Sans");
++ ts->font_specification.value = g_strdup(family.c_str());
++ ts->font.value = g_strdup(family.c_str());
++ ts->font_family.value = g_strdup(family.c_str());
+
+ return ts;
+ }
+--- inkscape-0.46.orig/src/libnrtype/font-lister.h
++++ inkscape-0.46/src/libnrtype/font-lister.h
+@@ -86,6 +86,15 @@
+ return (*iter).second;
+ }
+
++ Glib:: ustring
++ get_family_name_or_any(Glib::ustring family)
++ {
++ IterMapType::iterator iter = font_list_store_iter_map.find(family);
++ if (iter == font_list_store_iter_map.end ()) iter = font_list_store_iter_map.begin();
++ if (iter == font_list_store_iter_map.end ()) throw FAMILY_NOT_FOUND;
++ return (*iter).first;
++ }
++
+ const NRNameList
+ get_name_list () const
+ {
+--- inkscape-0.46.orig/src/widgets/toolbox.cpp
++++ inkscape-0.46/src/widgets/toolbox.cpp
+@@ -4012,6 +4012,7 @@
+ font_instance * font = font_factory::Default()->FaceFromStyle(query);
+ if (font) {
+ familyName = font_factory::Default()->GetUIFamilyString(font->descr);
++ familyName = Inkscape::FontLister::get_instance()->get_family_name_or_any(familyName);
+ font->Unref();
+ font = NULL;
+ }
Reply to: