aboutsummaryrefslogtreecommitdiff
path: root/src/win/graphics/direct/Font.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/win/graphics/direct/Font.cpp')
-rw-r--r--src/win/graphics/direct/Font.cpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/win/graphics/direct/Font.cpp b/src/win/graphics/direct/Font.cpp
deleted file mode 100644
index 9e493948..00000000
--- a/src/win/graphics/direct/Font.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "cru/win/graphics/direct/Font.h"
-
-#include "cru/common/Format.h"
-#include "cru/win/graphics/direct/Exception.h"
-#include "cru/win/graphics/direct/Factory.h"
-
-#include <array>
-#include <utility>
-
-namespace cru::platform::graphics::win::direct {
-DWriteFont::DWriteFont(DirectGraphicsFactory* factory, String font_family,
- float font_size)
- : DirectGraphicsResource(factory), font_family_(std::move(font_family)) {
- // Get locale
- std::array<wchar_t, LOCALE_NAME_MAX_LENGTH> buffer;
- if (!::GetUserDefaultLocaleName(buffer.data(),
- static_cast<int>(buffer.size())))
- throw platform::win::Win32Error(
- ::GetLastError(), u"Failed to get locale when create dwrite font.");
-
- ThrowIfFailed(factory->GetDWriteFactory()->CreateTextFormat(
- reinterpret_cast<const wchar_t*>(font_family_.c_str()), 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_LEADING));
- ThrowIfFailed(
- text_format_->SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR));
-}
-
-String DWriteFont::GetFontName() { return font_family_; }
-
-float DWriteFont::GetFontSize() { return text_format_->GetFontSize(); }
-} // namespace cru::platform::graphics::win::direct