aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/graph/direct/font.hpp
blob: d3376503f1de415f26b72fcbe09e951c72414be2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once
#include "com_resource.hpp"
#include "direct_factory.hpp"
#include "platform_id.hpp"

#include "cru/platform/graph/font.hpp"

#include <string_view>

namespace cru::platform::graph::win::direct {

class DWriteFont : public Font, public IComResource<IDWriteTextFormat> {
 public:
  DWriteFont(IDirectFactory* factory, const std::wstring_view& font_family,
             float font_size);

  DWriteFont(const DWriteFont& other) = delete;
  DWriteFont& operator=(const DWriteFont& other) = delete;

  DWriteFont(DWriteFont&& other) = delete;
  DWriteFont& operator=(DWriteFont&& other) = delete;

  ~DWriteFont() override = default;

  CRU_PLATFORMID_IMPLEMENT_DIRECT

 public:
  IDWriteTextFormat* GetComInterface() const override { return text_format_.Get(); }

 private:
  Microsoft::WRL::ComPtr<IDWriteTextFormat> text_format_;
};
}  // namespace cru::platform::graph::win::direct