summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2018-04-29 16:49:03 +0000
committerTavmjong Bah <tavmjong@free.fr>2018-04-29 16:49:03 +0000
commite393169c252e4e9fb87b87ffc1d32671e3d5c3f2 (patch)
tree82dd36438ba161dae60dd041637150f9c7942c33 /src/ui/widget
parentUpdate style.css to improve margin and padding in #InkSpinScale (diff)
downloadinkscape-e393169c252e4e9fb87b87ffc1d32671e3d5c3f2.tar.gz
inkscape-e393169c252e4e9fb87b87ffc1d32671e3d5c3f2.zip
Bug fixes for variable fonts, especially to support the Decovar font.
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/font-selector.cpp9
-rw-r--r--src/ui/widget/font-variations.cpp13
2 files changed, 17 insertions, 5 deletions
diff --git a/src/ui/widget/font-selector.cpp b/src/ui/widget/font-selector.cpp
index 69777f528..ae2707353 100644
--- a/src/ui/widget/font-selector.cpp
+++ b/src/ui/widget/font-selector.cpp
@@ -244,7 +244,12 @@ FontSelector::get_fontspec() {
Glib::ustring variations = font_variations.get_pango_string();
- Glib::ustring fontspec = family + ", " + style + " " + variations;
+ Glib::ustring fontspec = family + " ";
+ if (variations.empty()) {
+ fontspec += style;
+ } else {
+ fontspec += variations;
+ }
return fontspec;
}
@@ -262,7 +267,7 @@ FontSelector::style_cell_data_func (Gtk::CellRenderer *renderer, Gtk::TreeIter c
(*iter).get_value(1, style);
Glib::ustring style_escaped = Glib::strescape( style );
- Glib::ustring font_desc = family + ", " + style;
+ Glib::ustring font_desc = family + " " + style;
Glib::ustring markup;
markup = "<span font='" + font_desc + "'>" + style_escaped + "</span>";
diff --git a/src/ui/widget/font-variations.cpp b/src/ui/widget/font-variations.cpp
index d0464e080..9a8317a79 100644
--- a/src/ui/widget/font-variations.cpp
+++ b/src/ui/widget/font-variations.cpp
@@ -33,11 +33,18 @@ namespace Widget {
FontVariationAxis::FontVariationAxis (Glib::ustring name, OTVarAxis& axis)
: name (name)
{
- // std::cout << "FontVariationAxis::FontVariationAxis:: name: " << name << std::endl;
+
+ // std::cout << "FontVariationAxis::FontVariationAxis:: "
+ // << " name: " << name
+ // << " min: " << axis.minimum
+ // << " max: " << axis.maximum
+ // << " val: " << axis.set_val << std::endl;
+
label = Gtk::manage( new Gtk::Label( name ) );
add( *label );
- precision = 2 - int( log10(axis.maximum - axis.minimum));
+ precision = 2 - int( log10(axis.maximum - axis.minimum));
+ if (precision < 0) precision = 0;
scale = Gtk::manage( new Gtk::Scale() );
scale->set_range (axis.minimum, axis.maximum);
@@ -129,7 +136,7 @@ FontVariations::get_pango_string() {
pango_string += "@";
for (auto axis: axes) {
- if (axis->get_value() == 0) continue; // TEMP *************
+ if (axis->get_value() == 0) continue; // TEMP: Should check against default value.
Glib::ustring name = axis->get_name();
// Translate the "named" axes. (Additional names in 'stat' table, may need to handle them.)