Home | History | Annotate | Download | only in win32
      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 _FX_DIRECT_WRITE_
      8 #define _FX_DIRECT_WRITE_
      9 #ifndef DECLSPEC_UUID
     10 #if (_MSC_VER >= 1100) && defined (__cplusplus)
     11 #define DECLSPEC_UUID(x)    __declspec(uuid(x))
     12 #else
     13 #define DECLSPEC_UUID(x)
     14 #endif
     15 #endif
     16 #ifndef DECLSPEC_NOVTABLE
     17 #if (_MSC_VER >= 1100) && defined(__cplusplus)
     18 #define DECLSPEC_NOVTABLE   __declspec(novtable)
     19 #else
     20 #define DECLSPEC_NOVTABLE
     21 #endif
     22 #endif
     23 #if(WINVER < 0x0500)
     24 #ifndef _MAC
     25 DECLARE_HANDLE(HMONITOR);
     26 #endif
     27 #endif
     28 class CDWriteExt
     29 {
     30 public:
     31     CDWriteExt();
     32     ~CDWriteExt();
     33 
     34     void			Load();
     35     void            Unload();
     36 
     37     FX_BOOL			IsAvailable()
     38     {
     39         return m_pDWriteFactory != NULL;
     40     }
     41 
     42     void*			DwCreateFontFaceFromStream(FX_LPBYTE pData, FX_DWORD size, int simulation_style);
     43     FX_BOOL         DwCreateRenderingTarget(CFX_DIBitmap* pSrc, void** renderTarget);
     44     void            DwDeleteRenderingTarget(void* renderTarget);
     45     FX_BOOL			DwRendingString(void* renderTarget, CFX_ClipRgn* pClipRgn, FX_RECT& stringRect, CFX_AffineMatrix* pMatrix,
     46                                     void *font, FX_FLOAT font_size, FX_ARGB text_color,
     47                                     int glyph_count, unsigned short* glyph_indices,
     48                                     FX_FLOAT baselineOriginX, FX_FLOAT baselineOriginY,
     49                                     void* glyph_offsets,
     50                                     FX_FLOAT* glyph_advances);
     51     void			DwDeleteFont(void* pFont);
     52 
     53 protected:
     54     void*			m_hModule;
     55     void*			m_pDWriteFactory;
     56     void*		    m_pDwFontContext;
     57     void*	        m_pDwTextRenderer;
     58 };
     59 #endif
     60