From a6a96a7b597a4385f4a48fd5b6514b870a0f7dc4 Mon Sep 17 00:00:00 2001 From: JucaBlues Date: Sat, 12 Jul 2008 11:27:58 +0000 Subject: [PATCH] kerning pairs already can be selected but kerning value still cant be set --- src/ui/dialog/svg-fonts-dialog.cpp | 13 ++++++++++++- src/ui/dialog/svg-fonts-dialog.h | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 53fd8cd0f..d28085367 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -16,6 +16,7 @@ #ifdef ENABLE_SVG_FONTS #include "svg-fonts-dialog.h" +#include SvgFontDrawingArea::SvgFontDrawingArea(){ this->text = ""; @@ -58,14 +59,21 @@ GlyphComboBox::GlyphComboBox(){ void GlyphComboBox::update(SPFont* spfont){ if (spfont) { + this->clear(); for(SPObject* node = spfont->children; node; node=node->next){ if (SP_IS_GLYPH(node)){ - g_warning("glyphCombo unicode='%s'", ((SPGlyph*)node)->unicode); + this->append_text(((SPGlyph*)node)->unicode); } } } } +void SvgFontsDialog::on_glyphs_changed(){ + std::string str1(first_glyph.get_active_text()); + std::string str2(second_glyph.get_active_text()); + kerning_preview.set_text((gchar*) (str1+str2).c_str()); + kerning_preview.redraw(); +} /* Add all fonts in the document to the combobox. */ void SvgFontsDialog::update_fonts() @@ -95,6 +103,7 @@ void SvgFontsDialog::on_preview_text_changed(){ void SvgFontsDialog::on_font_selection_changed(){ first_glyph.update(this->get_selected_spfont()); second_glyph.update(this->get_selected_spfont()); + kerning_preview.set_svgfont(this->get_selected_svgfont()); _font_da.set_svgfont(this->get_selected_svgfont()); _font_da.redraw(); } @@ -138,6 +147,8 @@ SvgFontsDialog::SvgFontsDialog() Gtk::HBox* kerning_selector = Gtk::manage(new Gtk::HBox()); kerning_selector->add(first_glyph); kerning_selector->add(second_glyph); + first_glyph.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_glyphs_changed)); + second_glyph.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_glyphs_changed)); Gtk::SpinButton* kerning_spin = Gtk::manage(new Gtk::SpinButton()); kernvbox->add(*kerning_selector); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index 7efa380fb..09378130c 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -45,7 +45,7 @@ namespace Inkscape { namespace UI { namespace Dialog { -class GlyphComboBox : public Gtk::Combo { +class GlyphComboBox : public Gtk::ComboBoxText { public: GlyphComboBox(); void update(SPFont*); @@ -64,6 +64,7 @@ public: SPFont* get_selected_spfont(); void on_font_selection_changed(); void on_preview_text_changed(); + void on_glyphs_changed(); private: class Columns : public Gtk::TreeModel::ColumnRecord { -- 2.30.2