修复c++标准设置不正确,新增utfcpp库
This commit is contained in:
@@ -3,17 +3,23 @@
|
||||
#include "mirage.h"
|
||||
#include "window/mwindow.h"
|
||||
#include "font/font_system.h"
|
||||
#include "style/mirage_style.h"
|
||||
#include "widget/widget_new.h"
|
||||
#include "widget/compound_widget/mbutton.h"
|
||||
#include "widget/leaf_widget/mtext_block.h"
|
||||
#include "widget/panel_widget/mbox.h"
|
||||
|
||||
#include "utf8.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
mirage_app::get().init();
|
||||
|
||||
auto c1 = linear_color::from_string("#FF0000");
|
||||
auto c2 = linear_color::from_string("rgb(255, 0, 0)");
|
||||
auto c3 = linear_color::from_string("rgba(255, 0, 0, 255)");
|
||||
auto name = mirage_style::get().name();
|
||||
auto version = mirage_style::get().version();
|
||||
auto author = mirage_style::get().author();
|
||||
auto description = mirage_style::get().description();
|
||||
auto license = mirage_style::get().license();
|
||||
|
||||
|
||||
auto& manager = font_manager::instance();
|
||||
manager.add_font(L"C:/Users/46944/AppData/Local/Microsoft/Windows/Fonts/MapleMono-NF-CN-Regular.ttf");
|
||||
@@ -22,7 +28,18 @@ int main(int argc, char* argv[]) {
|
||||
manager.add_font(L"C:/Windows/Fonts/seguiemj.ttf");
|
||||
|
||||
const auto& text_block = std::make_shared<mtext_block>();
|
||||
text_block->set_text(U"Hello, World! 你好,世界!\n换行测试1111,测试测试测试测试,测试测试😀🐵🙏 😃🐵🙏");
|
||||
std::stringstream ss;
|
||||
ss << "name: " << name << "\n";
|
||||
ss << "version: " << version << "\n";
|
||||
ss << "author: " << author << "\n";
|
||||
ss << "description: " << description << "\n";
|
||||
ss << "license: " << license << "\n";
|
||||
// text_block->set_text(U"Hello, World! 你好,世界!\n换行测试1111,测试测试测试测试,测试测试😀🐵🙏 😃🐵🙏");
|
||||
|
||||
const auto& utf32 = utf8::utf8to32(ss.str());
|
||||
|
||||
// const char*转换为std::u32string
|
||||
text_block->set_text(utf32);
|
||||
|
||||
const auto& text_block2 = std::make_shared<mtext_block>();
|
||||
text_block2->set_text(U"Hello, World!");
|
||||
|
||||
Reference in New Issue
Block a user