From fa4215bfd55aaaa4d3b8c987b270df9ae4e705dc Mon Sep 17 00:00:00 2001 From: "C. J. Howard" Date: Mon, 19 Sep 2022 08:58:19 +0800 Subject: [PATCH] Move unicode conversion function to correct namespace --- src/scene/text.cpp | 5 ++--- src/type/unicode/convert.cpp | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/scene/text.cpp b/src/scene/text.cpp index a4ffd4b..9af8dd9 100644 --- a/src/scene/text.cpp +++ b/src/scene/text.cpp @@ -20,8 +20,8 @@ #include "scene/text.hpp" #include "render/vertex-attribute.hpp" #include "math/vector-operators.hpp" +#include "type/unicode/convert.hpp" #include -#include namespace scene { @@ -151,8 +151,7 @@ void text::set_content(const std::string& content) content_u8 = content; // Convert UTF-8 content to UTF-32 - std::wstring_convert, char32_t> convert; - content_u32 = convert.from_bytes(content_u8.c_str()); + content_u32 = type::unicode::u32(content_u8); // Update text in VBO update_content(); diff --git a/src/type/unicode/convert.cpp b/src/type/unicode/convert.cpp index 12228ee..c434d7c 100644 --- a/src/type/unicode/convert.cpp +++ b/src/type/unicode/convert.cpp @@ -20,7 +20,7 @@ #include "type/unicode/convert.hpp" #include -namespace font { +namespace type { namespace unicode { std::u32string u32(const std::string& u8) @@ -36,4 +36,4 @@ std::string u8(const std::u32string& u32) } } // namespace unicode -} // namespace font +} // namespace type