Code

* added another spinbox to the svgfonts ui
authorJucaBlues <JucaBlues@users.sourceforge.net>
Fri, 18 Jul 2008 05:35:01 +0000 (05:35 +0000)
committerJucaBlues <JucaBlues@users.sourceforge.net>
Fri, 18 Jul 2008 05:35:01 +0000 (05:35 +0000)
* 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

src/ui/dialog/svg-fonts-dialog.cpp
src/ui/dialog/svg-fonts-dialog.h

index d4a2be18f55f11744eb7524aa20c2d84e9c64872..5d6a0954509b105466c05e0b89b4e3f3958fe279 100644 (file)
@@ -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:")));
index 24da11f10760df258706fa22c1ecc1772306cdf1..bc32bfebf38f5d0f3de6ca55b0f68d7b1443bfd4 100644 (file)
@@ -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
         {