aboutsummaryrefslogtreecommitdiff
path: root/include/cru/win/graphics/direct/Font.h
blob: 0d0dd28baa805b47d65913280ba11a53c97d6ef3 (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
34
35
#pragma once
#include "ComResource.h"
#include "Resource.h"

#include "cru/platform/graphics/Font.h"

#include <string_view>

namespace cru::platform::graphics::win::direct {
class CRU_WIN_GRAPHICS_DIRECT_API DWriteFont
    : public DirectGraphicsResource,
      public virtual IFont,
      public virtual IComResource<IDWriteTextFormat> {
 public:
  DWriteFont(DirectGraphicsFactory* factory, String font_family,
             float font_size);

  CRU_DELETE_COPY(DWriteFont)
  CRU_DELETE_MOVE(DWriteFont)

  ~DWriteFont() override = default;

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

  String GetFontName() override;
  float GetFontSize() override;

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