Code

kerning pairs already can be selected but kerning value still cant be set
authorJucaBlues <JucaBlues@users.sourceforge.net>
Sat, 12 Jul 2008 11:27:58 +0000 (11:27 +0000)
committerJucaBlues <JucaBlues@users.sourceforge.net>
Sat, 12 Jul 2008 11:27:58 +0000 (11:27 +0000)
src/ui/dialog/svg-fonts-dialog.cpp
src/ui/dialog/svg-fonts-dialog.h

index 53fd8cd0fa31283ea3aceee7384b2efedb541bcb..d280853675d16e89bc1fff6919816fb241c73aea 100644 (file)
@@ -16,6 +16,7 @@
 #ifdef ENABLE_SVG_FONTS
 
 #include "svg-fonts-dialog.h"
+#include <string.h>
 
 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);
index 7efa380fbd9f98229cd42597aafea0aa4de23959..09378130c971ded1de1e35b15ae12d76f10548b9 100644 (file)
@@ -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
         {