svg-fonts-dialog.cpp revision 9c54d8e6dee330c19f895f29760af901190ab856
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal * SVG Fonts dialog - implementation.
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal * Felipe C. da S. Sanches <juca@members.fsf.org>
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal * Jon A. Cruz <jon@joncruz.org>
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal * Abhishek Sharma
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal * Copyright (C) 2008 Authors
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal * Released under GNU GPLv2 (or later). Read the file 'COPYING' for more information.
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmalvoid SvgFontDrawingArea::set_svgfont(SvgFont* svgfont){
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmalvoid SvgFontDrawingArea::set_text(Glib::ustring text){
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmalbool SvgFontDrawingArea::on_expose_event (GdkEventExpose */*event*/){
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal cr->set_font_face( Cairo::RefPtr<Cairo::FontFace>(new Cairo::FontFace(_svgfont->get_font_face(), false /* does not have reference */)) );
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmalnamespace UI {
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmalGtk::HBox* SvgFontsDialog::AttrEntry(gchar* lbl, const SPAttributeEnum attr){
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal Gtk::HBox* hbox = Gtk::manage(new Gtk::HBox());
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal hbox->add(* Gtk::manage(new Gtk::Label(lbl)) );
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal Gtk::Entry* entry = Gtk::manage(new Gtk::Entry());
2a8da5bd8f757b218f0a9e9826a7afea16e7a773ishmal hbox->add(* entry );
83aaf46c9feab529aeb9add871c05c3d1177afccaurium hbox->show_all();
83aaf46c9feab529aeb9add871c05c3d1177afccaurium entry->signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_attr_changed));
83aaf46c9feab529aeb9add871c05c3d1177afccaurium return hbox;
this->dialog = d;
this->show_all();
switch(this->attr){
case SP_PROP_FONT_FAMILY:
o = node;
o = NULL;
if(name && o) {
return hbox;
if (!spfont) return
#if WITH_GTKMM_2_24
this->remove_all();
this->clear_items();
#if WITH_GTKMM_2_24
if (!get_selected_kerning_pair()) {
this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str());
DocumentUndo::maybeDone(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value"));
if (get_selected_spfont()){
if (!kern) {
if (!font) return;
if (!spfont) return;
if (spfont){
return NULL;
return NULL;
return NULL;
return NULL;
return &global_vbox;
if (!_GlyphsListStore) return;
if (!_KerningPairsListStore) return;
row[_KerningPairsListColumns.first_glyph] = (static_cast<SPGlyphKerning*>(node))->u1->attribute_string().c_str();
row[_KerningPairsListColumns.second_glyph] = (static_cast<SPGlyphKerning*>(node))->u2->attribute_string().c_str();
if (!font) return;
Geom::Affine m(Geom::Coord(1),Geom::Coord(0),Geom::Coord(0),Geom::Coord(-1),Geom::Coord(0),Geom::Coord(baseline_offset));
return pathv*m;
if (!desktop) {
if (!glyph){
if (!desktop) {
if (!desktop) {
if (!font) return;
update_fonts();
_GlyphsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::glyphs_list_button_release));
create_glyphs_popup_menu(_GlyphsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_glyph));
missing_glyph_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::missing_glyph_description_from_selected_path));
missing_glyph_reset_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::reset_missing_glyph_description));
_GlyphsListScroller.set_size_request(-1, 290);//It seems that is does not work. Why? I want a box with larger height
glyph_from_path_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::set_glyph_description_from_selected_path));
dynamic_cast<Gtk::CellRendererText*>( _GlyphsList.get_column_cell_renderer(0))->signal_edited().connect(
dynamic_cast<Gtk::CellRendererText*>( _GlyphsList.get_column_cell_renderer(1))->signal_edited().connect(
return &glyphs_vbox;
if (SP_IS_HKERN(node) && (static_cast<SPGlyphKerning*>(node))->u1->contains((gchar) first_glyph.get_active_text().c_str()[0])
&& (static_cast<SPGlyphKerning*>(node))->u2->contains((gchar) second_glyph.get_active_text().c_str()[0]) ){
_KerningPairsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::kerning_pairs_list_button_release));
create_kerning_pairs_popup_menu(_KerningPairsList, sigc::mem_fun(*this, &SvgFontsDialog::remove_selected_kerning_pair));
add_kernpair_button.signal_clicked().connect(sigc::mem_fun(*this, &SvgFontsDialog::add_kerning_pair));
_KerningPairsList.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_pair_selection_changed));
kerning_slider.signal_value_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_kerning_value_changed));
// _KerningPairsList.append_column_numeric_editable(_("Kerning Value"), _KerningPairsListColumns.kerning_value, "%f");
return &kerning_vbox;
if (!font) return;
update_fonts();
_FontsList.get_selection()->signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_font_selection_changed));
this->update_fonts();
_preview_entry.signal_changed().connect(sigc::mem_fun(*this, &SvgFontsDialog::on_preview_text_changed));
_FontsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &SvgFontsDialog::fonts_list_button_release));