diff options
| author | crupest <crupest@outlook.com> | 2019-06-27 00:18:48 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2019-06-27 00:18:48 +0800 |
| commit | baa7cf141b8121473edceae16c1a20a6d47bd202 (patch) | |
| tree | 9349633a9d0bc286fe29f480bd70e4c2ad1f3075 /src/win/graph/win_font.cpp | |
| parent | f404a3b2eb7bb9865d0c6f938538899996a53d8c (diff) | |
| download | cru-baa7cf141b8121473edceae16c1a20a6d47bd202.tar.gz cru-baa7cf141b8121473edceae16c1a20a6d47bd202.tar.bz2 cru-baa7cf141b8121473edceae16c1a20a6d47bd202.zip | |
......
Diffstat (limited to 'src/win/graph/win_font.cpp')
| -rw-r--r-- | src/win/graph/win_font.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/win/graph/win_font.cpp b/src/win/graph/win_font.cpp deleted file mode 100644 index a359d73e..00000000 --- a/src/win/graph/win_font.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "cru/win/graph/win_font.hpp" - -#include "cru/win/exception.hpp" -#include "cru/win/graph/win_native_factory.hpp" - -#include <array> -#include <cassert> -#include <utility> - -namespace cru::win::graph { -WinFontDescriptor::WinFontDescriptor(IWinNativeFactory* factory, - const std::wstring_view& font_family, - float font_size) { - assert(factory); - std::array<wchar_t, LOCALE_NAME_MAX_LENGTH> buffer; - if (!::GetUserDefaultLocaleName(buffer.data(), - static_cast<int>(buffer.size()))) - throw Win32Error(::GetLastError(), "Failed to get locale."); - - ThrowIfFailed(factory->GetDWriteFactory()->CreateTextFormat( - font_family.data(), nullptr, DWRITE_FONT_WEIGHT_NORMAL, - DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, font_size, - buffer.data(), &text_format_)); - - ThrowIfFailed(text_format_->SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER)); - ThrowIfFailed( - text_format_->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER)); -} -} // namespace cru::win::graph |
