summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/widget/font-selector.cpp34
-rw-r--r--src/ui/widget/font-selector.h2
-rw-r--r--src/ui/widget/font-variations.cpp1
3 files changed, 24 insertions, 13 deletions
diff --git a/src/ui/widget/font-selector.cpp b/src/ui/widget/font-selector.cpp
index dd33940fc..2263862a0 100644
--- a/src/ui/widget/font-selector.cpp
+++ b/src/ui/widget/font-selector.cpp
@@ -219,8 +219,10 @@ FontSelector::update_size (double size)
}
+// If use_variations is true (default), we get variation values from variations widget otherwise we
+// get values from CSS widget (we need to be able to keep the two widgets synchronized both ways).
Glib::ustring
-FontSelector::get_fontspec() {
+FontSelector::get_fontspec(bool use_variations) {
// Build new fontspec from GUI settings
Glib::ustring family = "Sans"; // Default...family list may not have been constructed.
@@ -243,18 +245,23 @@ FontSelector::get_fontspec() {
std::cerr << "FontSelector::get_fontspec: empty style!" << std::endl;
}
- // Clip any font_variation data in 'style' as we'll replace it.
- if (auto pos = style.find('@') != Glib::ustring::npos) {
- style.erase (pos, style.length()-1);
- }
+ Glib::ustring fontspec = family + " ";
- Glib::ustring variations = font_variations.get_pango_string();
+ if (use_variations) {
+ // Clip any font_variation data in 'style' as we'll replace it.
+ if (auto pos = style.find('@') != Glib::ustring::npos) {
+ style.erase (pos, style.length()-1);
+ }
- Glib::ustring fontspec = family + " ";
- if (variations.empty()) {
- fontspec += style;
+ Glib::ustring variations = font_variations.get_pango_string();
+
+ if (variations.empty()) {
+ fontspec += style;
+ } else {
+ fontspec += variations;
+ }
} else {
- fontspec += variations;
+ fontspec += style;
}
return fontspec;
@@ -350,9 +357,14 @@ FontSelector::on_family_changed() {
void
FontSelector::on_style_changed() {
-
if (signal_block) return;
+ // Update variations widget if new style selected from style widget.
+ signal_block = true;
+ Glib::ustring fontspec = get_fontspec( false );
+ font_variations.update( fontspec );
+ signal_block = false;
+
// Let world know
changed_emit();
}
diff --git a/src/ui/widget/font-selector.h b/src/ui/widget/font-selector.h
index df9057338..36458e7ba 100644
--- a/src/ui/widget/font-selector.h
+++ b/src/ui/widget/font-selector.h
@@ -124,7 +124,7 @@ public:
/**
* Get fontspec based on current settings. (Does not handle size, yet.)
*/
- Glib::ustring get_fontspec();
+ Glib::ustring get_fontspec(bool use_variations = true);
/**
* Get font size. Could be merged with fontspec.
diff --git a/src/ui/widget/font-variations.cpp b/src/ui/widget/font-variations.cpp
index d0e6090e5..20012b381 100644
--- a/src/ui/widget/font-variations.cpp
+++ b/src/ui/widget/font-variations.cpp
@@ -93,7 +93,6 @@ FontVariations::update (Glib::ustring& font_spec) {
void
FontVariations::fill_css( SPCSSAttr *css ) {
- std::cout << "FontVariations::fill_css" << std::endl;
// Eventually will want to favor using 'font-weight', etc. but at the moment these
// can't handle "fractional" values. See CSS Fonts Module Level 4.