From 688fecf57409ff7e4e66f9d26dc14121e6e718e7 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 22 Dec 2023 22:00:22 +0100 Subject: ui: remove use of utf8.h --- src/frontend/mame/ui/devopt.cpp | 9 ++++----- src/frontend/mame/ui/info.cpp | 11 +++++------ src/frontend/mame/ui/ui.cpp | 6 ++---- src/frontend/mame/ui/videoopt.cpp | 10 ++++------ src/lib/util/utf8.h | 5 ----- src/mame/vtech/prestige.cpp | 2 +- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/frontend/mame/ui/devopt.cpp b/src/frontend/mame/ui/devopt.cpp index cb0574bec6c..a0b81d1303c 100644 --- a/src/frontend/mame/ui/devopt.cpp +++ b/src/frontend/mame/ui/devopt.cpp @@ -16,7 +16,6 @@ #include "screen.h" #include "util/unicode.h" -#include "util/utf8.h" #include @@ -112,8 +111,8 @@ void menu_device_config::populate_text(std::optional &layout, float layout->add_text( util::string_format( (count > 1) - ? ((clock != 0) ? " %1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : " %1$d" UTF8_MULTIPLY "%2$s\n") - : ((clock != 0) ? " %2$s %3$s" UTF8_NBSP "%4$s\n" : " %2$s\n"), + ? ((clock != 0) ? u8" %1$d×%2$s %3$s\u00a0%4$s\n" : u8" %1$d×%2$s\n") + : ((clock != 0) ? u8" %2$s %3$s\u00a0%4$s\n" : " %2$s\n"), count, name, hz, (d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz")), color); @@ -194,8 +193,8 @@ void menu_device_config::populate_text(std::optional &layout, float layout->add_text( util::string_format( (count > 1) - ? ((clock != 0) ? " %1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : " %1$d" UTF8_MULTIPLY "%2$s\n") - : ((clock != 0) ? " %2$s %3$s" UTF8_NBSP "%4$s\n" : " %2$s\n"), + ? ((clock != 0) ? u8" %1$d×%2$s %3$s\u00a0%4$s\n" : u8" %1$d×%2$s\n") + : ((clock != 0) ? u8" %2$s %3$s\u00a0%4$s\n" : " %2$s\n"), count, sound.device().name(), hz, (d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz")), color); diff --git a/src/frontend/mame/ui/info.cpp b/src/frontend/mame/ui/info.cpp index 6f71a3d6b89..813bbd4b8c8 100644 --- a/src/frontend/mame/ui/info.cpp +++ b/src/frontend/mame/ui/info.cpp @@ -24,7 +24,6 @@ #include "speaker.h" #include "util/unicode.h" -#include "util/utf8.h" #include #include @@ -435,8 +434,8 @@ std::string machine_info::game_info_string() const // if more than one, prepend a #x in front of the CPU name and display clock util::stream_format(buf, (count > 1) - ? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n") - : ((clock != 0) ? "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%2$s\n"), + ? ((clock != 0) ? u8"%1$d×%2$s %3$s\u00a0%4$s\n" : u8"%1$d×%2$s\n") + : ((clock != 0) ? u8"%2$s %3$s\u00a0%4$s\n" : "%2$s\n"), count, name, hz, (d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz")); } @@ -478,8 +477,8 @@ std::string machine_info::game_info_string() const // if more than one, prepend a #x in front of the soundchip name and display clock util::stream_format(buf, (count > 1) - ? ((clock != 0) ? "%1$d" UTF8_MULTIPLY "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%1$d" UTF8_MULTIPLY "%2$s\n") - : ((clock != 0) ? "%2$s %3$s" UTF8_NBSP "%4$s\n" : "%2$s\n"), + ? ((clock != 0) ? u8"%1$d×%2$s %3$s\u00a0%4$s\n" : u8"%1$d×%2$s\n") + : ((clock != 0) ? u8"%2$s %3$s\u00a0%4$s\n" : "%2$s\n"), count, sound.device().name(), hz, (d == 9) ? _("GHz") : (d == 6) ? _("MHz") : (d == 3) ? _("kHz") : _("Hz")); } @@ -511,7 +510,7 @@ std::string machine_info::game_info_string() const } const rectangle &visarea = screen.visible_area(); - detail = string_format("%d " UTF8_MULTIPLY " %d (%s) %s" UTF8_NBSP "Hz", + detail = string_format(u8"%d × %d (%s) %s\u00a0Hz", visarea.width(), visarea.height(), (screen.orientation() & ORIENTATION_SWAP_XY) ? "V" : "H", hz); diff --git a/src/frontend/mame/ui/ui.cpp b/src/frontend/mame/ui/ui.cpp index 3399c22742a..11c9180ab01 100644 --- a/src/frontend/mame/ui/ui.cpp +++ b/src/frontend/mame/ui/ui.cpp @@ -47,8 +47,6 @@ #include "../osd/modules/lib/osdlib.h" #include "../osd/modules/lib/osdobj_common.h" -#include "utf8.h" - #include #include #include @@ -1634,7 +1632,7 @@ int32_t mame_ui_manager::slider_volume(std::string *str, int32_t newval) int32_t curval = machine().sound().attenuation(); if (str) - *str = string_format(_("%1$3d" UTF8_NBSP "dB"), curval); + *str = string_format(_(u8"%1$3d\u00a0dB"), curval); return curval; } @@ -1770,7 +1768,7 @@ int32_t mame_ui_manager::slider_refresh(screen_device &screen, std::string *str, } if (str) - *str = string_format(_("%1$.3f" UTF8_NBSP "Hz"), screen.frame_period().as_hz()); + *str = string_format(_(u8"%1$.3f\u00a0Hz"), screen.frame_period().as_hz()); refresh = screen.frame_period().as_hz(); return floor((refresh - defrefresh) * 1000.0 + 0.5); } diff --git a/src/frontend/mame/ui/videoopt.cpp b/src/frontend/mame/ui/videoopt.cpp index 95ffca3e5e9..ae5098b9064 100644 --- a/src/frontend/mame/ui/videoopt.cpp +++ b/src/frontend/mame/ui/videoopt.cpp @@ -14,8 +14,6 @@ #include "rendlay.h" #include "rendutil.h" -#include "utf8.h" - namespace ui { @@ -151,10 +149,10 @@ void menu_video_options::populate() // add a rotate item switch (m_target.orientation()) { - case ROT0: subtext = "None"; break; - case ROT90: subtext = "CW 90" UTF8_DEGREES; break; - case ROT180: subtext = "180" UTF8_DEGREES; break; - case ROT270: subtext = "CCW 90" UTF8_DEGREES; break; + case ROT0: subtext = "None"; break; + case ROT90: subtext = u8"CW 90°"; break; + case ROT180: subtext = u8"180°"; break; + case ROT270: subtext = u8"CCW 90°"; break; } item_append(_("Rotate"), subtext, FLAG_LEFT_ARROW | FLAG_RIGHT_ARROW, reinterpret_cast(ITEM_ROTATE)); diff --git a/src/lib/util/utf8.h b/src/lib/util/utf8.h index 94aff4e45e6..5ef459d94a0 100644 --- a/src/lib/util/utf8.h +++ b/src/lib/util/utf8.h @@ -12,11 +12,6 @@ #define MAME_LIB_UTIL_UTF8_H // these are UTF-8 encoded strings for common characters -#define UTF8_NBSP "\xc2\xa0" /* non-breaking space */ - -#define UTF8_MULTIPLY "\xc3\x97" /* multiplication sign */ -#define UTF8_DEGREES "\xc2\xb0" /* degrees symbol */ - #define UTF8_LEFT "\xe2\x86\x90" /* cursor left */ #define UTF8_RIGHT "\xe2\x86\x92" /* cursor right */ #define UTF8_UP "\xe2\x86\x91" /* cursor up */ diff --git a/src/mame/vtech/prestige.cpp b/src/mame/vtech/prestige.cpp index c42cfd6420d..ea4ae8a7642 100644 --- a/src/mame/vtech/prestige.cpp +++ b/src/mame/vtech/prestige.cpp @@ -412,7 +412,7 @@ INPUT_PORTS_START( prestige ) PORT_START("KEY.2") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Mouse Up (KB)") PORT_CODE(KEYCODE_8_PAD) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("3") PORT_CODE(KEYCODE_3) - PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("'") PORT_CODE(KEYCODE_QUOTE) + PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(u8"´") PORT_CODE(KEYCODE_QUOTE) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("t") PORT_CODE(KEYCODE_T) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_HOME) PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("j") PORT_CODE(KEYCODE_J) -- cgit v1.2.3