configure: Changes from running autconf after previous patch.
[wine/hacks.git] / dlls / winedib.drv / freetype.h
blob3517af551f82c2686966c82da440badda6dc0a98
1 /*
2 * Truetype font functions
4 * Copyright 2008 Massimo Del Fedele
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_DIBDRV_FREETYPE_H
20 #define __WINE_DIBDRV__FREETYPE_H
22 /* freetype library for font support */
23 #ifdef HAVE_FREETYPE
25 #include <ft2build.h>
26 #include FT_FREETYPE_H
27 #include FT_GLYPH_H
28 #include FT_TRUETYPE_TABLES_H
29 #include FT_SFNT_NAMES_H
30 #include FT_TRUETYPE_IDS_H
31 #include FT_BITMAP_H
33 /* freetype library handle */
34 extern FT_Library DIBDRV_ftLibrary;
36 /******************************************************************************************/
37 /* FREETYPE STUFFS */
38 /* grabbed from winex11.drv/freetype.c */
39 /******************************************************************************************/
41 /* This is basically a copy of FT_Bitmap_Size with an extra element added */
42 typedef struct {
43 FT_Short height;
44 FT_Short width;
45 FT_Pos size;
46 FT_Pos x_ppem;
47 FT_Pos y_ppem;
48 FT_Short internal_leading;
49 } Bitmap_Size;
51 /* FT_Bitmap_Size gained 3 new elements between FreeType 2.1.4 and 2.1.5
52 So to let this compile on older versions of FreeType we'll define the
53 new structure here. */
54 typedef struct {
55 FT_Short height, width;
56 FT_Pos size, x_ppem, y_ppem;
57 } My_FT_Bitmap_Size;
59 struct enum_data
61 ENUMLOGFONTEXW elf;
62 NEWTEXTMETRICEXW ntm;
63 DWORD type;
66 typedef struct tagFace {
67 struct list entry;
68 WCHAR *StyleName;
69 char *file;
70 void *font_data_ptr;
71 DWORD font_data_size;
72 FT_Long face_index;
73 FONTSIGNATURE fs;
74 FONTSIGNATURE fs_links;
75 DWORD ntmFlags;
76 FT_Fixed font_version;
77 BOOL scalable;
78 Bitmap_Size size; /* set if face is a bitmap */
79 BOOL external; /* TRUE if we should manually add this font to the registry */
80 struct tagFamily *family;
81 /* Cached data for Enum */
82 struct enum_data *cached_enum_data;
83 } Face;
85 typedef struct tagFamily {
86 struct list entry;
87 const WCHAR *FamilyName;
88 struct list faces;
89 } Family;
91 typedef struct {
92 GLYPHMETRICS gm;
93 INT adv; /* These three hold to widths of the unrotated chars */
94 INT lsb;
95 INT bbx;
96 BOOL init;
97 } GM;
99 typedef struct {
100 FLOAT eM11, eM12;
101 FLOAT eM21, eM22;
102 } FMAT2;
104 typedef struct {
105 DWORD hash;
106 LOGFONTW lf;
107 FMAT2 matrix;
108 BOOL can_use_bitmap;
109 } FONT_DESC;
111 typedef struct tagHFONTLIST {
112 struct list entry;
113 HFONT hfont;
114 } HFONTLIST;
116 typedef struct {
117 struct list entry;
118 Face *face;
119 struct tagGdiFont *font;
120 } CHILD_FONT;
122 typedef struct tagGdiFont {
123 struct list entry;
124 GM **gm;
125 DWORD gmsize;
126 struct list hfontlist;
127 OUTLINETEXTMETRICW *potm;
128 DWORD total_kern_pairs;
129 KERNINGPAIR *kern_pairs;
130 struct list child_fonts;
132 /* the following members can be accessed without locking, they are never modified after creation */
133 FT_Face ft_face;
134 struct font_mapping *mapping;
135 LPWSTR name;
136 int charset;
137 int codepage;
138 BOOL fake_italic;
139 BOOL fake_bold;
140 BYTE underline;
141 BYTE strikeout;
142 INT orientation;
143 FONT_DESC font_desc;
144 LONG aveWidth, ppem;
145 double scale_y;
146 SHORT yMax;
147 SHORT yMin;
148 DWORD ntmFlags;
149 FONTSIGNATURE fs;
150 struct tagGdiFont *base_font;
151 VOID *GSUB_Table;
152 DWORD cache_num;
153 } GdiFont;
155 /* initialize freetype library */
156 BOOL _DIBDRV_FreeType_Init(void);
158 /* terminates freetype library */
159 void _DIBDRV_FreeType_Terminate(void);
161 #define MAKE_FUNCPTR(f) extern typeof(f) * p##f;
162 MAKE_FUNCPTR(FT_Done_Face)
163 MAKE_FUNCPTR(FT_Done_FreeType)
164 MAKE_FUNCPTR(FT_Get_Char_Index)
165 MAKE_FUNCPTR(FT_Get_Glyph_Name)
166 MAKE_FUNCPTR(FT_Get_Sfnt_Name)
167 MAKE_FUNCPTR(FT_Get_Sfnt_Name_Count)
168 MAKE_FUNCPTR(FT_Get_Sfnt_Table)
169 MAKE_FUNCPTR(FT_Init_FreeType)
170 MAKE_FUNCPTR(FT_Load_Glyph)
171 MAKE_FUNCPTR(FT_Load_Char)
172 MAKE_FUNCPTR(FT_Get_Glyph)
173 MAKE_FUNCPTR(FT_Glyph_Copy)
174 MAKE_FUNCPTR(FT_Glyph_To_Bitmap)
175 MAKE_FUNCPTR(FT_Done_Glyph)
176 MAKE_FUNCPTR(FT_New_Face)
177 MAKE_FUNCPTR(FT_Set_Charmap)
178 MAKE_FUNCPTR(FT_Set_Char_Size)
179 MAKE_FUNCPTR(FT_Set_Pixel_Sizes)
180 MAKE_FUNCPTR(FT_Get_First_Char)
181 MAKE_FUNCPTR(FT_Render_Glyph)
182 MAKE_FUNCPTR(FT_Glyph_Transform)
183 MAKE_FUNCPTR(FT_Bitmap_New)
184 MAKE_FUNCPTR(FT_Bitmap_Done)
185 MAKE_FUNCPTR(FT_Bitmap_Convert)
186 #undef MAKE_FUNCPTR
188 #endif /* HAVE_FREETYPE */
190 #endif