From 09864c09e519eaa58e3a7269baad7f48e8145f4f Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 23 Sep 2018 17:58:28 +0800 Subject: Move CreateDefaultTextFormat to graph. --- CruUI/graph/graph.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'CruUI/graph/graph.cpp') diff --git a/CruUI/graph/graph.cpp b/CruUI/graph/graph.cpp index 94c7029e..77d7044e 100644 --- a/CruUI/graph/graph.cpp +++ b/CruUI/graph/graph.cpp @@ -221,5 +221,25 @@ namespace cru { device_context->CreateSolidColorBrush(color, &solid_color_brush); return solid_color_brush; } + + ComPtr CreateDefaultTextFormat() + { + const auto dwrite_factory = GraphManager::GetInstance()->GetDWriteFactory(); + + ComPtr text_format; + + ThrowIfFailed(dwrite_factory->CreateTextFormat( + L"µÈÏß", nullptr, + DWRITE_FONT_WEIGHT_NORMAL, + DWRITE_FONT_STYLE_NORMAL, + DWRITE_FONT_STRETCH_NORMAL, + 24.0, L"zh-cn", + &text_format + )); + + ThrowIfFailed(text_format->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER)); + ThrowIfFailed(text_format->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER)); + return text_format; + } } } -- cgit v1.2.3 From 5eb05140c67db521654f5b7e69c2eacf332588f6 Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 23 Sep 2018 18:42:06 +0800 Subject: Fix the file encoding. --- CruUI/graph/graph.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CruUI/graph/graph.cpp') diff --git a/CruUI/graph/graph.cpp b/CruUI/graph/graph.cpp index 77d7044e..30b51413 100644 --- a/CruUI/graph/graph.cpp +++ b/CruUI/graph/graph.cpp @@ -216,7 +216,7 @@ namespace cru { ComPtr CreateSolidBrush(const D2D1_COLOR_F& color) { - const auto device_context = graph::GraphManager::GetInstance()->GetD2D1DeviceContext(); + const auto device_context = GraphManager::GetInstance()->GetD2D1DeviceContext(); ComPtr solid_color_brush; device_context->CreateSolidColorBrush(color, &solid_color_brush); return solid_color_brush; @@ -229,7 +229,7 @@ namespace cru { ComPtr text_format; ThrowIfFailed(dwrite_factory->CreateTextFormat( - L"µÈÏß", nullptr, + L"等线", nullptr, DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, -- cgit v1.2.3