13
0

Add API to force ArdourSans font (for UTF8 symbols)

This commit is contained in:
Robin Gareus 2022-11-07 11:55:16 +01:00
parent e8a87f31fc
commit ef6803abd1
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 18 additions and 0 deletions

View File

@ -115,6 +115,7 @@ public:
#undef UI_CONFIG_VARIABLE
#define CANVAS_FONT_VARIABLE(var,name) \
Pango::FontDescription get_##var () const { return ARDOUR_UI_UTILS::sanitized_font (var.get()); } \
Pango::FontDescription get_Ardour##var () const { return ARDOUR_UI_UTILS::ardour_font (var.get()); } \
bool set_##var (const std::string& val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
#include "canvas_vars.h"
#undef CANVAS_FONT_VARIABLE

View File

@ -284,6 +284,22 @@ ARDOUR_UI_UTILS::sanitized_font (std::string const& name)
return fd;
}
Pango::FontDescription
ARDOUR_UI_UTILS::ardour_font (std::string const& name)
{
Pango::FontDescription fd (name);
if (!fd.get_family().empty() && fd.get_family().find ("Mon") != std::string::npos) {
/* matches "ArdourMono", "Monaco" */
fd.set_family ("ArdourMono");
} else {
fd.set_family ("ArdourSans");
}
return fd;
}
Pango::FontDescription
ARDOUR_UI_UTILS::get_font_for_style (string widgetname)
{

View File

@ -75,6 +75,7 @@ unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h);
ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints);
Pango::FontDescription sanitized_font (std::string const&);
Pango::FontDescription ardour_font (std::string const&);
Pango::FontDescription get_font_for_style (std::string widgetname);
void decorate (Gtk::Window& w, Gdk::WMDecoration d);