ASPiK SDK
d2dfont.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __d2dfont__
6 #define __d2dfont__
7 
8 #include "../../iplatformfont.h"
9 
10 #if WINDOWS && VSTGUI_DIRECT2D_SUPPORT
11 
12 struct IDWriteTextFormat;
13 struct IDWriteTextLayout;
14 
15 namespace VSTGUI {
16 
17 //-----------------------------------------------------------------------------
18 class D2DFont : public IPlatformFont, public IFontPainter
19 {
20 public:
21  D2DFont (const UTF8String& name, const CCoord& size, const int32_t& style);
22 
23  IDWriteTextLayout* createTextLayout (IPlatformString* string) const;
24 
25  static bool getAllPlatformFontFamilies (std::list<std::string>& fontFamilyNames);
26 
27 protected:
28  ~D2DFont ();
29 
30  double getAscent () const override { return ascent; }
31  double getDescent () const override { return descent; }
32  double getLeading () const override { return leading; }
33  double getCapHeight () const override { return capHeight; }
34 
35  const IFontPainter* getPainter () const override { return this; }
36 
37  void drawString (CDrawContext* context, IPlatformString* string, const CPoint& p, bool antialias = true) const override;
38  CCoord getStringWidth (CDrawContext* context, IPlatformString* string, bool antialias = true) const override;
39 
40  IDWriteTextFormat* textFormat;
41  double ascent;
42  double descent;
43  double leading;
44  double capHeight;
45  int32_t style;
46 };
47 
48 } // namespace
49 
50 #endif // WINDOWS && VSTGUI_DIRECT2D_SUPPORT
51 
52 #endif // __d2dfont__
Definition: customcontrols.cpp:8