add markup in osd labels

This commit is contained in:
abakkk 2019-03-12 23:37:34 +01:00
parent da32878df4
commit db447b1f5b
2 changed files with 7 additions and 5 deletions

View File

@ -397,7 +397,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.color = this.currentColor.to_string(); this.currentElement.color = this.currentColor.to_string();
this._redisplay(); this._redisplay();
} }
this.emitter.emit('show-osd', this.currentColor.to_string(), null); this.emitter.emit('show-osd', `<span foreground="${this.currentColor.to_string()}">${this.currentColor.to_string()}</span>`, null);
}, },
selectShape: function(shape) { selectShape: function(shape) {
@ -435,7 +435,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.font.weight = this.currentFontWeight; this.currentElement.font.weight = this.currentFontWeight;
this._redisplay(); this._redisplay();
} }
this.emitter.emit('show-osd', FontWeightNames[this.currentFontWeight], null); this.emitter.emit('show-osd', `<span font_weight="${FontWeightNames[this.currentFontWeight].toLowerCase()}">${FontWeightNames[this.currentFontWeight]}</span>`, null);
}, },
toggleFontStyle: function() { toggleFontStyle: function() {
@ -444,7 +444,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.font.style = this.currentFontStyle; this.currentElement.font.style = this.currentFontStyle;
this._redisplay(); this._redisplay();
} }
this.emitter.emit('show-osd', FontStyleNames[this.currentFontStyle], null); this.emitter.emit('show-osd', `<span font_style="${FontStyleNames[this.currentFontStyle].toLowerCase()}">${FontStyleNames[this.currentFontStyle]}</span>`, null);
}, },
toggleFontFamily: function() { toggleFontFamily: function() {
@ -454,7 +454,7 @@ var DrawingArea = new Lang.Class({
this.currentElement.font.family = currentFontFamily; this.currentElement.font.family = currentFontFamily;
this._redisplay(); this._redisplay();
} }
this.emitter.emit('show-osd',currentFontFamily , null); this.emitter.emit('show-osd', `<span font_family="${currentFontFamily}">${currentFontFamily}</span>`, null);
}, },
toggleHelp: function() { toggleHelp: function() {

View File

@ -292,8 +292,10 @@ var AreaManager = new Lang.Class({
showOsd: function(emitter, label, level, maxLevel) { showOsd: function(emitter, label, level, maxLevel) {
let activeIndex = this.areas.indexOf(this.activeArea); let activeIndex = this.areas.indexOf(this.activeArea);
if (activeIndex != -1) if (activeIndex != -1) {
Main.osdWindowManager.show(activeIndex, this.enterGicon, label, level, maxLevel); Main.osdWindowManager.show(activeIndex, this.enterGicon, label, level, maxLevel);
Main.osdWindowManager._osdWindows[activeIndex]._label.get_clutter_text().set_use_markup(true);
}
}, },
removeAreas: function() { removeAreas: function() {