summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-03-05 21:59:02 +0000
committerJabiertxo Arraiza Zenotz <jtx@jtx.marker.es>2013-03-05 21:59:02 +0000
commit58d7a0e0ef39488839985440c6f87a78d112e15f (patch)
treebb4b02b5a787701ee489b2748450ed594548c584
parentBPower for testing. (diff)
parentAdded null check (should fix Bug #1051017 ) (diff)
downloadinkscape-58d7a0e0ef39488839985440c6f87a78d112e15f.tar.gz
inkscape-58d7a0e0ef39488839985440c6f87a78d112e15f.zip
merge from trunk
(bzr r11950.1.46)
-rw-r--r--configure.ac89
-rw-r--r--share/extensions/hpgl_output.inx6
-rwxr-xr-xshare/extensions/hpgl_output.py51
-rw-r--r--src/Makefile.am5
-rw-r--r--src/desktop.h10
-rw-r--r--src/file.cpp4
-rw-r--r--src/interface.cpp18
-rw-r--r--src/libnrtype/font-lister.cpp120
-rw-r--r--src/menus-skeleton.h5
-rw-r--r--src/verbs.cpp15
-rw-r--r--src/verbs.h3
-rw-r--r--src/widgets/desktop-widget.cpp5
12 files changed, 129 insertions, 202 deletions
diff --git a/configure.ac b/configure.ac
index d4ebad20e..c92828905 100644
--- a/configure.ac
+++ b/configure.ac
@@ -362,93 +362,6 @@ fi
AM_CONDITIONAL(INKJAR, test "$with_ij" = "yes")
dnl ******************************
-dnl PERL checking
-dnl ******************************
-
-AC_MSG_CHECKING(for Perl development environment)
-AC_ARG_WITH(perl,
- AS_HELP_STRING([--with-perl],[use Perl for embedded scripting (EXPERIMENTAL)]),
- [with_perl=$withval], [with_perl=skipped])
-
-if test "x$with_perl" = "xyes"; then
- checkPERL_CFLAGS=`perl -MExtUtils::Embed -e perl_inc 2>/dev/null`
- if test "$?" -gt "0"; then
- with_perl="no"
- else
- checkPERL_LIBS=`perl -MExtUtils::Embed -e ldopts 2>/dev/null`
- if test "$?" -gt "0"; then
- with_perl="no"
- else
- with_perl="yes"
- fi
- fi
-fi
-AC_MSG_RESULT([$with_perl])
-if test "x$with_perl" = "xyes"; then
- # Test that we actually have the perl libraries installed
- oldCFLAGS="$CFLAGS"
- oldLIBS="$LIBS"
- CFLAGS="$CFLAGS $checkPERL_CFLAGS"
- LIBS="$LIBS $checkPERL_LIBS"
- AC_CHECK_FUNC([perl_parse],[
- PERL_CFLAGS="$checkPERL_CFLAGS"
- PERL_LIBS="$checkPERL_LIBS"
- AC_DEFINE(WITH_PERL, 1, [use Perl for embedded scripting])
- ],[
- with_perl="no"
- ])
- CFLAGS="$oldCFLAGS"
- LIBS="$oldLIBS"
-fi
-AM_CONDITIONAL(WITH_PERL, test "x$with_perl" = "xyes")
-AC_SUBST(PERL_CFLAGS)
-AC_SUBST(PERL_LIBS)
-
-dnl ******************************
-dnl Python checking
-dnl ******************************
-
-AC_MSG_CHECKING(for Python development environment)
-AC_ARG_WITH(python,
- AS_HELP_STRING([--with-python],[use Python for embedded scripting (EXPERIMENTAL)]),
- [with_python=$withval], [with_python=skipped])
-
-if test "x$with_python" = "xyes"; then
- checkPYTHON_CFLAGS=`python -c "import distutils.sysconfig ; print '-I%s' % distutils.sysconfig.get_config_var('INCLUDEPY')" 2>/dev/null`
- if test "$?" -gt "0"; then
- with_python="no"
- else
- checkPYTHON_LIBS=`python -c "import distutils.sysconfig ; print '%s/%s %s' % (distutils.sysconfig.get_config_var('LIBPL'),distutils.sysconfig.get_config_var('LDLIBRARY'),distutils.sysconfig.get_config_var('LIBS'))" 2>/dev/null`
- if test "$?" -gt "0"; then
- with_python="no"
- else
- with_python="yes"
- fi
- fi
-fi
-AC_MSG_RESULT([$with_python])
-if test "x$with_python" = "xyes"; then
- # Test that we actually have the python libraries installed
- oldCFLAGS="$CFLAGS"
- oldLIBS="$LIBS"
- CFLAGS="$CFLAGS $checkPYTHON_CFLAGS"
- LIBS="$LIBS $checkPYTHON_LIBS"
- AC_CHECK_FUNC([Py_Initialize],[
- PYTHON_CFLAGS="$checkPYTHON_CFLAGS"
- PYTHON_LIBS="$checkPYTHON_LIBS"
- AC_DEFINE(WITH_PYTHON, 1, [use Python for embedded scripting])
- ],[
- with_python="no"
- ])
- CFLAGS="$oldCFLAGS"
- LIBS="$oldLIBS"
-fi
-AM_CONDITIONAL(WITH_PYTHON, test "x$with_python" = "xyes")
-AC_SUBST(PYTHON_CFLAGS)
-AC_SUBST(PYTHON_LIBS)
-
-
-dnl ******************************
dnl LittleCms checking
dnl ******************************
@@ -1168,8 +1081,6 @@ Configuration:
Use gnome-vfs: ${gnome_vfs}
Use openoffice files: ${ij}
Use relocation support: ${enable_binreloc}
- Internal Python: ${with_python}
- Internal Perl: ${with_perl}
Enable LittleCms: ${enable_lcms}
Enable DBUS: ${with_dbus}
Enable Poppler-Cairo: ${enable_poppler_cairo}
diff --git a/share/extensions/hpgl_output.inx b/share/extensions/hpgl_output.inx
index 281de27cc..b54276911 100644
--- a/share/extensions/hpgl_output.inx
+++ b/share/extensions/hpgl_output.inx
@@ -9,14 +9,14 @@
<param name="horizontal_guide" type="description">—————————————————————————————</param>
<param name="resolution" type="int" min="90" max="2048" _gui-text="Resolution (dpi)" _gui-description="The amount of steps the cutter moves if it moves for 1 inch, either get this value from your plotter manual or learn it by trial and error (Standard: '1016')">1016</param>
<param name="pen" type="int" min="1" max="10" _gui-text="Pen number" _gui-description="The number of the pen (tool) to use, on most plotters 1 (Standard: '1')">1</param>
- <param name="angle" type="optiongroup" appearance="minimal" _gui-text="Orientation" _gui-description="Orientation of the plot, change this if your plotter is plotting horizontal instead of vertical (Standard: '-90°')">
+ <param name="angle" type="optiongroup" appearance="minimal" _gui-text="Orientation" _gui-description="Orientation of the plot, change this if your plotter is plotting horizontal instead of vertical (Standard: '90°')">
+ <option value="90">90°</option>
<option value="-90">-90°</option>
<option value="0">0°</option>
- <option value="90">90°</option>
<option value="180">180°</option>
</param>
<param name="mirror" type="boolean" _gui-text="Mirror Y-axis" _gui-description="Whether to mirror the Y axis. Some plotters need this, some not. Look in your plotter manual or learn it by trial and error (Standard: 'False')">false</param>
- <param name="flat" type="float" min="0.05" max="10.0" precision="2" _gui-text="Curve flatness (mm)" _gui-description="Curves get divided into lines, this is the approximate length of one line in mm (Standard: '0.50')">0.50</param>
+ <param name="flat" type="float" min="0.1" max="10.0" precision="1" _gui-text="Curve flatness" _gui-description="Curves are divided into lines, this number controls how fine the curves will be reproduced, the smaller the finer (Standard: '1.2')">1.2</param>
<param name="horizontal_guide" type="description">—————————————————————————————</param>
<param name="useOvercut" type="boolean" _gui-text="Use Overcut" _gui-description="Whether the overcut will be used, if not the 'Overcut' parameter is unused (Standard: 'True')">true</param>
<param name="overcut" type="float" min="0.0" max="100.0" precision="2" _gui-text="Overcut (mm)" _gui-description="The distance in mm that will be cut over the starting point of the path to prevent open paths (Standard: '1.00')">1.00</param>
diff --git a/share/extensions/hpgl_output.py b/share/extensions/hpgl_output.py
index e8333ac22..38d95ac09 100755
--- a/share/extensions/hpgl_output.py
+++ b/share/extensions/hpgl_output.py
@@ -18,14 +18,14 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-import inkex, simpletransform, cubicsuperpath, simplestyle, cspsubdiv, sys, math
+import inkex, simpletransform, cubicsuperpath, simplestyle, sys, math, bezmisc, string, cspsubdiv
class MyEffect(inkex.Effect):
def __init__(self):
inkex.Effect.__init__(self)
self.OptionParser.add_option("-f", "--flatness",
action="store", type="float",
- dest="flat", default=0.5,
+ dest="flat", default=1.2,
help="Minimum flatness of the subdivided curves")
self.OptionParser.add_option("-m", "--mirror",
action="store", type="inkbool",
@@ -73,7 +73,7 @@ class MyEffect(inkex.Effect):
help="Return Factor")
self.OptionParser.add_option("-a", "--angle",
action="store", type="string",
- dest="rotation", default="-90",
+ dest="rotation", default="90",
help="Orientation")
self.OptionParser.add_option("-s", "--sendToPlotter",
action="store", type="inkbool",
@@ -90,26 +90,38 @@ class MyEffect(inkex.Effect):
def effect(self):
# initiate vars
- self.vData = [['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0]]
self.xDivergence = 999999999999.0
self.yDivergence = 999999999999.0
scale = float(self.options.resolution) / 90 # dots/inch to dots/pixels
x0 = self.options.xOffset * 3.5433070866 * scale # mm to dots
y0 = self.options.yOffset * 3.5433070866 * scale # mm to dots
- self.options.flat *= 3.5433070866 # mm to pixels
self.options.overcut = self.options.overcut * 3.5433070866 * scale # mm to dots
self.options.toolOffset = self.options.toolOffset * 3.5433070866 * scale # mm to dots
+ self.options.flat = float(self.options.resolution) * self.options.flat / 1000
doc = self.document.getroot()
mirror = 1.0
if self.options.mirror:
mirror = -1.0
+ # get viewBox parameter to correct scaling
+ viewBox = doc.get('viewBox')
+ viewBoxTransformX = 1
+ viewBoxTransformY = 1
+ if viewBox:
+ viewBox = string.split(viewBox, ' ')
+ if viewBox[2] and viewBox[3]:
+ viewBoxTransformX = float(inkex.unittouu(doc.get('width'))) / float(viewBox[2])
+ viewBoxTransformY = float(inkex.unittouu(doc.get('height'))) / float(viewBox[3])
# dryRun to find edges
self.dryRun = True
- self.groupmat = [[[scale, 0.0, 0.0], [0.0, mirror*scale, 0.0]]]
+ self.groupmat = [[[scale*viewBoxTransformX, 0.0, 0.0], [0.0, mirror*scale*viewBoxTransformY, 0.0]]]
+ self.groupmat[0] = simpletransform.composeTransform(self.groupmat[0], simpletransform.parseTransform('rotate(' + self.options.rotation + ')'))
+ self.vData = [['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0]]
self.process_group(doc)
# life run
self.dryRun = False
- self.groupmat = [[[scale, 0.0, -self.xDivergence + x0], [0.0, mirror*scale, -self.yDivergence + y0]]]
+ self.groupmat = [[[scale*viewBoxTransformX, 0.0, -self.xDivergence + x0], [0.0, mirror*scale*viewBoxTransformY, -self.yDivergence + y0]]]
+ self.groupmat[0] = simpletransform.composeTransform(self.groupmat[0], simpletransform.parseTransform('rotate(' + self.options.rotation + ')'))
+ self.vData = [['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0], ['', -1.0, -1.0]]
self.hpgl = 'IN;SP%d;' % self.options.pen
if self.options.sendToPlotter:
try:
@@ -134,7 +146,7 @@ class MyEffect(inkex.Effect):
if style:
style = simplestyle.parseStyle(style)
if style.has_key('display'):
- if style['display']=='none':
+ if style['display'] == 'none':
if not self.options.plotInvisibleLayers:
return
trans = group.get('transform')
@@ -157,7 +169,6 @@ class MyEffect(inkex.Effect):
trans = node.get('transform')
if trans:
mat = simpletransform.composeTransform(mat, simpletransform.parseTransform(trans))
- mat = simpletransform.composeTransform(mat, simpletransform.parseTransform('rotate(' + self.options.rotation + ')'))
simpletransform.applyTransformToPath(mat, p)
cspsubdiv.cspsubdiv(p, self.options.flat)
# break path into HPGL commands
@@ -191,6 +202,14 @@ class MyEffect(inkex.Effect):
if abs: return math.fabs(math.sqrt((x2 - x1) ** 2.0 + (y2 - y1) ** 2.0))
else: return math.sqrt((x2 - x1) ** 2.0 + (y2 - y1) ** 2.0)
+ def getAlpha(self, x1, y1, x2, y2, x3, y3):
+ temp1 = (x1-x2)**2 + (y1-y2)**2 + (x3-x2)**2 + (y3-y2)**2 - (x1-x3)**2 - (y1-y3)**2
+ temp2 = 2 * math.sqrt((x1-x2)**2 + (y1-y2)**2) * math.sqrt((x3-x2)**2 + (y3-y2)**2)
+ temp3 = temp1 / temp2
+ if temp3 < -1:
+ temp3 = -1
+ return math.acos(temp3)
+
def calcOffset(self, cmd, xPos, yPos):
# calculate offset correction (or dont))
if not self.options.correctToolOffset:
@@ -200,16 +219,22 @@ class MyEffect(inkex.Effect):
self.vData.insert(3, [cmd, xPos, yPos])
if self.vData[2][1] != -1.0:
if self.vData[1][1] != -1.0:
+ if self.vData[2][0] == 'PD' and self.vData[3][0] == 'PD':
+ if self.getAlpha(self.vData[1][1], self.vData[1][2], self.vData[2][1], self.vData[2][2], self.vData[3][1], self.vData[3][2]) > 2.748893:
+ self.storeData(self.vData[2][0], self.vData[2][1], self.vData[2][2])
+ return
if self.vData[2][0] == 'PD':
self.storeData('PD',
self.changeLengthX(self.vData[1][1], self.vData[1][2], self.vData[2][1], self.vData[2][2], self.options.toolOffset),
self.changeLengthY(self.vData[1][1], self.vData[1][2], self.vData[2][1], self.vData[2][2], self.options.toolOffset))
elif self.vData[0][1] != -1.0:
- xTemp = self.vData[1][1] - self.changeLengthX(self.vData[0][1], self.vData[0][2], self.vData[1][1], self.vData[1][2], self.options.toolOffset)
- yTemp = self.vData[1][2] - self.changeLengthY(self.vData[0][1], self.vData[0][2], self.vData[1][1], self.vData[1][2], self.options.toolOffset)
- self.storeData('PU', self.vData[2][1] - xTemp, self.vData[2][2] - yTemp)
+ self.storeData('PU',
+ self.vData[2][1] - (self.vData[1][1] - self.changeLengthX(self.vData[0][1], self.vData[0][2], self.vData[1][1], self.vData[1][2], self.options.toolOffset)),
+ self.vData[2][2] - (self.vData[1][2] - self.changeLengthY(self.vData[0][1], self.vData[0][2], self.vData[1][1], self.vData[1][2], self.options.toolOffset)))
else:
- self.storeData('PU', self.vData[2][1], self.vData[2][2])
+ self.storeData('PU',
+ self.vData[2][1],
+ self.vData[2][2])
if self.vData[3][0] == 'PD':
self.storeData('PD',
self.changeLengthX(self.vData[3][1], self.vData[3][2], self.vData[2][1], self.vData[2][2], -(self.options.toolOffset * self.options.toolOffsetReturn)),
diff --git a/src/Makefile.am b/src/Makefile.am
index 2a4e2960c..7d8a9ef50 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -44,9 +44,6 @@ all_libs = \
$(kdeldadd) \
$(win32ldflags) \
$(CARBON_LDFLAGS) \
- $(PERL_LIBS) \
- $(PYTHON_LIBS) \
- $(INKBOARD_LIBS) \
$(LIBWPG_LIBS) \
$(LIBVISIO_LIBS) \
$(LIBCDR_LIBS) \
@@ -66,13 +63,11 @@ BUILT_SOURCES =
EXTRA_DIST =
AM_CPPFLAGS = \
- $(PERL_CFLAGS) $(PYTHON_CFLAGS) \
$(EXIF_CFLAGS) \
$(FREETYPE_CFLAGS) \
$(GNOME_PRINT_CFLAGS) \
$(GNOME_VFS_CFLAGS) \
$(IMAGEMAGICK_CFLAGS) \
- $(INKBOARD_CFLAGS) \
$(LIBWPG_CFLAGS) \
$(LIBVISIO_CFLAGS) \
$(LIBCDR_CFLAGS) \
diff --git a/src/desktop.h b/src/desktop.h
index 93cf3201c..27176868f 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -214,16 +214,6 @@ public:
return _layer_changed_signal.connect(slot);
}
- // Whiteboard changes
-
-#ifdef WITH_INKBOARD
- Inkscape::Whiteboard::SessionManager* whiteboard_session_manager() {
- return _whiteboard_session_manager;
- }
-
- Inkscape::Whiteboard::SessionManager* _whiteboard_session_manager;
-#endif
-
/**
* Return new desktop object.
* \pre namedview != NULL.
diff --git a/src/file.cpp b/src/file.cpp
index 468d02eba..97087c1a1 100644
--- a/src/file.cpp
+++ b/src/file.cpp
@@ -81,10 +81,6 @@ using Inkscape::DocumentUndo;
#include "extension/dbus/dbus-init.h"
#endif
-//#ifdef WITH_INKBOARD
-//#include "jabber_whiteboard/session-manager.h"
-//#endif
-
#ifdef WIN32
#include <windows.h>
#endif
diff --git a/src/interface.cpp b/src/interface.cpp
index 284368bff..bf497b407 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -1539,14 +1539,16 @@ sp_ui_menu_item_set_name(GtkWidget *data, Glib::ustring const &name)
//- a GtkHBox, whose first child is a label displaying name if the menu
//item has an accel key
//- a GtkLabel if the menu has no accel key
- if (GTK_IS_LABEL(child)) {
- gtk_label_set_markup_with_mnemonic(GTK_LABEL (child), name.c_str());
- } else if (GTK_IS_HBOX(child)) {
- gtk_label_set_markup_with_mnemonic(
- GTK_LABEL (gtk_container_get_children(GTK_CONTAINER (child))->data),
- name.c_str());
- }//else sp_ui_menu_append_item_from_verb has been modified and can set
- //a menu item in yet another way...
+ if (child != NULL){
+ if (GTK_IS_LABEL(child)) {
+ gtk_label_set_markup_with_mnemonic(GTK_LABEL (child), name.c_str());
+ } else if (GTK_IS_HBOX(child)) {
+ gtk_label_set_markup_with_mnemonic(
+ GTK_LABEL (gtk_container_get_children(GTK_CONTAINER (child))->data),
+ name.c_str());
+ }//else sp_ui_menu_append_item_from_verb has been modified and can set
+ //a menu item in yet another way...
+ }
}
}
diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp
index 97d3c66d4..1e3ba01e9 100644
--- a/src/libnrtype/font-lister.cpp
+++ b/src/libnrtype/font-lister.cpp
@@ -449,35 +449,7 @@ namespace Inkscape
// Find best match to the style from the old font-family to the
// styles available with the new font.
// TODO: Maybe check if an exact match exists before using Pango.
- Glib::ustring best_style = current_style;
- if( check_style ) {
- //std::cout << " Trying to match: " << current_fontspec << std::endl;
- PangoFontDescription *desc_old
- = pango_font_description_from_string( current_fontspec.c_str() );
- PangoFontDescription* desc_best = NULL;
-
- for (GList *l=styles; l; l = l->next) {
- Glib::ustring candidate = new_family + ", " + (char*)l->data;
- PangoFontDescription* desc_candidate
- = pango_font_description_from_string( candidate.c_str() );
- //std::cout << " Testing: " << pango_font_description_to_string( desc_candidate ) << std::endl;
- if( pango_font_description_better_match( desc_old, desc_best, desc_candidate ) ) {
- pango_font_description_free( desc_best );
- desc_best = desc_candidate;
- //std::cout << " ... better: " << std::endl;
- } else {
- pango_font_description_free( desc_candidate );
- //std::cout << " ... not better: " << std::endl;
- }
- }
- if( desc_best ) {
- pango_font_description_unset_fields( desc_best, PANGO_FONT_MASK_FAMILY );
- best_style = pango_font_description_to_string( desc_best );
- }
-
- if( desc_old ) pango_font_description_free( desc_old );
- if( desc_best ) pango_font_description_free( desc_best );
- }
+ Glib::ustring best_style = get_best_style_match( new_family, current_style );
#ifdef DEBUG_FONT
std::cout << "FontLister::new_font_family: exit: " << new_family << " " << best_style << std::endl;
@@ -863,6 +835,64 @@ namespace Inkscape
throw STYLE_NOT_FOUND;
}
+ static gint
+ compute_distance (const PangoFontDescription *a,
+ const PangoFontDescription *b ) {
+
+ // Weight: multiples of 100
+ gint distance = abs( pango_font_description_get_weight( a ) -
+ pango_font_description_get_weight( b ) );
+
+ distance += 10000 * abs( pango_font_description_get_stretch( a ) -
+ pango_font_description_get_stretch( b ) );
+
+ PangoStyle style_a = pango_font_description_get_style( a );
+ PangoStyle style_b = pango_font_description_get_style( b );
+ if( style_a != style_b ) {
+ if( (style_a == PANGO_STYLE_OBLIQUE && style_b == PANGO_STYLE_ITALIC) ||
+ (style_b == PANGO_STYLE_OBLIQUE && style_a == PANGO_STYLE_ITALIC) ) {
+ distance += 1000; // Oblique and italic are almost the same
+ } else {
+ distance += 100000; // Normal vs oblique/italic, not so similar
+ }
+ }
+
+ // Normal vs small-caps
+ distance += 1000000 * abs( pango_font_description_get_variant( a ) -
+ pango_font_description_get_variant( b ) );
+ return distance;
+ }
+
+ // This is inspired by pango_font_description_better_match, but that routine
+ // always returns false if variant or stretch are different. This means, for
+ // example, that PT Sans Narrow with style Bold Condensed is never matched
+ // to another font-family with Bold style.
+ gboolean
+ font_description_better_match( PangoFontDescription* target,
+ PangoFontDescription* old_desc,
+ PangoFontDescription* new_desc ) {
+
+ if( old_desc == NULL ) return true;
+ if( new_desc == NULL ) return false;
+
+ int old_distance = compute_distance( target, old_desc );
+ int new_distance = compute_distance( target, new_desc );
+ //std::cout << "font_description_better_match: old: " << old_distance << std::endl;
+ //std::cout << " new: " << new_distance << std::endl;
+
+ return (new_distance < old_distance );
+ }
+
+ // void
+ // font_description_dump( PangoFontDescription* target ) {
+ // std::cout << " Font: " << pango_font_description_to_string( target ) << std::endl;
+ // std::cout << " style: " << pango_font_description_get_style( target ) << std::endl;
+ // std::cout << " weight: " << pango_font_description_get_weight( target ) << std::endl;
+ // std::cout << " variant: " << pango_font_description_get_variant( target ) << std::endl;
+ // std::cout << " stretch: " << pango_font_description_get_stretch( target ) << std::endl;
+ // std::cout << " gravity: " << pango_font_description_get_gravity( target ) << std::endl;
+ // }
+
/* Returns style string */
// TODO: Remove or turn into function to be used by new_font_family.
Glib::ustring
@@ -873,7 +903,7 @@ namespace Inkscape
std::cout << "FontLister::get_best_style_match: " << family << " : " << target_style << std::endl;
#endif
- Glib::ustring font_string = family + " " + target_style;
+ Glib::ustring fontspec = family + ", " + target_style;
Gtk::TreeModel::Row row;
try {
@@ -883,31 +913,37 @@ namespace Inkscape
return (target_style);
}
- PangoFontDescription* target = pango_font_description_from_string( font_string.c_str() );
+ PangoFontDescription* target = pango_font_description_from_string( fontspec.c_str() );
PangoFontDescription* best = NULL;
- //std::cout << " Target: " << pango_font_description_to_string( target ) << std::endl;
+ //font_description_dump( target );
GList* styles = row[FontList.styles];
for (GList *l=styles; l; l = l->next) {
- Glib::ustring font_string_test = family + " " + (char*)l->data;
- PangoFontDescription* candidate = pango_font_description_from_string( font_string_test.c_str() );
- // std::cout << " Testing: " << pango_font_description_to_string( candidate ) << std::endl;
- if( pango_font_description_better_match( target, best, candidate ) ) {
- best = candidate;
+ Glib::ustring fontspec = family + ", " + (char*)l->data;
+ PangoFontDescription* candidate = pango_font_description_from_string( fontspec.c_str() );
+ //font_description_dump( candidate );
+ //std::cout << " " << font_description_better_match( target, best, candidate ) << std::endl;
+ if( font_description_better_match( target, best, candidate ) ) {
+ pango_font_description_free( best );
+ best = candidate;
+ //std::cout << " ... better: " << std::endl;
+ } else {
+ pango_font_description_free( candidate );
+ //std::cout << " ... not better: " << std::endl;
}
}
- Glib::ustring best_style;
+ Glib::ustring best_style = target_style;
if( best ) {
- //std::cout << " Best: " << pango_font_description_to_string( best ) << std::endl;
pango_font_description_unset_fields( best, PANGO_FONT_MASK_FAMILY );
best_style = pango_font_description_to_string( best );
- } else {
- //std::cout << " Failed: " << family << std::endl;
- best_style = target_style;
}
+ if( target ) pango_font_description_free( target );
+ if( best ) pango_font_description_free( best );
+
+
#ifdef DEBUG_FONT
std::cout << " Returning: " << best_style << std::endl;
std::cout << "FontLister::get_best_style_match: exit" << std::endl;
diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h
index fa39dbd3a..868b606a4 100644
--- a/src/menus-skeleton.h
+++ b/src/menus-skeleton.h
@@ -282,11 +282,6 @@ static char const menus_skeleton[] =
" <separator/>\n"
" <effects-list/>\n"
" </submenu>\n"
-#ifdef WITH_INKBOARD
-" <submenu name=\"" N_("Whiteboa_rd") "\">\n"
-" <verb verb-id=\"DialogXmppClient\" />\n"
-" </submenu>\n"
-#endif
" <submenu name=\"" N_("_Help") "\">\n"
" <verb verb-id=\"org.inkscape.help.manual\" />\n"
" <verb verb-id=\"org.inkscape.help.keys\" />\n"
diff --git a/src/verbs.cpp b/src/verbs.cpp
index bbadb1a25..cdeeab99a 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -89,10 +89,6 @@
using Inkscape::DocumentUndo;
using Inkscape::UI::Dialog::ActionAlign;
-//#ifdef WITH_INKBOARD
-//#include "jabber_whiteboard/session-manager.h"
-//#endif
-
/**
* Return the name without underscores and ellipsis, for use in dialog
* titles, etc. Allocated memory must be freed by caller.
@@ -1972,13 +1968,6 @@ void DialogVerb::perform(SPAction *action, void *data)
//sp_item_dialog();
dt->_dlg_mgr->showDialog("ObjectProperties");
break;
-/*#ifdef WITH_INKBOARD
- case SP_VERB_XMPP_CLIENT:
- {
- Inkscape::Whiteboard::SessionManager::showClient();
- break;
- }
-#endif*/
case SP_VERB_DIALOG_INPUT:
dt->_dlg_mgr->showDialog("InputDevices");
break;
@@ -2796,10 +2785,6 @@ Verb *Verb::_base_verbs[] = {
N_("Edit the object attributes..."), INKSCAPE_ICON("dialog-object-attributes")),
new DialogVerb(SP_VERB_DIALOG_ITEM, "DialogObjectProperties", N_("_Object Properties..."),
N_("Edit the ID, locked and visible status, and other object properties"), INKSCAPE_ICON("dialog-object-properties")),
-/*#ifdef WITH_INKBOARD
- new DialogVerb(SP_VERB_XMPP_CLIENT, "DialogXmppClient",
- N_("_Instant Messaging..."), N_("Jabber Instant Messaging Client"), NULL),
-#endif*/
new DialogVerb(SP_VERB_DIALOG_INPUT, "DialogInput", N_("_Input Devices..."),
N_("Configure extended input devices, such as a graphics tablet"), INKSCAPE_ICON("dialog-input-devices")),
new DialogVerb(SP_VERB_DIALOG_EXTENSIONEDITOR, "org.inkscape.dialogs.extensioneditor", N_("_Extensions..."),
diff --git a/src/verbs.h b/src/verbs.h
index c4a7b67e0..dab524d7a 100644
--- a/src/verbs.h
+++ b/src/verbs.h
@@ -282,9 +282,6 @@ enum {
SP_VERB_DIALOG_CLONETILER,
SP_VERB_DIALOG_ATTR,
SP_VERB_DIALOG_ITEM,
-/*#ifdef WITH_INKBOARD
- SP_VERB_XMPP_CLIENT,
-#endif*/
SP_VERB_DIALOG_INPUT,
SP_VERB_DIALOG_EXTENSIONEDITOR,
SP_VERB_DIALOG_LAYERS,
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index 2a816adf4..b0d8d974e 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -82,11 +82,6 @@ using Inkscape::UI::UXManager;
using Inkscape::UI::ToolboxFactory;
using ege::AppearTimeTracker;
-#ifdef WITH_INKBOARD
-#endif
-
-
-
enum {
ACTIVATE,
DEACTIVATE,