summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2008-07-12 12:28:57 +0000
committerJucaBlues <JucaBlues@users.sourceforge.net>2008-07-12 12:28:57 +0000
commit1a6bba2752df0376d796a1a394568340399ef2ec (patch)
tree9ea94370d722b9d53f488fb27e07d8172760cabb /src
parentkerning pairs already can be selected but kerning value still cant be set (diff)
downloadinkscape-1a6bba2752df0376d796a1a394568340399ef2ec.tar.gz
inkscape-1a6bba2752df0376d796a1a394568340399ef2ec.zip
now one can visually adjust glyph kerning. (still doesn save that info in the file, though)
(bzr r6269)
Diffstat (limited to 'src')
-rw-r--r--src/ui/dialog/svg-fonts-dialog.cpp28
-rw-r--r--src/ui/dialog/svg-fonts-dialog.h3
2 files changed, 29 insertions, 2 deletions
diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp
index d28085367..7df7e3b89 100644
--- a/src/ui/dialog/svg-fonts-dialog.cpp
+++ b/src/ui/dialog/svg-fonts-dialog.cpp
@@ -68,11 +68,33 @@ 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();
+}
+
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();
+
+
+ //look for this kerning pair on the currently selected font
+ this->kerning_pair = NULL;
+ for(SPObject* node = this->get_selected_spfont()->children; node; node=node->next){
+ if (SP_IS_HKERN(node) && ((SPGlyphKerning*)node)->u1->contains((gchar) first_glyph.get_active_text().c_str()[0])
+ && ((SPGlyphKerning*)node)->u2->contains((gchar) second_glyph.get_active_text().c_str()[0]) ){
+ this->kerning_pair = (SPGlyphKerning*)node;
+ continue;
+ }
+ }
+
+//TODO:
+ //if not found,
+ //create new kern node
}
/* Add all fonts in the document to the combobox. */
@@ -147,13 +169,15 @@ 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));
- Gtk::SpinButton* kerning_spin = Gtk::manage(new Gtk::SpinButton());
kernvbox->add(*kerning_selector);
kernvbox->add((Gtk::Widget&) kerning_preview);
- kernvbox->add(*kerning_spin);
+ kernvbox->add(kerning_spin);
//Text Preview:
_preview_entry.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_preview_text_changed));
diff --git a/src/ui/dialog/svg-fonts-dialog.h b/src/ui/dialog/svg-fonts-dialog.h
index 09378130c..837fc0478 100644
--- a/src/ui/dialog/svg-fonts-dialog.h
+++ b/src/ui/dialog/svg-fonts-dialog.h
@@ -65,6 +65,7 @@ public:
void on_font_selection_changed();
void on_preview_text_changed();
void on_glyphs_changed();
+ void on_kerning_changed();
private:
class Columns : public Gtk::TreeModel::ColumnRecord
{
@@ -87,6 +88,8 @@ private:
Gtk::Entry _preview_entry;
SvgFontDrawingArea _font_da, kerning_preview;
GlyphComboBox first_glyph, second_glyph;
+ SPGlyphKerning* kerning_pair;
+ Gtk::SpinButton kerning_spin;
class EntryWidget : public Gtk::HBox
{