From: JucaBlues Date: Fri, 18 Jul 2008 05:35:01 +0000 (+0000) Subject: * added another spinbox to the svgfonts ui X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a6cde89b2c2dac90ea2617b4d97f2c31cdff1f6b;p=inkscape.git * added another spinbox to the svgfonts ui * this one will set the horiz_adv_x parameter of fonts (i.e. the "set width") * but it is still not working well since I need to find out how to tell cairo that the glyph cache is invalid and that glyphs should be rerendered --- diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index d4a2be18f..5d6a09545 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -141,11 +141,21 @@ void SvgFontsDialog::on_font_selection_changed(){ int steps = 50; double set_width = spfont->horiz_adv_x; + setwidth_spin.set_value(set_width); + 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); } +void SvgFontsDialog::on_setwidth_changed(){ + SPFont* spfont = this->get_selected_spfont(); + if (spfont){ + spfont->horiz_adv_x = setwidth_spin.get_value(); + //TODO: tell cairo that the glyphs cache has to be invalidated + } +} + SvgFont* SvgFontsDialog::get_selected_svgfont() { Gtk::TreeModel::iterator i = _font_list.get_selection()->get_selected(); @@ -181,6 +191,18 @@ SvgFontsDialog::SvgFontsDialog() //kerning setup: Gtk::VBox* kernvbox = Gtk::manage(new Gtk::VBox()); _font_settings.add(*kernvbox); + +//Set Width (horiz_adv_x): + Gtk::HBox* setwidth_hbox = Gtk::manage(new Gtk::HBox()); + setwidth_hbox->add(*Gtk::manage(new Gtk::Label("Set width (not working yet):"))); + setwidth_hbox->add(setwidth_spin); + + setwidth_spin.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_setwidth_changed)); + setwidth_spin.set_range(0, 4096); + setwidth_spin.set_increments(10, 100); + _font_settings.add(*setwidth_hbox); + +//Kerning Setup: kernvbox->add(*Gtk::manage(new Gtk::Label("Kerning Setup:"))); Gtk::HBox* kerning_selector = Gtk::manage(new Gtk::HBox()); kerning_selector->add(*Gtk::manage(new Gtk::Label("1st Glyph:"))); diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h index 24da11f10..bc32bfebf 100644 --- a/src/ui/dialog/svg-fonts-dialog.h +++ b/src/ui/dialog/svg-fonts-dialog.h @@ -68,6 +68,8 @@ public: void on_preview_text_changed(); void on_glyphs_changed(); void on_kerning_changed(); + void on_setwidth_changed(); + private: class Columns : public Gtk::TreeModel::ColumnRecord { @@ -91,7 +93,7 @@ private: SvgFontDrawingArea _font_da, kerning_preview; GlyphComboBox first_glyph, second_glyph; SPGlyphKerning* kerning_pair; - Gtk::SpinButton kerning_spin; + Gtk::SpinButton kerning_spin, setwidth_spin; class EntryWidget : public Gtk::HBox {