summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2008-07-12 12:49:58 +0000
committerJucaBlues <JucaBlues@users.sourceforge.net>2008-07-12 12:49:58 +0000
commit2738832693736fcb372d6b9ddade6a400ca594e2 (patch)
tree6fd45064533eaf0113515a38067ab8df13b87074 /src
parentnow one can visually adjust glyph kerning. (still doesn save that info in the... (diff)
downloadinkscape-2738832693736fcb372d6b9ddade6a400ca594e2.tar.gz
inkscape-2738832693736fcb372d6b9ddade6a400ca594e2.zip
properly update kerning value in the spinbox and fix some crashes
(bzr r6270)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index 7df7e3b89..254929bdb 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -69,10 +69,11 @@ void GlyphComboBox::update(SPFont* spfont){
}
void SvgFontsDialog::on_kerning_changed(){
- //set kerning value = spin.value()
- this->kerning_pair->k = kerning_spin.get_value();
- kerning_preview.redraw();
- _font_da.redraw();
+ if (this->kerning_pair){
+ this->kerning_pair->k = kerning_spin.get_value();
+ kerning_preview.redraw();
+ _font_da.redraw();
+ }
}
void SvgFontsDialog::on_glyphs_changed(){
@@ -95,6 +96,8 @@ void SvgFontsDialog::on_glyphs_changed(){
//TODO:
//if not found,
//create new kern node
+ if (this->kerning_pair)
+ kerning_spin.set_value(this->kerning_pair->k);
}
/* Add all fonts in the document to the combobox. */
@@ -123,11 +126,19 @@ 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());
+ SPFont* spfont = this->get_selected_spfont();
+ SvgFont* svgfont = this->get_selected_svgfont();
+ first_glyph.update(spfont);
+ second_glyph.update(spfont);
+ kerning_preview.set_svgfont(svgfont);
+ _font_da.set_svgfont(svgfont);
_font_da.redraw();
+
+ int steps = 50;
+ double set_width = spfont->horiz_adv_x;
+ kerning_spin.set_range(0,set_width);
+ kerning_spin.set_increments(int(set_width/steps),2*int(set_width/steps));
+ kerning_spin.set_value(0);
}
SvgFont* SvgFontsDialog::get_selected_svgfont()
@@ -169,8 +180,6 @@ SvgFontsDialog::SvgFontsDialog()
Gtk::HBox* kerning_selector = Gtk::manage(new Gtk::HBox());
kerning_selector->add(first_glyph);
kerning_selector->add(second_glyph);
- kerning_spin.set_range(0,1000);
- kerning_spin.set_increments(10,20);
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));
kerning_spin.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_changed));