~ubuntu-branches/ubuntu/utopic/inkscape/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/04-only-use-valid-font-families-in-text-tool.dpatch

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2008-11-25 15:51:35 UTC
  • mfrom: (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20081125155135-00rp1lxb6cx2ntvp
Tags: 0.46-3ubuntu1
* Merge from debian unstable, remaining changes:
  - 03-gtk-includes.dpatch as a workaround of GTK includes bug
  - debian/control:
    + Add Vcs-Browser, Vcs-Svn, and Homepage (needs-to-goto-debian)
    + Set python-lxml, python-numpy, python-uniconvertor as Recommends
    + Depend on libgnomevfs2-extra
    + Build-Depends on automake (>= 1.10), libboost1.35-dev
    + move pstoedit from Recommends to Suggests
  - debian/rules:
    + Handle parallel builds via -j 
    + Run intltool-update on build
    + Add translation domain to .desktop files
  - Added patch 100_uniconvertor_binary_name.dpatch as python-uniconvertor
    uses uniconvertor as binary name instead of uniconv.
    (LP: #200750, needs-to-goto-debian).
  - inkscape.bash: Add svgz,ai (needs-to-go-upstream)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 04-only-use-valid-font-families-in-text-tool.dpatch by Thomas Viehmann
 
3
##
 
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)
 
7
 
 
8
@DPATCH@
 
9
 
 
10
--- inkscape-0.46.orig/src/style.cpp
 
11
+++ inkscape-0.46/src/style.cpp
 
12
@@ -50,6 +50,8 @@
 
13
 #include <sigc++/functors/ptr_fun.h>
 
14
 #include <sigc++/adaptors/bind.h>
 
15
 
 
16
+#include "libnrtype/font-lister.h"
 
17
+
 
18
 using Inkscape::CSSOStringStream;
 
19
 using std::vector;
 
20
 
 
21
@@ -2666,9 +2668,10 @@
 
22
     ts->refcount = 1;
 
23
     sp_text_style_clear(ts);
 
24
 
 
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());
 
32
 
 
33
     return ts;
 
34
 }
 
35
--- inkscape-0.46.orig/src/libnrtype/font-lister.h
 
36
+++ inkscape-0.46/src/libnrtype/font-lister.h
 
37
@@ -86,6 +86,15 @@
 
38
                             return (*iter).second;
 
39
                         }
 
40
 
 
41
+                        Glib:: ustring
 
42
+                        get_family_name_or_any(Glib::ustring family)
 
43
+                        {
 
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;
 
48
+                        }
 
49
+
 
50
                         const NRNameList
 
51
                         get_name_list () const
 
52
                         {
 
53
--- inkscape-0.46.orig/src/widgets/toolbox.cpp
 
54
+++ inkscape-0.46/src/widgets/toolbox.cpp
 
55
@@ -4012,6 +4012,7 @@
 
56
             font_instance * font = font_factory::Default()->FaceFromStyle(query);
 
57
             if (font) {
 
58
                 familyName = font_factory::Default()->GetUIFamilyString(font->descr);
 
59
+                familyName = Inkscape::FontLister::get_instance()->get_family_name_or_any(familyName);
 
60
                 font->Unref();
 
61
                 font = NULL;
 
62
             }