• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef CORE_FXGE_WIN32_DWRITE_INT_H_
8 #define CORE_FXGE_WIN32_DWRITE_INT_H_
9 
10 #include "core/fxcrt/fx_coordinates.h"
11 #include "core/fxge/dib/cfx_dibitmap.h"
12 #include "core/fxge/fx_dib.h"
13 
14 #ifndef DECLSPEC_UUID
15 #if defined(__cplusplus)
16 #define DECLSPEC_UUID(x) __declspec(uuid(x))
17 #else
18 #define DECLSPEC_UUID(x)
19 #endif
20 #endif
21 #ifndef DECLSPEC_NOVTABLE
22 #if defined(__cplusplus)
23 #define DECLSPEC_NOVTABLE __declspec(novtable)
24 #else
25 #define DECLSPEC_NOVTABLE
26 #endif
27 #endif
28 #if (WINVER < 0x0500)
29 #ifndef _MAC
30 DECLARE_HANDLE(HMONITOR);
31 #endif
32 #endif
33 class CDWriteExt {
34  public:
35   CDWriteExt();
36   ~CDWriteExt();
37 
38   void Load();
39   void Unload();
40 
IsAvailable()41   bool IsAvailable() { return !!m_pDWriteFactory; }
42 
43   void* DwCreateFontFaceFromStream(uint8_t* pData,
44                                    uint32_t size,
45                                    int simulation_style);
46   bool DwCreateRenderingTarget(const RetainPtr<CFX_DIBitmap>& pSrc,
47                                void** renderTarget);
48   void DwDeleteRenderingTarget(void* renderTarget);
49   bool DwRendingString(void* renderTarget,
50                        CFX_ClipRgn* pClipRgn,
51                        FX_RECT& stringRect,
52                        CFX_Matrix* pMatrix,
53                        void* font,
54                        float font_size,
55                        FX_ARGB text_color,
56                        int glyph_count,
57                        unsigned short* glyph_indices,
58                        float baselineOriginX,
59                        float baselineOriginY,
60                        void* glyph_offsets,
61                        float* glyph_advances);
62   void DwDeleteFont(void* pFont);
63 
64  protected:
65   void* m_hModule;
66   void* m_pDWriteFactory;
67   void* m_pDwFontContext;
68   void* m_pDwTextRenderer;
69 };
70 
71 #endif  // CORE_FXGE_WIN32_DWRITE_INT_H_
72