ReactOS  0.4.14-dev-583-g2a1ba2c
wgl_font.c File Reference
#include "opengl32.h"
#include <math.h>
Include dependency graph for wgl_font.c:

Go to the source code of this file.

Classes

struct  _bezier_vector
 

Macros

#define GLU_TESS_BEGIN   100100
 
#define GLU_TESS_VERTEX   100101
 
#define GLU_TESS_END   100102
 
#define LOAD_FUNCPTR(f)   p##f = (void *)GetProcAddress( module, #f )
 

Typedefs

typedef struct GLUtesselator GLUtesselator
 
typedef void(WINAPI_GLUfuncptr) (void)
 
typedef struct _bezier_vector bezier_vector
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (wgl)
 
static BOOL wglUseFontBitmaps_common (HDC hdc, DWORD first, DWORD count, DWORD listBase, BOOL unicode)
 
BOOL WINAPI wglUseFontBitmapsA (HDC hdc, DWORD first, DWORD count, DWORD listBase)
 
BOOL WINAPI wglUseFontBitmapsW (HDC hdc, DWORD first, DWORD count, DWORD listBase)
 
static GLUtesselator *WINAPIpgluNewTess (void)
 
static void (WINAPI *pgluDeleteTess)(GLUtesselator *tess)
 
static HMODULE load_libglu (void)
 
static void fixed_to_double (POINTFX fixed, UINT em_size, GLdouble vertex[3])
 
static void WINAPI tess_callback_vertex (GLvoid *vertex)
 
static void WINAPI tess_callback_begin (GLenum which)
 
static void WINAPI tess_callback_end (void)
 
static double bezier_deviation_squared (const bezier_vector *p)
 
static int bezier_approximate (const bezier_vector *p, bezier_vector *points, FLOAT deviation)
 
static BOOL wglUseFontOutlines_common (HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf, BOOL unicode)
 
BOOL WINAPI wglUseFontOutlinesA (HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
 
BOOL WINAPI wglUseFontOutlinesW (HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf)
 

Variables

static GLdouble x
 
static GLdouble GLdouble y
 
static GLdouble GLdouble GLdouble z
 
static voidpolygon_data
 
static GLenum which
 
static GLenum _GLUfuncptr fn
 
static GLdoublelocation
 
static GLdouble GLvoiddata
 

Macro Definition Documentation

◆ GLU_TESS_BEGIN

#define GLU_TESS_BEGIN   100100

Definition at line 150 of file wgl_font.c.

◆ GLU_TESS_END

#define GLU_TESS_END   100102

Definition at line 152 of file wgl_font.c.

◆ GLU_TESS_VERTEX

#define GLU_TESS_VERTEX   100101

Definition at line 151 of file wgl_font.c.

◆ LOAD_FUNCPTR

#define LOAD_FUNCPTR (   f)    p##f = (void *)GetProcAddress( module, #f )

Typedef Documentation

◆ _GLUfuncptr

typedef void(WINAPI * _GLUfuncptr) (void)

Definition at line 148 of file wgl_font.c.

◆ bezier_vector

◆ GLUtesselator

Definition at line 147 of file wgl_font.c.

Function Documentation

◆ bezier_approximate()

static int bezier_approximate ( const bezier_vector p,
bezier_vector points,
FLOAT  deviation 
)
static

Definition at line 257 of file wgl_font.c.

258 {
259  bezier_vector first_curve[3];
260  bezier_vector second_curve[3];
262  int total_vertices;
263 
264  if(bezier_deviation_squared(p) <= deviation*deviation)
265  {
266  if(points)
267  *points = p[2];
268  return 1;
269  }
270 
271  vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4;
272  vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4;
273 
274  first_curve[0] = p[0];
275  first_curve[1].x = (p[0].x + p[1].x)/2;
276  first_curve[1].y = (p[0].y + p[1].y)/2;
277  first_curve[2] = vertex;
278 
279  second_curve[0] = vertex;
280  second_curve[1].x = (p[2].x + p[1].x)/2;
281  second_curve[1].y = (p[2].y + p[1].y)/2;
282  second_curve[2] = p[2];
283 
284  total_vertices = bezier_approximate(first_curve, points, deviation);
285  if(points)
286  points += total_vertices;
287  total_vertices += bezier_approximate(second_curve, points, deviation);
288  return total_vertices;
289 }
Definition: mesh.c:4557
static int bezier_approximate(const bezier_vector *p, bezier_vector *points, FLOAT deviation)
Definition: wgl_font.c:257
static double bezier_deviation_squared(const bezier_vector *p)
Definition: wgl_font.c:228
float x
Definition: hlsl.c:29
GLdouble x
Definition: wgl_font.c:224
GLsizei const GLfloat * points
Definition: glext.h:8112
GLdouble y
Definition: wgl_font.c:225
float y
Definition: hlsl.c:29
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by wglUseFontOutlines_common().

◆ bezier_deviation_squared()

static double bezier_deviation_squared ( const bezier_vector p)
static

Definition at line 228 of file wgl_font.c.

229 {
230  bezier_vector deviation;
233  double base_length;
234  double dot;
235 
236  vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4 - p[0].x;
237  vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4 - p[0].y;
238 
239  base.x = p[2].x - p[0].x;
240  base.y = p[2].y - p[0].y;
241 
242  base_length = sqrt(base.x*base.x + base.y*base.y);
243  base.x /= base_length;
244  base.y /= base_length;
245 
246  dot = base.x*vertex.x + base.y*vertex.y;
247  dot = min(max(dot, 0.0), base_length);
248  base.x *= dot;
249  base.y *= dot;
250 
251  deviation.x = vertex.x-base.x;
252  deviation.y = vertex.y-base.y;
253 
254  return deviation.x*deviation.x + deviation.y*deviation.y;
255 }
_STLP_DECLSPEC complex< float > _STLP_CALL sqrt(const complex< float > &)
Definition: complex.cpp:188
#define max(a, b)
Definition: svc.c:63
Definition: mesh.c:4557
int base_length[LENGTH_CODES]
Definition: trees.c:107
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint base
Definition: 3dtext.c:35
float x
Definition: hlsl.c:29
GLdouble x
Definition: wgl_font.c:224
GLdouble y
Definition: wgl_font.c:225
#define min(a, b)
Definition: monoChain.cc:55
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
float y
Definition: hlsl.c:29
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by bezier_approximate().

◆ fixed_to_double()

static void fixed_to_double ( POINTFX  fixed,
UINT  em_size,
GLdouble  vertex[3] 
)
static

Definition at line 194 of file wgl_font.c.

195 {
196  vertex[0] = (fixed.x.value + (GLdouble)fixed.x.fract / (1 << 16)) / em_size;
197  vertex[1] = (fixed.y.value + (GLdouble)fixed.y.fract / (1 << 16)) / em_size;
198  vertex[2] = 0.0;
199 }
double GLdouble
Definition: gl.h:163
Definition: mesh.c:4557
ios_base &_STLP_CALL fixed(ios_base &__s)
Definition: _ios_base.h:332

Referenced by wglUseFontOutlines_common().

◆ load_libglu()

static HMODULE load_libglu ( void  )
static

Definition at line 164 of file wgl_font.c.

165 {
166  static const WCHAR glu32W[] = {'g','l','u','3','2','.','d','l','l',0};
167  static int already_loaded;
168  static HMODULE module;
169 
170  if (already_loaded) return module;
171  already_loaded = 1;
172 
173  TRACE("Trying to load GLU library\n");
174  module = LoadLibraryW( glu32W );
175  if (!module)
176  {
177  WARN("Failed to load glu32\n");
178  return NULL;
179  }
180 #define LOAD_FUNCPTR(f) p##f = (void *)GetProcAddress( module, #f )
190 #undef LOAD_FUNCPTR
191  return module;
192 }
HMODULE module
Definition: main.cpp:47
#define gluTessEndPolygon
Definition: glu_mangle.h:67
#define WARN(fmt,...)
Definition: debug.h:111
#define gluTessBeginContour
Definition: glu_mangle.h:65
#define LoadLibraryW(x)
Definition: compat.h:412
smooth NULL
Definition: ftsmooth.c:416
#define gluDeleteTess
Definition: glu_mangle.h:63
#define TRACE(s)
Definition: solgame.cpp:4
#define gluTessBeginPolygon
Definition: glu_mangle.h:64
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define LOAD_FUNCPTR(f)
#define gluTessCallback
Definition: glu_mangle.h:71
#define gluNewTess
Definition: glu_mangle.h:62
#define gluTessEndContour
Definition: glu_mangle.h:68
#define gluTessVertex
Definition: glu_mangle.h:66
#define gluTessNormal
Definition: glu_mangle.h:70

Referenced by wglUseFontOutlines_common().

◆ pgluNewTess()

static GLUtesselator* WINAPI* pgluNewTess ( void  )
static

◆ tess_callback_begin()

static void WINAPI tess_callback_begin ( GLenum  which)
static

Definition at line 209 of file wgl_font.c.

210 {
212  TRACE("%d\n", which);
213  funcs->Begin(which);
214 }
static GLenum which
Definition: wgl_font.c:159
#define TRACE(s)
Definition: solgame.cpp:4
static struct __wine_debug_functions funcs
Definition: debug.c:59
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117

Referenced by wglUseFontOutlines_common().

◆ tess_callback_end()

static void WINAPI tess_callback_end ( void  )
static

Definition at line 216 of file wgl_font.c.

217 {
219  TRACE("\n");
220  funcs->End();
221 }
#define TRACE(s)
Definition: solgame.cpp:4
static struct __wine_debug_functions funcs
Definition: debug.c:59
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117

Referenced by wglUseFontOutlines_common().

◆ tess_callback_vertex()

static void WINAPI tess_callback_vertex ( GLvoid vertex)
static

Definition at line 201 of file wgl_font.c.

202 {
204  GLdouble *dbl = vertex;
205  TRACE("%f, %f, %f\n", dbl[0], dbl[1], dbl[2]);
206  funcs->Vertex3dv(vertex);
207 }
double GLdouble
Definition: gl.h:163
Definition: mesh.c:4557
#define TRACE(s)
Definition: solgame.cpp:4
static struct __wine_debug_functions funcs
Definition: debug.c:59
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117

Referenced by wglUseFontOutlines_common().

◆ void()

static void ( WINAPI pgluDeleteTess)
static

◆ wglUseFontBitmaps_common()

static BOOL wglUseFontBitmaps_common ( HDC  hdc,
DWORD  first,
DWORD  count,
DWORD  listBase,
BOOL  unicode 
)
static

Definition at line 30 of file wgl_font.c.

31 {
33  GLYPHMETRICS gm;
34  unsigned int glyph, size = 0;
35  void *bitmap = NULL, *gl_bitmap = NULL;
36  int org_alignment;
37  BOOL ret = TRUE;
38 
39  funcs->GetIntegerv(GL_UNPACK_ALIGNMENT, &org_alignment);
40  funcs->PixelStorei(GL_UNPACK_ALIGNMENT, 4);
41 
42  for (glyph = first; glyph < first + count; glyph++) {
43  static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
44  unsigned int needed_size, height, width, width_int;
45 
46  if (unicode)
47  needed_size = GetGlyphOutlineW(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
48  else
49  needed_size = GetGlyphOutlineA(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
50 
51  TRACE("Glyph: %3d / List: %d size %d\n", glyph, listBase, needed_size);
52  if (needed_size == GDI_ERROR) {
53  ret = FALSE;
54  break;
55  }
56 
57  if (needed_size > size) {
58  size = needed_size;
60  HeapFree(GetProcessHeap(), 0, gl_bitmap);
63  }
64  if (unicode)
66  else
68  if (!ret) break;
69 
70  if (TRACE_ON(wgl)) {
71  unsigned int bitmask;
72  unsigned char *bitmap_ = bitmap;
73 
74  TRACE(" - bbox: %d x %d\n", gm.gmBlackBoxX, gm.gmBlackBoxY);
75  TRACE(" - origin: (%d, %d)\n", gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y);
76  TRACE(" - increment: %d - %d\n", gm.gmCellIncX, gm.gmCellIncY);
77  if (needed_size != 0) {
78  TRACE(" - bitmap:\n");
79  for (height = 0; height < gm.gmBlackBoxY; height++) {
80  TRACE(" ");
81  for (width = 0, bitmask = 0x80; width < gm.gmBlackBoxX; width++, bitmask >>= 1) {
82  if (bitmask == 0) {
83  bitmap_ += 1;
84  bitmask = 0x80;
85  }
86  if (*bitmap_ & bitmask)
87  TRACE("*");
88  else
89  TRACE(" ");
90  }
91  bitmap_ += (4 - ((UINT_PTR)bitmap_ & 0x03));
92  TRACE("\n");
93  }
94  }
95  }
96 
97  /* In OpenGL, the bitmap is drawn from the bottom to the top... So we need to invert the
98  * glyph for it to be drawn properly.
99  */
100  if (needed_size != 0) {
101  width_int = (gm.gmBlackBoxX + 31) / 32;
102  for (height = 0; height < gm.gmBlackBoxY; height++) {
103  for (width = 0; width < width_int; width++) {
104  ((int *) gl_bitmap)[(gm.gmBlackBoxY - height - 1) * width_int + width] =
105  ((int *) bitmap)[height * width_int + width];
106  }
107  }
108  }
109 
110  funcs->NewList(listBase++, GL_COMPILE);
111  if (needed_size != 0) {
112  funcs->Bitmap(gm.gmBlackBoxX, gm.gmBlackBoxY,
113  0 - gm.gmptGlyphOrigin.x, (int) gm.gmBlackBoxY - gm.gmptGlyphOrigin.y,
114  gm.gmCellIncX, gm.gmCellIncY,
115  gl_bitmap);
116  } else {
117  /* This is the case of 'empty' glyphs like the space character */
118  funcs->Bitmap(0, 0, 0, 0, gm.gmCellIncX, gm.gmCellIncY, NULL);
119  }
120  funcs->EndList();
121  }
122 
123  funcs->PixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
125  HeapFree(GetProcessHeap(), 0, gl_bitmap);
126  return ret;
127 }
unsigned __int3264 UINT_PTR
Definition: activex.cpp:275
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
short gmCellIncY
Definition: wingdi.h:2445
Definition: wingdi.h:2471
DWORD WINAPI GetGlyphOutlineA(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)
#define GGO_BITMAP
Definition: wingdi.h:848
#define GL_UNPACK_ALIGNMENT
Definition: gl.h:632
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD WINAPI GetGlyphOutlineW(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)
smooth NULL
Definition: ftsmooth.c:416
Definition: uimain.c:88
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
POINT gmptGlyphOrigin
Definition: wingdi.h:2443
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static struct __wine_debug_functions funcs
Definition: debug.c:59
int ret
HDC hdc
Definition: main.c:9
short gmCellIncX
Definition: wingdi.h:2444
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
UINT gmBlackBoxY
Definition: wingdi.h:2442
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define GL_COMPILE
Definition: gl.h:286
UINT gmBlackBoxX
Definition: wingdi.h:2441
static HBITMAP bitmap
Definition: clipboard.c:1344
#define GDI_ERROR
Definition: wingdi.h:1308
#define TRACE_ON(x)
Definition: compat.h:65
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by wglUseFontBitmapsA(), and wglUseFontBitmapsW().

◆ wglUseFontBitmapsA()

BOOL WINAPI wglUseFontBitmapsA ( HDC  hdc,
DWORD  first,
DWORD  count,
DWORD  listBase 
)

Definition at line 132 of file wgl_font.c.

133 {
134  return wglUseFontBitmaps_common( hdc, first, count, listBase, FALSE );
135 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
static BOOL wglUseFontBitmaps_common(HDC hdc, DWORD first, DWORD count, DWORD listBase, BOOL unicode)
Definition: wgl_font.c:30
HDC hdc
Definition: main.c:9

◆ wglUseFontBitmapsW()

BOOL WINAPI wglUseFontBitmapsW ( HDC  hdc,
DWORD  first,
DWORD  count,
DWORD  listBase 
)

Definition at line 140 of file wgl_font.c.

141 {
142  return wglUseFontBitmaps_common( hdc, first, count, listBase, TRUE );
143 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
static BOOL wglUseFontBitmaps_common(HDC hdc, DWORD first, DWORD count, DWORD listBase, BOOL unicode)
Definition: wgl_font.c:30
HDC hdc
Definition: main.c:9

◆ wglUseFontOutlines_common()

static BOOL wglUseFontOutlines_common ( HDC  hdc,
DWORD  first,
DWORD  count,
DWORD  listBase,
FLOAT  deviation,
FLOAT  extrusion,
int  format,
LPGLYPHMETRICSFLOAT  lpgmf,
BOOL  unicode 
)
static

Definition at line 294 of file wgl_font.c.

303 {
305  UINT glyph;
306  const MAT2 identity = {{0,1},{0,0},{0,0},{0,1}};
307  GLUtesselator *tess = NULL;
308  LOGFONTW lf;
309  HFONT old_font, unscaled_font;
310  UINT em_size = 1024;
311  RECT rc;
312 
313  TRACE("(%p, %d, %d, %d, %f, %f, %d, %p, %s)\n", hdc, first, count,
314  listBase, deviation, extrusion, format, lpgmf, unicode ? "W" : "A");
315 
316  if(deviation <= 0.0)
317  deviation = 1.0/em_size;
318 
320  {
321  if (!load_libglu())
322  {
323  ERR("glu32 is required for this function but isn't available\n");
324  return FALSE;
325  }
326 
327  tess = pgluNewTess();
328  if(!tess) return FALSE;
329  pgluTessCallback(tess, GLU_TESS_VERTEX, (_GLUfuncptr)tess_callback_vertex);
330  pgluTessCallback(tess, GLU_TESS_BEGIN, (_GLUfuncptr)tess_callback_begin);
331  pgluTessCallback(tess, GLU_TESS_END, tess_callback_end);
332  }
333 
334  GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf);
335  rc.left = rc.right = rc.bottom = 0;
336  rc.top = em_size;
337  DPtoLP(hdc, (POINT*)&rc, 2);
338  lf.lfHeight = -abs(rc.top - rc.bottom);
339  lf.lfOrientation = lf.lfEscapement = 0;
340  unscaled_font = CreateFontIndirectW(&lf);
341  old_font = SelectObject(hdc, unscaled_font);
342 
343  for (glyph = first; glyph < first + count; glyph++)
344  {
345  DWORD needed;
346  GLYPHMETRICS gm;
347  BYTE *buf;
348  TTPOLYGONHEADER *pph;
349  TTPOLYCURVE *ppc;
350  GLdouble *vertices = NULL, *vertices_temp = NULL;
351  int vertex_total = -1;
352 
353  if(unicode)
354  needed = GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
355  else
356  needed = GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
357 
358  if(needed == GDI_ERROR)
359  goto error;
360 
361  buf = HeapAlloc(GetProcessHeap(), 0, needed);
362 
363  if(!buf)
364  goto error;
365 
366  if(unicode)
367  GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
368  else
369  GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
370 
371  TRACE("glyph %d\n", glyph);
372 
373  if(lpgmf)
374  {
375  lpgmf->gmfBlackBoxX = (float)gm.gmBlackBoxX / em_size;
376  lpgmf->gmfBlackBoxY = (float)gm.gmBlackBoxY / em_size;
377  lpgmf->gmfptGlyphOrigin.x = (float)gm.gmptGlyphOrigin.x / em_size;
378  lpgmf->gmfptGlyphOrigin.y = (float)gm.gmptGlyphOrigin.y / em_size;
379  lpgmf->gmfCellIncX = (float)gm.gmCellIncX / em_size;
380  lpgmf->gmfCellIncY = (float)gm.gmCellIncY / em_size;
381 
382  TRACE("%fx%f at %f,%f inc %f,%f\n", lpgmf->gmfBlackBoxX, lpgmf->gmfBlackBoxY,
383  lpgmf->gmfptGlyphOrigin.x, lpgmf->gmfptGlyphOrigin.y, lpgmf->gmfCellIncX, lpgmf->gmfCellIncY);
384  lpgmf++;
385  }
386 
387  funcs->NewList(listBase++, GL_COMPILE);
388  funcs->FrontFace(GL_CCW);
390  {
391  funcs->Normal3d(0.0, 0.0, 1.0);
392  pgluTessNormal(tess, 0, 0, 1);
393  pgluTessBeginPolygon(tess, NULL);
394  }
395 
396  while(!vertices)
397  {
398  if(vertex_total != -1)
399  vertices_temp = vertices = HeapAlloc(GetProcessHeap(), 0, vertex_total * 3 * sizeof(GLdouble));
400  vertex_total = 0;
401 
402  pph = (TTPOLYGONHEADER*)buf;
403  while((BYTE*)pph < buf + needed)
404  {
405  GLdouble previous[3];
406  fixed_to_double(pph->pfxStart, em_size, previous);
407 
408  if(vertices)
409  TRACE("\tstart %d, %d\n", pph->pfxStart.x.value, pph->pfxStart.y.value);
410 
412  pgluTessBeginContour(tess);
413  else
414  funcs->Begin(GL_LINE_LOOP);
415 
416  if(vertices)
417  {
418  fixed_to_double(pph->pfxStart, em_size, vertices);
420  pgluTessVertex(tess, vertices, vertices);
421  else
422  funcs->Vertex3d(vertices[0], vertices[1], vertices[2]);
423  vertices += 3;
424  }
425  vertex_total++;
426 
427  ppc = (TTPOLYCURVE*)((char*)pph + sizeof(*pph));
428  while((char*)ppc < (char*)pph + pph->cb)
429  {
430  int i, j;
431  int num;
432 
433  switch(ppc->wType) {
434  case TT_PRIM_LINE:
435  for(i = 0; i < ppc->cpfx; i++)
436  {
437  if(vertices)
438  {
439  TRACE("\t\tline to %d, %d\n",
440  ppc->apfx[i].x.value, ppc->apfx[i].y.value);
441  fixed_to_double(ppc->apfx[i], em_size, vertices);
443  pgluTessVertex(tess, vertices, vertices);
444  else
445  funcs->Vertex3d(vertices[0], vertices[1], vertices[2]);
446  vertices += 3;
447  }
448  fixed_to_double(ppc->apfx[i], em_size, previous);
449  vertex_total++;
450  }
451  break;
452 
453  case TT_PRIM_QSPLINE:
454  for(i = 0; i < ppc->cpfx-1; i++)
455  {
456  bezier_vector curve[3];
458  GLdouble curve_vertex[3];
459 
460  if(vertices)
461  TRACE("\t\tcurve %d,%d %d,%d\n",
462  ppc->apfx[i].x.value, ppc->apfx[i].y.value,
463  ppc->apfx[i + 1].x.value, ppc->apfx[i + 1].y.value);
464 
465  curve[0].x = previous[0];
466  curve[0].y = previous[1];
467  fixed_to_double(ppc->apfx[i], em_size, curve_vertex);
468  curve[1].x = curve_vertex[0];
469  curve[1].y = curve_vertex[1];
470  fixed_to_double(ppc->apfx[i + 1], em_size, curve_vertex);
471  curve[2].x = curve_vertex[0];
472  curve[2].y = curve_vertex[1];
473  if(i < ppc->cpfx-2)
474  {
475  curve[2].x = (curve[1].x + curve[2].x)/2;
476  curve[2].y = (curve[1].y + curve[2].y)/2;
477  }
478  num = bezier_approximate(curve, NULL, deviation);
480  num = bezier_approximate(curve, points, deviation);
481  vertex_total += num;
482  if(vertices)
483  {
484  for(j=0; j<num; j++)
485  {
486  TRACE("\t\t\tvertex at %f,%f\n", points[j].x, points[j].y);
487  vertices[0] = points[j].x;
488  vertices[1] = points[j].y;
489  vertices[2] = 0.0;
491  pgluTessVertex(tess, vertices, vertices);
492  else
493  funcs->Vertex3d(vertices[0], vertices[1], vertices[2]);
494  vertices += 3;
495  }
496  }
498  previous[0] = curve[2].x;
499  previous[1] = curve[2].y;
500  }
501  break;
502  default:
503  ERR("\t\tcurve type = %d\n", ppc->wType);
505  pgluTessEndContour(tess);
506  else
507  funcs->End();
508  goto error_in_list;
509  }
510 
511  ppc = (TTPOLYCURVE*)((char*)ppc + sizeof(*ppc) +
512  (ppc->cpfx - 1) * sizeof(POINTFX));
513  }
515  pgluTessEndContour(tess);
516  else
517  funcs->End();
518  pph = (TTPOLYGONHEADER*)((char*)pph + pph->cb);
519  }
520  }
521 
522 error_in_list:
524  pgluTessEndPolygon(tess);
525  funcs->Translated((GLdouble)gm.gmCellIncX / em_size, (GLdouble)gm.gmCellIncY / em_size, 0.0);
526  funcs->EndList();
527 
528  HeapFree(GetProcessHeap(), 0, buf);
529 
530  if(vertices_temp)
531  HeapFree(GetProcessHeap(), 0, vertices_temp);
532  }
533 
534  error:
535  DeleteObject(SelectObject(hdc, old_font));
537  pgluDeleteTess(tess);
538  return TRUE;
539 
540 }
double GLdouble
Definition: gl.h:163
#define abs(i)
Definition: fconv.c:206
#define TRUE
Definition: types.h:120
FLOAT x
Definition: wingdi.h:2721
long y
Definition: polytest.cpp:48
static void WINAPI tess_callback_vertex(GLvoid *vertex)
Definition: wgl_font.c:201
#define error(str)
Definition: mkdosfs.c:1605
FLOAT gmfBlackBoxY
Definition: wingdi.h:2726
long x
Definition: polytest.cpp:48
short value
Definition: wingdi.h:2469
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define GLU_TESS_END
Definition: wgl_font.c:152
const GLint * first
Definition: glext.h:5794
LONG lfHeight
Definition: dimm.idl:59
static int bezier_approximate(const bezier_vector *p, bezier_vector *points, FLOAT deviation)
Definition: wgl_font.c:257
LONG top
Definition: windef.h:307
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG lfEscapement
Definition: dimm.idl:61
short gmCellIncY
Definition: wingdi.h:2445
Definition: wingdi.h:2471
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
BOOL WINAPI DPtoLP(_In_ HDC hdc, _Inout_updates_(c) LPPOINT lppt, _In_ int c)
DWORD WINAPI GetGlyphOutlineA(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)
#define GL_LINE_LOOP
Definition: gl.h:192
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
FIXED y
Definition: wingdi.h:2708
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
LONG lfOrientation
Definition: dimm.idl:62
DWORD WINAPI GetGlyphOutlineW(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)
#define GLU_TESS_VERTEX
Definition: wgl_font.c:151
#define GGO_NATIVE
Definition: wingdi.h:849
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
static void WINAPI tess_callback_end(void)
Definition: wgl_font.c:216
#define TT_PRIM_QSPLINE
Definition: wingdi.h:1319
static GLUtesselator *WINAPI * pgluNewTess(void)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
GLdouble x
Definition: wgl_font.c:224
#define WGL_FONT_POLYGONS
Definition: wingdi.h:1324
#define GL_CCW
Definition: gl.h:269
#define TRACE(s)
Definition: solgame.cpp:4
POINT gmptGlyphOrigin
Definition: wingdi.h:2443
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define GLU_TESS_BEGIN
Definition: wgl_font.c:150
FLOAT y
Definition: wingdi.h:2722
POINTFX apfx[1]
Definition: wingdi.h:2713
static HMODULE load_libglu(void)
Definition: wgl_font.c:164
static void fixed_to_double(POINTFX fixed, UINT em_size, GLdouble vertex[3])
Definition: wgl_font.c:194
static struct __wine_debug_functions funcs
Definition: debug.c:59
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint num
Definition: glext.h:9618
#define OBJ_FONT
Definition: objidl.idl:1414
POINTFX pfxStart
Definition: wingdi.h:2718
void(WINAPI * _GLUfuncptr)(void)
Definition: wgl_font.c:148
GLsizei const GLfloat * points
Definition: glext.h:8112
HDC hdc
Definition: main.c:9
static void WINAPI tess_callback_begin(GLenum which)
Definition: wgl_font.c:209
unsigned char BYTE
Definition: mem.h:68
short gmCellIncX
Definition: wingdi.h:2444
GLdouble y
Definition: wgl_font.c:225
#define ERR(fmt,...)
Definition: debug.h:109
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
POINTFLOAT gmfptGlyphOrigin
Definition: wingdi.h:2727
FLOAT gmfBlackBoxX
Definition: wingdi.h:2725
static float(__cdecl *square_half_float)(float x
UINT gmBlackBoxY
Definition: wingdi.h:2442
unsigned int UINT
Definition: ndis.h:50
FORCEINLINE const GLDISPATCHTABLE * IntGetCurrentDispatchTable(void)
Definition: opengl32.h:117
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define GL_COMPILE
Definition: gl.h:286
UINT gmBlackBoxX
Definition: wingdi.h:2441
LONG bottom
Definition: windef.h:309
#define GDI_ERROR
Definition: wingdi.h:1308
#define TT_PRIM_LINE
Definition: wingdi.h:1318
#define HeapFree(x, y, z)
Definition: compat.h:402
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:439
FIXED x
Definition: wingdi.h:2707

Referenced by wglUseFontOutlinesA(), and wglUseFontOutlinesW().

◆ wglUseFontOutlinesA()

BOOL WINAPI wglUseFontOutlinesA ( HDC  hdc,
DWORD  first,
DWORD  count,
DWORD  listBase,
FLOAT  deviation,
FLOAT  extrusion,
int  format,
LPGLYPHMETRICSFLOAT  lpgmf 
)

Definition at line 545 of file wgl_font.c.

553 {
554  return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, FALSE);
555 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static BOOL wglUseFontOutlines_common(HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf, BOOL unicode)
Definition: wgl_font.c:294
HDC hdc
Definition: main.c:9

◆ wglUseFontOutlinesW()

BOOL WINAPI wglUseFontOutlinesW ( HDC  hdc,
DWORD  first,
DWORD  count,
DWORD  listBase,
FLOAT  deviation,
FLOAT  extrusion,
int  format,
LPGLYPHMETRICSFLOAT  lpgmf 
)

Definition at line 560 of file wgl_font.c.

568 {
569  return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE);
570 }
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static BOOL wglUseFontOutlines_common(HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT lpgmf, BOOL unicode)
Definition: wgl_font.c:294
HDC hdc
Definition: main.c:9

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( wgl  )

Variable Documentation

◆ data

Definition at line 162 of file wgl_font.c.

◆ fn

Definition at line 159 of file wgl_font.c.

Referenced by _fetch_versioninfo(), ACTION_CallDllFunction(), add_list(), add_match(), adns_ccf_search(), Allocate_PMemoryAllocator(), BtrfsPropSheet::apply_changes(), BtrfsPropSheet::apply_changes_file(), ccf_include(), ccf_nameserver(), ccf_options(), ccf_sortlist(), BtrfsPropSheet::check_file(), coff_process_info(), configparseerr(), CopyOverwrite(), create_snapshot(), create_snapshot2(), create_subvol(), DECLARE_INTERFACE_(), DecodeDirectoryURL(), dir_register(), BtrfsPropSheet::do_search(), DRIVER_TryOpenDriver32(), expect_shim_imp(), fileref_get_filename(), FileToURL(), fill_in_file_name_information(), fill_in_hard_link_full_id_information(), fill_in_hard_link_information(), find_default_subvol(), FTPDecodeURL(), gen_add_match(), gen_matches(), get_volume_path_parent(), GetRealOSVersion(), gluNurbsCallback(), gluQuadricCallback(), gluTessCallback(), h_add_list(), h_add_match(), i_add_list(), i_add_match(), BtrfsContextMenu::Initialize(), BtrfsContextMenu::InvokeCommand(), j_add_list(), j_add_match(), TConfig::keyfile_init(), BtrfsPropSheet::load_file_list(), LoadDynamicImports(), log_file_checksum_error(), LZEXPAND_MangleName(), LZOpenFileA(), LZOpenFileW(), MACRO_CallBoolFunc(), MACRO_CallVoidFunc(), MACRO_RegisterRoutine(), module_find_cb(), MoveOverwrite(), my_open(), my_retrieve_vol_type(), BtrfsPropSheet::open_as_admin(), open_file(), open_file2(), pci_read(), pci_read_bar(), pci_setup(), pci_write(), pci_write_bar(), OpenGLCurveEvaluator::putCallBack(), OpenGLSurfaceEvaluator::putCallBack(), GLUnurbs::putSurfCallBack(), rd_open_file(), BtrfsContextMenu::reflink_copy(), rename_file_to_stream(), rename_stream(), RpcMgmtSetAuthorizationFn(), send_notification_fcb(), send_notification_fileref(), set_link_information(), set_rename_information(), show_reflink_paste(), START_TEST(), StgIsStorageFile(), test_GetProcAddress(), test_memcmpfunc(), u_add_list(), u_add_match(), UDFBuildFileIdent(), UDFHardLinkFile__(), UDFOpenFile__(), UDFRenameMoveFile__(), UhciInterruptService(), UIINSERTOBJECTDLG_AddControl(), UIINSERTOBJECTDLG_BrowseFile(), vga_setup(), WAVE_mciOpenFile(), xmlSAX2AttributeNs(), and yyparse().

◆ location

Definition at line 162 of file wgl_font.c.

◆ polygon_data

void* polygon_data

Definition at line 157 of file wgl_font.c.

◆ which

◆ x

Definition at line 156 of file wgl_font.c.

◆ y

Definition at line 156 of file wgl_font.c.

◆ z

Definition at line 156 of file wgl_font.c.