From 2d3e6c6d0216968b16bb13c1e849f7029a5b1929 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Sun, 16 Nov 2025 11:51:02 +0100 Subject: [PATCH] overlays: use std::string_view for font functions --- rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp | 4 ++-- rpcs3/Emu/RSX/Overlays/overlay_fonts.h | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp b/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp index f1df35125c..1c44566ccc 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp +++ b/rpcs3/Emu/RSX/Overlays/overlay_fonts.cpp @@ -52,13 +52,13 @@ namespace rsx return quad; } - font::font(const char* ttf_name, f32 size) + font::font(std::string_view ttf_name, f32 size) { // Convert pt to px size_px = ceilf(size * 96.f / 72.f); size_pt = size; - font_name = ttf_name; + font_name = std::string(ttf_name); initialized = true; } diff --git a/rpcs3/Emu/RSX/Overlays/overlay_fonts.h b/rpcs3/Emu/RSX/Overlays/overlay_fonts.h index c673c60ab2..5176b3d733 100644 --- a/rpcs3/Emu/RSX/Overlays/overlay_fonts.h +++ b/rpcs3/Emu/RSX/Overlays/overlay_fonts.h @@ -69,7 +69,7 @@ namespace rsx codepage* initialize_codepage(char32_t codepage_id); public: - font(const char* ttf_name, f32 size); + font(std::string_view ttf_name, f32 size); stbtt_aligned_quad get_char(char32_t c, f32& x_advance, f32& y_advance); @@ -79,7 +79,7 @@ namespace rsx std::pair get_char_offset(const char32_t* text, usz max_length, u16 max_width = -1, bool wrap = false); - bool matches(const char* name, int size) const { return static_cast(size_pt) == size && font_name == name; } + bool matches(std::string_view name, int size) const { return static_cast(size_pt) == size && font_name == name; } std::string_view get_name() const { return font_name; } f32 get_size_pt() const { return size_pt; } f32 get_size_px() const { return size_px; } @@ -97,7 +97,7 @@ namespace rsx std::vector> fonts; static fontmgr* m_instance; - font* find(const char* name, int size) + font* find(std::string_view name, int size) { for (const auto& f : fonts) { @@ -121,7 +121,7 @@ namespace rsx } } - static font* get(const char* name, int size) + static font* get(std::string_view name, int size) { if (m_instance == nullptr) m_instance = new fontmgr;