aboutsummaryrefslogtreecommitdiff
path: root/CruUI/graph/graph.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2018-09-23 17:58:28 +0800
committercrupest <crupest@outlook.com>2018-09-23 17:58:28 +0800
commit09864c09e519eaa58e3a7269baad7f48e8145f4f (patch)
treea494ea818ae485c22259d6e9d9f3c04b484c8499 /CruUI/graph/graph.cpp
parent95d54b36044196b7e996a188840ae8b1ef360895 (diff)
downloadcru-09864c09e519eaa58e3a7269baad7f48e8145f4f.tar.gz
cru-09864c09e519eaa58e3a7269baad7f48e8145f4f.tar.bz2
cru-09864c09e519eaa58e3a7269baad7f48e8145f4f.zip
Move CreateDefaultTextFormat to graph.
Diffstat (limited to 'CruUI/graph/graph.cpp')
-rw-r--r--CruUI/graph/graph.cpp20
1 files changed, 20 insertions, 0 deletions
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<IDWriteTextFormat> CreateDefaultTextFormat()
+ {
+ const auto dwrite_factory = GraphManager::GetInstance()->GetDWriteFactory();
+
+ ComPtr<IDWriteTextFormat> 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;
+ }
}
}