source: trunk/src/gdi32/ft2supp.h@ 22012

Last change on this file since 22012 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 4.6 KB
Line 
1/*
2 * GDI32 FreeType2 Support Class
3 *
4 * Copyright 2003 Innotek Systemberatung GmbH (stauff@innotek.de)
5 *
6 * Project Odin Software License can be found in LICENSE.TXT
7 *
8 */
9
10#ifndef __FT2SUPP_H__
11#define __FT2SUPP_H__
12
13#include <odin.h>
14#include "oslibgpi.h"
15#include <winconst.h>
16#include <win32type.h>
17#include <ft2lib.h>
18
19#ifndef GDI_ERROR
20#define GDI_ERROR 0xffffffff
21#endif
22
23typedef int ( SYSTEM _FT2FN) ();
24typedef _FT2FN *PFT2FN;
25
26#define FT2LIBNAME "ft2lib.dll"
27#define FT2LIB_MAJOR_VERSION 2
28#define FT2LIB_MINOR_VERSION 3
29
30// Add here function pointer typedefs to funcs that we will use
31typedef ULONG (* SYSTEM PFN_FT2GETGLYPHINDICES)(HPS, WCHAR *, int, ULONG *, ULONG );
32
33typedef BOOL (* SYSTEM PFN_FT2GETTEXTEXTENTW)(HPS hps, LONG lCount1,LPCWSTR pchString,LONG lCount2,PPOINTLOS2 aptlPoints);
34typedef BOOL (* SYSTEM PFN_FT2CHARSTRINGPOSATA)(HPS hps,PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCSTR pchString,CONST INT *alAdx, ULONG fuWin32Options);
35typedef BOOL (* SYSTEM PFN_FT2CHARSTRINGPOSATW)(HPS hps,PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCWSTR pchString,CONST INT *alAdx, ULONG fuWin32Options);
36typedef DWORD (* SYSTEM PFN_FT2GETGLYPHOUTLINE)(HPS hps, UINT glyph, UINT format, LPGLYPHMETRICS lpgm, DWORD buflen, LPVOID buf, const MAT2* lpmat);
37typedef DWORD (* SYSTEM PFN_FT2GETFONTDATA)(HPS hps, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData);
38typedef DWORD (* SYSTEM PFN_FT2QUERYFONTTYPE)(HPS hps, LPCSTR lpszFontName);
39typedef BOOL (* SYSTEM PFN_FT2QUERYSTRINGWIDTHW)(HPS hps, LPWSTR lpszString, UINT cbString, LONG *pWidthArray);
40typedef DWORD (* SYSTEM PFN_FT2GETCHARACTERPLACEMENTW)(HDC hdc, LPCWSTR lpString, int uCount,
41 int nMaxExtent, GCP_RESULTSW *lpResults,
42 DWORD dwFlags);
43
44typedef INT (* WIN32API PFN_MULTIBYTETOWIDECHAR)(UINT page, DWORD flags, LPCSTR src, INT srclen,
45 LPWSTR dst, INT dstlen);
46typedef INT (* WIN32API PFN_WIDECHARTOMULTIBYTE)(UINT page, DWORD flags, LPCWSTR src, INT srclen,
47 LPSTR dst, INT dstlen, LPCSTR defchar, BOOL *used);
48typedef void (* SYSTEM PFN_FT2REGISTERUCONV)(PFN_WIDECHARTOMULTIBYTE pfnWideCharToMultiByte, PFN_MULTIBYTETOWIDECHAR pfnMultiByteToWideChar);
49
50typedef BOOL (* SYSTEM PFN_FT2ENABLEFONTENGINE)(BOOL fEnable);
51
52typedef VOID (* SYSTEM PFN_FT2GETVERSION)(LONG *plMajor, LONG *plMinor, LONG *plBuildNumber);
53
54class CFT2Module {
55 private:
56 // Handle for our module
57 HMODULE hftModule;
58 const char *pszModuleName;
59
60 PFN_FT2GETGLYPHINDICES pfnGetGlyphIndices;
61 PFN_FT2GETTEXTEXTENTW pfnFt2GetTextExtentW;
62 PFN_FT2CHARSTRINGPOSATA pfnFt2CharStringPosAtA;
63 PFN_FT2CHARSTRINGPOSATW pfnFt2CharStringPosAtW;
64 PFN_FT2GETGLYPHOUTLINE pfnFt2GetGlyphOutline;
65 PFN_FT2GETFONTDATA pfnFt2GetFontData;
66 PFN_FT2QUERYFONTTYPE pfnFt2QueryFontType;
67 PFN_FT2REGISTERUCONV pfnFt2RegisterUconv;
68 PFN_FT2QUERYSTRINGWIDTHW pfnFt2QueryStringWidthW;
69 PFN_FT2GETCHARACTERPLACEMENTW pfnFt2GetCharacterPlacementW;
70 PFN_FT2ENABLEFONTENGINE pfnFt2EnableFontEngine;
71 PFN_FT2GETVERSION pfnFt2GetVersion;
72
73 // Indicator of enabled state
74 BOOL bEnabled;
75 PFT2FN QueryProcAddress( int );
76 PFT2FN QueryProcAddress( const char* );
77
78 public:
79 // Constructor
80 CFT2Module( const char* modulename = FT2LIBNAME );
81 ~CFT2Module();
82 void init();
83
84
85 // Functions we may call
86
87 BOOL isEnabled() { return bEnabled; };
88
89 DWORD Ft2GetGlyphIndices(HPS hps, LPCWSTR str, int c, LPWORD pgi, DWORD fl);
90 DWORD Ft2GetGlyphOutline(HPS hps, UINT glyph, UINT format, LPGLYPHMETRICS lpgm, DWORD buflen, LPVOID buf, const MAT2* lpmat);
91
92 BOOL Ft2GetTextExtentW(HPS hps, LONG lCount1,LPCWSTR pchString, PPOINTLOS2 pwidthHeight);
93 BOOL Ft2CharStringPosAtA(HPS hps,PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCSTR pchString,CONST INT *alAdx, ULONG fuWin32Options);
94 BOOL Ft2CharStringPosAtW(HPS hps,PPOINTLOS2 ptl,PRECTLOS2 rct,ULONG flOptions,LONG lCount,LPCWSTR pchString,CONST INT *alAdx, ULONG fuWin32Options);
95
96 BOOL Ft2GetStringWidthW(HDC hdc, LPWSTR lpszString, UINT cbString, PINT pWidthArray);
97
98 DWORD Ft2GetCharacterPlacementW(HDC hdc, LPCWSTR lpString, int uCount,
99 int nMaxExtent, GCP_RESULTSW *lpResults,
100 DWORD dwFlags);
101
102 DWORD Ft2GetFontData(HPS hps, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData);
103
104 DWORD Ft2QueryFontType(HPS hps, LPCSTR lpszFontName);
105
106};
107
108extern CFT2Module FT2Module;
109
110#endif // __FT2SUPP_H__
Note: See TracBrowser for help on using the repository browser.