From c44b40afd7fb1b9959467b90d4a61d293c9719ab Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 16 Jan 2023 21:41:22 +0100 Subject: [PATCH] Indicate UTF8 literals - fixes glyph rendering with MSVC (2/2) --- gtk2_ardour/audio_clock.cc | 5 ++-- gtk2_ardour/automation_line.cc | 2 +- gtk2_ardour/beatbox_gui.cc | 4 ++-- gtk2_ardour/editor_markers.cc | 4 ++-- gtk2_ardour/editor_snapshots.cc | 2 +- gtk2_ardour/export_report.cc | 12 +++++----- gtk2_ardour/idleometer.cc | 2 +- gtk2_ardour/instrument_selector.cc | 4 ++-- gtk2_ardour/io_button.cc | 2 +- gtk2_ardour/loudness_dialog.cc | 10 ++++---- gtk2_ardour/plugin_eq_gui.cc | 10 ++++---- gtk2_ardour/region_view.cc | 8 +++---- gtk2_ardour/sfdb_ui.cc | 2 +- gtk2_ardour/step_entry.cc | 32 ++++++++++++------------- gtk2_ardour/transport_masters_dialog.cc | 2 +- gtk2_ardour/trigger_master.cc | 2 +- gtk2_ardour/utils.cc | 2 +- 17 files changed, 52 insertions(+), 53 deletions(-) diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc index 19967745a2..2f2cce7539 100644 --- a/gtk2_ardour/audio_clock.cc +++ b/gtk2_ardour/audio_clock.cc @@ -1345,12 +1345,11 @@ AudioClock::set_bbt (timecnt_t const & w) TempoMetric m (TempoMap::use()->metric_at (pos)); - /* UTF8 1/4 note and 1/8 note ♩ (\u2669) and ♪ (\u266a) are n/a on Windows */ if (m.tempo().note_type() == 4) { - snprintf (buf, sizeof(buf), "\u2669 = %.3f", m.tempo().note_types_per_minute_at_DOUBLE (pos)); + snprintf (buf, sizeof(buf), u8"\u2669 = %.3f", m.tempo().note_types_per_minute_at_DOUBLE (pos)); _left_btn.set_text (string_compose ("%1", buf), false); } else if (m.tempo().note_type() == 8) { - snprintf (buf, sizeof(buf), "\u266a = %.3f", m.tempo().note_types_per_minute_at_DOUBLE (pos)); + snprintf (buf, sizeof(buf), u8"\u266a = %.3f", m.tempo().note_types_per_minute_at_DOUBLE (pos)); _left_btn.set_text (string_compose ("%1", buf), false); } else { snprintf (buf, sizeof(buf), "1/%d = %.3f",m.tempo().note_type(), m.tempo().note_types_per_minute_at_DOUBLE (pos)); diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index 94c4c5d7b1..b37f6af714 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -381,7 +381,7 @@ AutomationLine::delta_to_string (double delta) const if (!get_uses_gain_mapping () && _desc.logarithmic) { return "x " + ARDOUR::value_as_string (_desc, delta); } else { - return "\u0394 " + ARDOUR::value_as_string (_desc, delta); + return u8"\u0394 " + ARDOUR::value_as_string (_desc, delta); } } diff --git a/gtk2_ardour/beatbox_gui.cc b/gtk2_ardour/beatbox_gui.cc index 944e671e5d..2a67676f54 100644 --- a/gtk2_ardour/beatbox_gui.cc +++ b/gtk2_ardour/beatbox_gui.cc @@ -601,9 +601,9 @@ void SequencerStepIndicator::set_text () { if (number == sv.sequencer().end_step() - 1) { - text->set ("\u21a9"); + text->set (u8"\u21a9"); } else if (number == sv.sequencer().start_step()) { - text->set ("\u21aa"); + text->set (u8"\u21aa"); } else { text->set (string_compose ("%1", number+1)); } diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index b8c8e7090f..f097038a44 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -176,7 +176,7 @@ Editor::add_new_location_internal (Location* location) } if (location->position_time_domain() == Temporal::BeatTime) { - lam->set_name ("\u266B" + location->name ()); // BEAMED EIGHTH NOTES + lam->set_name (string_compose ("%1%2", u8"\u266B", location->name ())); // BEAMED EIGHTH NOTES } if (location->is_hidden ()) { @@ -228,7 +228,7 @@ Editor::location_changed (Location *location) } if (location->position_time_domain() == Temporal::BeatTime) { - lam->set_name ("\u266B" + location->name ()); // BEAMED EIGHTH NOTES + lam->set_name (string_compose ("%1%2", u8"\u266B", location->name ())); // BEAMED EIGHTH NOTES } else { lam->set_name (location->name ()); } diff --git a/gtk2_ardour/editor_snapshots.cc b/gtk2_ardour/editor_snapshots.cc index 40510175d1..e85fa93791 100644 --- a/gtk2_ardour/editor_snapshots.cc +++ b/gtk2_ardour/editor_snapshots.cc @@ -238,7 +238,7 @@ EditorSnapshots::redisplay () Glib::DateTime gdt(Glib::DateTime::create_now_local (gsb.st_mtime)); if (_session->snap_name() == display_name) { - row[_columns.current_active] = "\u25B6"; // BLACK RIGHT-POINTING TRIANGLE + row[_columns.current_active] = u8"\u25B6"; // BLACK RIGHT-POINTING TRIANGLE } else { row[_columns.current_active] = ""; } diff --git a/gtk2_ardour/export_report.cc b/gtk2_ardour/export_report.cc index 73cd713bf8..833f6e22e5 100644 --- a/gtk2_ardour/export_report.cc +++ b/gtk2_ardour/export_report.cc @@ -685,13 +685,13 @@ ExportReport::init (const AnalysisResults & ar, bool with_file) int max_wx = 10; layout->set_font_description (UIConfiguration::instance ().get_ArdourLargeFont ()); - layout->set_text ("\u274C"); // cross mark + layout->set_text (u8"\u274C"); // cross mark layout->get_pixel_size (w, h); max_wx = std::max (max_wx, w); - layout->set_text ("\U0001F509"); // speaker icon w/1 bar + layout->set_text (u8"\U0001F509"); // speaker icon w/1 bar layout->get_pixel_size (w, h); max_wx = std::max (max_wx, w); - layout->set_text ("\u2714"); // heavy check mark + layout->set_text (u8"\u2714"); // heavy check mark layout->get_pixel_size (w, h); max_wx = std::max (max_wx, w); @@ -768,13 +768,13 @@ ExportReport::init (const AnalysisResults & ar, bool with_file) || (pi->enable[1] && dbtp > pi->level[1]) ) { cr->set_source_rgba (1, 0, .0, 1.0); - layout->set_text ("\u274C"); // cross mark + layout->set_text (u8"\u274C"); // cross mark } else if (lufs < pi->LUFS_range[1]) { cr->set_source_rgba (.6, .7, 0, 1.0); - layout->set_text ("\U0001F509"); // speaker icon w/1 bar + layout->set_text (u8"\U0001F509"); // speaker icon w/1 bar } else { cr->set_source_rgba (.1, 1, .1, 1.0); - layout->set_text ("\u2714"); // heavy check mark + layout->set_text (u8"\u2714"); // heavy check mark } int ww, hh; layout->get_pixel_size (ww, hh); diff --git a/gtk2_ardour/idleometer.cc b/gtk2_ardour/idleometer.cc index e294343180..5ae7e690eb 100644 --- a/gtk2_ardour/idleometer.cc +++ b/gtk2_ardour/idleometer.cc @@ -67,7 +67,7 @@ IdleOMeter::IdleOMeter () t->attach (*manage (new Label (_("Mean:"), ALIGN_END)), 0, 1, row, row + 1, FILL, SHRINK); t->attach (_label_avg, 1, 2, row, row + 1, FILL, SHRINK); ++row; - t->attach (*manage (new Label (_("\u03c3:"), ALIGN_END)), 0, 1, row, row + 1, FILL, SHRINK); + t->attach (*manage (new Label (_(u8"\u03c3:"), ALIGN_END)), 0, 1, row, row + 1, FILL, SHRINK); t->attach (_label_dev, 1, 2, row, row + 1, FILL, SHRINK); ++row; t->attach (*manage (new Label (_("Elapsed:"), ALIGN_END)), 0, 1, row, row + 1, FILL, SHRINK); diff --git a/gtk2_ardour/instrument_selector.cc b/gtk2_ardour/instrument_selector.cc index 8e1e0f2ec8..e5ef5fc912 100644 --- a/gtk2_ardour/instrument_selector.cc +++ b/gtk2_ardour/instrument_selector.cc @@ -145,7 +145,7 @@ InstrumentSelector::build_instrument_list() uint32_t n_outs = p->max_configurable_outputs (); if (n_outs > 2) { if (p->reconfigurable_io ()) { - suffix = string_compose(_("\u2264 %1 outs"), n_outs); + suffix = string_compose(_(u8"\u2264 %1 outs"), n_outs); } else { suffix = string_compose(_("%1 outs"), n_outs); } @@ -155,7 +155,7 @@ InstrumentSelector::build_instrument_list() uint32_t n_outs = p->max_configurable_outputs (); if (n_outs > 2) { if (p->reconfigurable_io ()) { - suffix = string_compose(_("\u2264 %1 outs"), n_outs); + suffix = string_compose(_(u8"\u2264 %1 outs"), n_outs); } else { suffix = string_compose(_("%1 outs"), n_outs); } diff --git a/gtk2_ardour/io_button.cc b/gtk2_ardour/io_button.cc index 5aa330895d..01da51130a 100644 --- a/gtk2_ardour/io_button.cc +++ b/gtk2_ardour/io_button.cc @@ -407,7 +407,7 @@ IOButtonBase::set_label (IOButtonBase& self, ARDOUR::Session& session, boost::sh } if (total_connection_count > typed_connection_count) { - label << "\u2295"; /* circled plus */ + label << u8"\u2295"; /* circled plus */ } self.set_text (label.str ()); diff --git a/gtk2_ardour/loudness_dialog.cc b/gtk2_ardour/loudness_dialog.cc index 1db16c30ba..3a2732da9a 100644 --- a/gtk2_ardour/loudness_dialog.cc +++ b/gtk2_ardour/loudness_dialog.cc @@ -774,7 +774,7 @@ LoudnessDialog::calculate_gain () _gain_norm_label.set_text (string_compose (_("%1 dB"), std::setprecision (2), std::showpos, std::fixed, _gain_norm)); if (!in_range) { _gain_exceeds_label.set_text (_("exceeds")); - _gain_total_label.set_markup (_(" \u00B140 dB")); + _gain_total_label.set_markup (_(u8" \u00B140 dB")); } else { _gain_exceeds_label.set_text (X_("")); _gain_total_label.set_markup (string_compose (_("%1 dB"), std::setw (7), std::setprecision (2), std::showpos, std::fixed, gain_db ())); @@ -819,21 +819,21 @@ LoudnessDialog::test_conformity () || (preset.enable[0] && dbfs > preset.level[0]) || (preset.enable[1] && dbtp > preset.level[1]) ) { - l = manage (new Label ("\u274C", ALIGN_CENTER)); // cross mark + l = manage (new Label (u8"\u274C", ALIGN_CENTER)); // cross mark l->modify_font (UIConfiguration::instance ().get_ArdourBigFont ()); l->modify_fg (Gtk::STATE_NORMAL, color_fail); set_tooltip (*l, "The signal is too loud."); } else if (lufs_i < preset.LUFS_range[1]) { - l = manage (new Label ("\U0001F509", ALIGN_CENTER)); // speaker icon w/1 bar + l = manage (new Label (u8"\U0001F509", ALIGN_CENTER)); // speaker icon w/1 bar l->modify_font (UIConfiguration::instance ().get_ArdourBigFont ()); l->modify_fg (Gtk::STATE_NORMAL, color_warn); set_tooltip (*l, "The signal is too quiet, but satisfies the max. loudness spec."); } else { - l = manage (new Label ("\u2714", ALIGN_CENTER)); // heavy check mark + l = manage (new Label (u8"\u2714", ALIGN_CENTER)); // heavy check mark l->modify_font (UIConfiguration::instance ().get_ArdourBigFont ()); l->modify_fg (Gtk::STATE_NORMAL, color_good); set_tooltip (*l, "Signal loudness is within the spec."); - Gtkmm2ext::set_size_request_to_display_given_text (*l, "\u274C\u2713", 0, 0); + Gtkmm2ext::set_size_request_to_display_given_text (*l, u8"\u274C\u2713", 0, 0); } t->attach (*l, col + 1, col + 2, row, row + 1, SHRINK, SHRINK, 2, 0); diff --git a/gtk2_ardour/plugin_eq_gui.cc b/gtk2_ardour/plugin_eq_gui.cc index 772574d8ea..aa594a6633 100644 --- a/gtk2_ardour/plugin_eq_gui.cc +++ b/gtk2_ardour/plugin_eq_gui.cc @@ -150,7 +150,7 @@ PluginEqGui::PluginEqGui (boost::shared_ptr pluginInsert) // Freq/dB info for mouse over _pointer_info = new Gtk::Label ("", 1, 0.5); _pointer_info->set_name ("PluginAnalysisInfoLabel"); - Gtkmm2ext::set_size_request_to_display_given_text (*_pointer_info, "10.0kHz_000.0dB_180.0\u00B0", 0, 0); + Gtkmm2ext::set_size_request_to_display_given_text (*_pointer_info, u8"10.0kHz_000.0dB_180.0\u00B0", 0, 0); // populate table attach (*manage(_analysis_area), 0, 4, 0, 1); @@ -507,7 +507,7 @@ PluginEqGui::update_pointer_info( float x) if (_phase_button->get_active ()) { float phase = 180. * _impulse_fft->phase_at_bin (i) / M_PI; ss << " " << std::setw (6) << std::setprecision (1) << std::showpos << phase; - ss << std::setw (0) << "\u00B0"; + ss << std::setw (0) << u8"\u00B0"; } _pointer_info->set_text (ss.str()); } @@ -625,9 +625,9 @@ PluginEqGui::draw_scales_phase (Gtk::Widget*, cairo_t *cr) cairo_set_source_rgb (cr, .8, .9, 0.2); if (i == 0) { - snprintf (buf,256, "0\u00b0"); + snprintf (buf,256, u8"0\u00b0"); } else { - snprintf (buf,256, "%d\u00b0", (i * 45)); + snprintf (buf,256, u8"%d\u00b0", (i * 45)); } cairo_text_extents (cr, buf, &t_ext); cairo_move_to (cr, _analysis_width - t_ext.width - t_ext.x_bearing - 2.0, y - extents.descent); @@ -648,7 +648,7 @@ PluginEqGui::draw_scales_phase (Gtk::Widget*, cairo_t *cr) y = _analysis_height / 2.0 + (float)i * (_analysis_height / 8.0) * PHASE_PROPORTION; // label - snprintf (buf,256, "-%d\u00b0", (i * 45)); + snprintf (buf,256, u8"-%d\u00b0", (i * 45)); cairo_set_source_rgb (cr, .8, .9, 0.2); cairo_text_extents (cr, buf, &t_ext); cairo_move_to (cr, _analysis_width - t_ext.width - t_ext.x_bearing - 2.0, y - extents.descent); diff --git a/gtk2_ardour/region_view.cc b/gtk2_ardour/region_view.cc index 55817c6164..223b93cdfd 100644 --- a/gtk2_ardour/region_view.cc +++ b/gtk2_ardour/region_view.cc @@ -771,14 +771,14 @@ RegionView::make_name () const // XXX nice to have some good icons for this if (_region->position_time_domain() == Temporal::BeatTime) { - str += "\u266B"; // BEAMED EIGHTH NOTES + str += u8"\u266B"; // BEAMED EIGHTH NOTES } if (_region->locked()) { - str += "\u2629"; // CROSS OF JERUSALEM + str += u8"\u2629"; // CROSS OF JERUSALEM str += _region->name(); } else if (_region->position_locked()) { - str += "\u21B9"; // LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR + str += u8"\u21B9"; // LEFTWARDS ARROW TO BAR OVER RIGHTWARDS ARROW TO BAR str += _region->name(); } else if (_region->video_locked()) { str += '['; @@ -789,7 +789,7 @@ RegionView::make_name () const } if (_region->muted()) { - str = std::string("\U0001F507") + str; // SPEAKER WITH CANCELLATION STROKE + str = std::string(u8"\U0001F507") + str; // SPEAKER WITH CANCELLATION STROKE } return str; diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index a53939fd3e..ac74a7d746 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -366,7 +366,7 @@ SoundFileBox::setup_labels (const string& filename) case 1: { Evoral::SMF::Tempo* t = smf.nth_tempo (0); assert (t); - tempomap_value.set_text (string_compose (_("%1/%2 \u2669 = %3"), + tempomap_value.set_text (string_compose (_(u8"%1/%2 \u2669 = %3"), t->numerator, t->denominator, t->tempo ())); diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index 62265de387..58dc5b3b7c 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -191,24 +191,24 @@ StepEntry::StepEntry () note_velocity_box.pack_start (velocity_fff_button, false, false); /* https://www.unicode.org/charts/PDF/U1D100.pdf */ - velocity_ppp_button.set_text ("\U0001D18F\U0001D18F\U0001D18F"); //MUSICAL SYMBOL PIANO (U+1D18F) - velocity_pp_button.set_text ("\U0001D18F\U0001D18F"); - velocity_p_button.set_text ("\U0001D18F"); - velocity_mp_button.set_text ("\U0001D190\U0001D18F"); //MUSICAL SYMBOL MEZZO (U+1D190) - velocity_mf_button.set_text ("\U0001D190\U0001D191"); - velocity_f_button.set_text ("\U0001D191"); // MUSICAL SYMBOL FORTE (U+1D191) - velocity_ff_button.set_text ("\U0001D191\U0001D191"); - velocity_fff_button.set_text ("\U0001D191\U0001D191\U0001D191"); + velocity_ppp_button.set_text (u8"\U0001D18F\U0001D18F\U0001D18F"); //MUSICAL SYMBOL PIANO (U+1D18F) + velocity_pp_button.set_text (u8"\U0001D18F\U0001D18F"); + velocity_p_button.set_text (u8"\U0001D18F"); + velocity_mp_button.set_text (u8"\U0001D190\U0001D18F"); //MUSICAL SYMBOL MEZZO (U+1D190) + velocity_mf_button.set_text (u8"\U0001D190\U0001D191"); + velocity_f_button.set_text (u8"\U0001D191"); // MUSICAL SYMBOL FORTE (U+1D191) + velocity_ff_button.set_text (u8"\U0001D191\U0001D191"); + velocity_fff_button.set_text (u8"\U0001D191\U0001D191\U0001D191"); - length_1_button.set_text ("\U0001D15D"); // MUSICAL SYMBOL WHOLE NOTE - length_2_button.set_text ("\U0001D15E"); // MUSICAL SYMBOL HALF NOTE - length_4_button.set_text ("\U0001D15F"); // MUSICAL SYMBOL QUARTER NOTE - length_8_button.set_text ("\U0001D160"); // MUSICAL SYMBOL EIGHTH NOTE - length_16_button.set_text ("\U0001D161"); // MUSICAL SYMBOL SIXTEENTH NOTE - length_32_button.set_text ("\U0001D162"); // MUSICAL SYMBOL THIRTY-SECOND NOTE - length_64_button.set_text ("\U0001D163"); // MUSICAL SYMBOL SIXTY-FOURTH NOTE + length_1_button.set_text (u8"\U0001D15D"); // MUSICAL SYMBOL WHOLE NOTE + length_2_button.set_text (u8"\U0001D15E"); // MUSICAL SYMBOL HALF NOTE + length_4_button.set_text (u8"\U0001D15F"); // MUSICAL SYMBOL QUARTER NOTE + length_8_button.set_text (u8"\U0001D160"); // MUSICAL SYMBOL EIGHTH NOTE + length_16_button.set_text (u8"\U0001D161"); // MUSICAL SYMBOL SIXTEENTH NOTE + length_32_button.set_text (u8"\U0001D162"); // MUSICAL SYMBOL THIRTY-SECOND NOTE + length_64_button.set_text (u8"\U0001D163"); // MUSICAL SYMBOL SIXTY-FOURTH NOTE - chord_button.set_text ("\U0001D1D6"); // MUSICAL SYMBOL SCANDICUS (customized in ArdourSans) + chord_button.set_text (u8"\U0001D1D6"); // MUSICAL SYMBOL SCANDICUS (customized in ArdourSans) Label* l = manage (new Label); l->set_markup ("-"); diff --git a/gtk2_ardour/transport_masters_dialog.cc b/gtk2_ardour/transport_masters_dialog.cc index 4c727ebead..ef37e3cac4 100644 --- a/gtk2_ardour/transport_masters_dialog.cc +++ b/gtk2_ardour/transport_masters_dialog.cc @@ -566,7 +566,7 @@ TransportMastersWidget::Row::update (Session* s, samplepos_t now) } string current_str (" --:--:--:--"); - string delta_str ("\u0394 ---- "); + string delta_str (u8"\u0394 ---- "); string age_str (" "); if (tm->speed_and_position (speed, pos, most_recent, when, now)) { diff --git a/gtk2_ardour/trigger_master.cc b/gtk2_ardour/trigger_master.cc index b31cf3e04c..c0b0953ae8 100644 --- a/gtk2_ardour/trigger_master.cc +++ b/gtk2_ardour/trigger_master.cc @@ -193,7 +193,7 @@ TriggerMaster::render (ArdourCanvas::Rect const& area, Cairo::RefPtrset_font_description (pfd); - layout->set_text ("\u266b"); + layout->set_text (u8"\u266b"); int tw, th; layout->get_pixel_size (tw, th); context->move_to (width / 2, height / 2); diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index c0a0dba2c0..221212958e 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -761,7 +761,7 @@ ARDOUR_UI_UTILS::samples_as_time_string (samplecnt_t s, float rate, bool show_sa snprintf (buf, sizeof (buf), "%" PRId64" spl", s); } else if (s < (rate / 1000.f)) { /* 0 .. 999 usec */ - snprintf (buf, sizeof (buf), "%.0f \u00B5s", s * 1e+6f / rate); + snprintf (buf, sizeof (buf), u8"%.0f \u00B5s", s * 1e+6f / rate); } else if (s < (rate / 100.f)) { /* 1.000 .. 9.999 ms */ snprintf (buf, sizeof (buf), "%.3f ms", s * 1e+3f / rate);