ReactOS 0.4.17-dev-934-g091855f
font.c File Reference
#include "d3dx10.h"
#include "wine/debug.h"
Include dependency graph for font.c:

Go to the source code of this file.

Classes

struct  d3dx_font
 

Macros

#define COBJMACROS
 
#define D3DERR_INVALIDCALL   0x8876086c
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
static struct d3dx_font * impl_from_ID3DX10Font (ID3DX10Font *iface)
 
static HRESULT WINAPI d3dx_font_QueryInterface (ID3DX10Font *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3dx_font_AddRef (ID3DX10Font *iface)
 
static ULONG WINAPI d3dx_font_Release (ID3DX10Font *iface)
 
static HRESULT WINAPI d3dx_font_GetDevice (ID3DX10Font *iface, ID3D10Device **device)
 
static HRESULT WINAPI d3dx_font_GetDescA (ID3DX10Font *iface, D3DX10_FONT_DESCA *desc)
 
static HRESULT WINAPI d3dx_font_GetDescW (ID3DX10Font *iface, D3DX10_FONT_DESCW *desc)
 
static BOOL WINAPI d3dx_font_GetTextMetricsA (ID3DX10Font *iface, TEXTMETRICA *metrics)
 
static BOOL WINAPI d3dx_font_GetTextMetricsW (ID3DX10Font *iface, TEXTMETRICW *metrics)
 
static HDC WINAPI d3dx_font_GetDC (ID3DX10Font *iface)
 
static HRESULT WINAPI d3dx_font_GetGlyphData (ID3DX10Font *iface, UINT glyph, ID3D10ShaderResourceView **view, RECT *black_box, POINT *cell_inc)
 
static HRESULT WINAPI d3dx_font_PreloadCharacters (ID3DX10Font *iface, UINT first, UINT last)
 
static HRESULT WINAPI d3dx_font_PreloadGlyphs (ID3DX10Font *iface, UINT first, UINT last)
 
static HRESULT WINAPI d3dx_font_PreloadTextA (ID3DX10Font *iface, const char *string, INT count)
 
static HRESULT WINAPI d3dx_font_PreloadTextW (ID3DX10Font *iface, const WCHAR *string, INT count)
 
static INT WINAPI d3dx_font_DrawTextA (ID3DX10Font *iface, ID3DX10Sprite *sprite, const char *string, INT count, RECT *rect, UINT format, D3DXCOLOR color)
 
static INT WINAPI d3dx_font_DrawTextW (ID3DX10Font *iface, ID3DX10Sprite *sprite, const WCHAR *string, INT count, RECT *rect, UINT format, D3DXCOLOR color)
 
HRESULT WINAPI D3DX10CreateFontA (ID3D10Device *device, INT height, UINT width, UINT weight, UINT miplevels, BOOL italic, UINT charset, UINT precision, UINT quality, UINT pitchandfamily, const char *facename, ID3DX10Font **font)
 
HRESULT WINAPI D3DX10CreateFontW (ID3D10Device *device, INT height, UINT width, UINT weight, UINT miplevels, BOOL italic, UINT charset, UINT precision, UINT quality, UINT pitchandfamily, const WCHAR *facename, ID3DX10Font **font)
 
HRESULT WINAPI D3DX10CreateFontIndirectA (ID3D10Device *device, const D3DX10_FONT_DESCA *desc, ID3DX10Font **font)
 
HRESULT WINAPI D3DX10CreateFontIndirectW (ID3D10Device *device, const D3DX10_FONT_DESCW *desc, ID3DX10Font **font)
 

Variables

static const ID3DX10FontVtbl d3dx_font_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 20 of file font.c.

◆ D3DERR_INVALIDCALL

#define D3DERR_INVALIDCALL   0x8876086c

Definition at line 27 of file font.c.

Function Documentation

◆ D3DX10CreateFontA()

HRESULT WINAPI D3DX10CreateFontA ( ID3D10Device *  device,
INT  height,
UINT  width,
UINT  weight,
UINT  miplevels,
BOOL  italic,
UINT  charset,
UINT  precision,
UINT  quality,
UINT  pitchandfamily,
const char *  facename,
ID3DX10Font **  font 
)

Definition at line 343 of file font.c.

346{
348
349 TRACE("device %p, height %d, width %u, weight %u, miplevels %u, italic %#x, charset %u, "
350 "precision %u, quality %u, pitchandfamily %u, facename %s, font %p.\n",
351 device, height, width, weight, miplevels, italic, charset, precision, quality,
352 pitchandfamily, debugstr_a(facename), font);
353
354 if (!device || !font)
355 return D3DERR_INVALIDCALL;
356
357 desc.Height = height;
358 desc.Width = width;
359 desc.Weight = weight;
360 desc.MipLevels = miplevels;
361 desc.Italic = italic;
362 desc.CharSet = charset;
363 desc.OutputPrecision = precision;
364 desc.Quality = quality;
365 desc.PitchAndFamily = pitchandfamily;
366 if (facename)
367 lstrcpyA(desc.FaceName, facename);
368 else
369 desc.FaceName[0] = 0;
370
372}
CFF_Charset charset
Definition: cffcmap.c:137
#define D3DERR_INVALIDCALL
Definition: font.c:27
HRESULT WINAPI D3DX10CreateFontIndirectA(ID3D10Device *device, const D3DX10_FONT_DESCA *desc, ID3DX10Font **font)
Definition: font.c:405
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLint GLint * precision
Definition: glext.h:7539
int quality
Definition: jpeglib.h:994
#define debugstr_a
Definition: kernel32.h:31
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
Definition: mk_font.cpp:20
weight
Definition: sortkey.c:157
#define TRACE(s)
Definition: solgame.cpp:4
Definition: devices.h:37

◆ D3DX10CreateFontIndirectA()

HRESULT WINAPI D3DX10CreateFontIndirectA ( ID3D10Device *  device,
const D3DX10_FONT_DESCA *  desc,
ID3DX10Font **  font 
)

Definition at line 405 of file font.c.

407{
408 D3DX10_FONT_DESCW descW;
409
410 TRACE("device %p, desc %p, font %p.\n", device, desc, font);
411
412 if (!device || !desc || !font)
413 return D3DERR_INVALIDCALL;
414
415 memcpy(&descW, desc, FIELD_OFFSET(D3DX10_FONT_DESCA, FaceName));
416 MultiByteToWideChar(CP_ACP, 0, desc->FaceName, -1, descW.FaceName, ARRAY_SIZE(descW.FaceName));
417 return D3DX10CreateFontIndirectW(device, &descW, font);
418}
#define ARRAY_SIZE(A)
Definition: main.h:20
HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT_DESCW *desc, ID3DX10Font **font)
Definition: font.c:420
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR FaceName[LF_FACESIZE]
Definition: d3dx10core.h:69
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255

Referenced by D3DX10CreateFontA().

◆ D3DX10CreateFontIndirectW()

HRESULT WINAPI D3DX10CreateFontIndirectW ( ID3D10Device *  device,
const D3DX10_FONT_DESCW *  desc,
ID3DX10Font **  font 
)

Definition at line 420 of file font.c.

422{
423 struct d3dx_font *object;
424
425 TRACE("device %p, desc %p, font %p.\n", device, desc, font);
426
427 if (!device || !desc || !font)
428 return D3DERR_INVALIDCALL;
429
430 *font = NULL;
431
432 if (!(object = calloc(1, sizeof(*object))))
433 return E_OUTOFMEMORY;
434
435 object->hdc = CreateCompatibleDC(NULL);
436 if (!object->hdc)
437 {
438 free(object);
439 return E_FAIL;
440 }
441
442 object->hfont = CreateFontW(desc->Height, desc->Width, 0, 0, desc->Weight, desc->Italic, FALSE, FALSE, desc->CharSet,
443 desc->OutputPrecision, CLIP_DEFAULT_PRECIS, desc->Quality, desc->PitchAndFamily, desc->FaceName);
444 if (!object->hfont)
445 {
446 DeleteDC(object->hdc);
447 free(object);
448 return E_FAIL;
449 }
450 SelectObject(object->hdc, object->hfont);
451
452 object->ID3DX10Font_iface.lpVtbl = &d3dx_font_vtbl;
453 object->refcount = 1;
454 object->device = device;
455 object->desc = *desc;
456 ID3D10Device_AddRef(device);
457
458 *font = &object->ID3DX10Font_iface;
459
460 return S_OK;
461}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_FAIL
Definition: ddrawi.h:102
#define free
Definition: debug_ros.c:5
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
static const ID3DX10FontVtbl d3dx_font_vtbl
Definition: font.c:321
#define S_OK
Definition: intsafe.h:52
#define calloc
Definition: rosglue.h:14
Definition: font.c:30
ID3D10Device * device
Definition: font.c:37
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
BOOL WINAPI DeleteDC(_In_ HDC)

Referenced by D3DX10CreateFontIndirectA(), and D3DX10CreateFontW().

◆ D3DX10CreateFontW()

HRESULT WINAPI D3DX10CreateFontW ( ID3D10Device *  device,
INT  height,
UINT  width,
UINT  weight,
UINT  miplevels,
BOOL  italic,
UINT  charset,
UINT  precision,
UINT  quality,
UINT  pitchandfamily,
const WCHAR *  facename,
ID3DX10Font **  font 
)

Definition at line 374 of file font.c.

377{
379
380 TRACE("device %p, height %d, width %u, weight %u, miplevels %u, italic %#x, charset %u, "
381 "precision %u, quality %u, pitchandfamily %u, facename %s, font %p.\n",
382 device, height, width, weight, miplevels, italic, charset, precision, quality,
383 pitchandfamily, debugstr_w(facename), font);
384
385 if (!device || !font)
386 return D3DERR_INVALIDCALL;
387
388 desc.Height = height;
389 desc.Width = width;
390 desc.Weight = weight;
391 desc.MipLevels = miplevels;
392 desc.Italic = italic;
393 desc.CharSet = charset;
394 desc.OutputPrecision = precision;
395 desc.Quality = quality;
396 desc.PitchAndFamily = pitchandfamily;
397 if (facename)
398 lstrcpyW(desc.FaceName, facename);
399 else
400 desc.FaceName[0] = '\0';
401
403}
#define lstrcpyW
Definition: compat.h:749
#define debugstr_w
Definition: kernel32.h:32

◆ d3dx_font_AddRef()

static ULONG WINAPI d3dx_font_AddRef ( ID3DX10Font *  iface)
static

Definition at line 63 of file font.c.

64{
65 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
67
68 TRACE("%p increasing refcount to %lu.\n", iface, refcount);
69 return refcount;
70}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3dx_font * impl_from_ID3DX10Font(ID3DX10Font *iface)
Definition: font.c:40
LONG refcount
Definition: font.c:32
uint32_t ULONG
Definition: typedefs.h:59

◆ d3dx_font_DrawTextA()

static INT WINAPI d3dx_font_DrawTextA ( ID3DX10Font *  iface,
ID3DX10Sprite *  sprite,
const char *  string,
INT  count,
RECT *  rect,
UINT  format,
D3DXCOLOR  color 
)
static

Definition at line 282 of file font.c.

284{
285 int ret, countW;
286 WCHAR *wstr;
287
288 TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color {%.8e,%.8e,%.8e,%8e}.\n",
290 color.r, color.g, color.b, color.a);
291
292 if (!string || !count)
293 return 0;
294
295 if (!(countW = MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, NULL, 0)))
296 return 0;
297
298 if (!(wstr = calloc(countW, sizeof(*wstr))))
299 return 0;
300
301 MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, wstr, countW);
302
303 ret = ID3DX10Font_DrawTextW(iface, sprite, wstr, count < 0 ? countW - 1 : countW,
304 rect, format, color);
305
306 free(wstr);
307
308 return ret;
309}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
RECT rect
Definition: combotst.c:67
#define ID3DX10Font_DrawTextW(p, a, b, c, d, e, f)
Definition: d3dx10core.h:262
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
return ret
Definition: mutex.c:147
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint color
Definition: glext.h:6243
short WCHAR
Definition: pedump.c:58
Definition: sprite.c:36

◆ d3dx_font_DrawTextW()

static INT WINAPI d3dx_font_DrawTextW ( ID3DX10Font *  iface,
ID3DX10Sprite *  sprite,
const WCHAR *  string,
INT  count,
RECT *  rect,
UINT  format,
D3DXCOLOR  color 
)
static

Definition at line 311 of file font.c.

313{
314 FIXME("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color {%.8e,%.8e,%.8e,%.8e} stub!\n",
316 format, color.r, color.g, color.b, color.a);
317
318 return E_NOTIMPL;
319}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99
#define debugstr_wn
Definition: kernel32.h:33

◆ d3dx_font_GetDC()

static HDC WINAPI d3dx_font_GetDC ( ID3DX10Font *  iface)
static

Definition at line 150 of file font.c.

151{
152 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
153
154 TRACE("iface %p.\n", iface);
155
156 return font->hdc;
157}

◆ d3dx_font_GetDescA()

static HRESULT WINAPI d3dx_font_GetDescA ( ID3DX10Font *  iface,
D3DX10_FONT_DESCA *  desc 
)
static

Definition at line 102 of file font.c.

103{
104 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
105
106 TRACE("iface %p, desc %p.\n", iface, desc);
107
108 if (!desc)
109 return D3DERR_INVALIDCALL;
110
111 memcpy(desc, &font->desc, FIELD_OFFSET(D3DX10_FONT_DESCA, FaceName));
112 WideCharToMultiByte(CP_ACP, 0, font->desc.FaceName, -1, desc->FaceName,
113 ARRAY_SIZE(desc->FaceName), NULL, NULL);
114
115 return S_OK;
116}
#define WideCharToMultiByte
Definition: compat.h:111

◆ d3dx_font_GetDescW()

static HRESULT WINAPI d3dx_font_GetDescW ( ID3DX10Font *  iface,
D3DX10_FONT_DESCW *  desc 
)
static

Definition at line 118 of file font.c.

119{
120 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
121
122 TRACE("iface %p, desc %p.\n", iface, desc);
123
124 if (!desc)
125 return D3DERR_INVALIDCALL;
126
127 *desc = font->desc;
128
129 return S_OK;
130}

◆ d3dx_font_GetDevice()

static HRESULT WINAPI d3dx_font_GetDevice ( ID3DX10Font *  iface,
ID3D10Device **  device 
)
static

Definition at line 89 of file font.c.

90{
91 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
92
93 TRACE("iface %p, device %p.\n", iface, device);
94
95 if (!device) return D3DERR_INVALIDCALL;
96 *device = font->device;
97 ID3D10Device_AddRef(font->device);
98
99 return S_OK;
100}

◆ d3dx_font_GetGlyphData()

static HRESULT WINAPI d3dx_font_GetGlyphData ( ID3DX10Font *  iface,
UINT  glyph,
ID3D10ShaderResourceView **  view,
RECT *  black_box,
POINT *  cell_inc 
)
static

Definition at line 159 of file font.c.

161{
162 FIXME("iface %p, glyph %u, view %p, black_box %p, cell_inc %p stub!\n",
163 iface, glyph, view, black_box, cell_inc);
164
165 return E_NOTIMPL;
166}

◆ d3dx_font_GetTextMetricsA()

static BOOL WINAPI d3dx_font_GetTextMetricsA ( ID3DX10Font *  iface,
TEXTMETRICA *  metrics 
)
static

Definition at line 132 of file font.c.

133{
134 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
135
136 TRACE("iface %p, metrics %p.\n", iface, metrics);
137
138 return GetTextMetricsA(font->hdc, metrics);
139}
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200

◆ d3dx_font_GetTextMetricsW()

static BOOL WINAPI d3dx_font_GetTextMetricsW ( ID3DX10Font *  iface,
TEXTMETRICW *  metrics 
)
static

Definition at line 141 of file font.c.

142{
143 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
144
145 TRACE("iface %p, metrics %p.\n", iface, metrics);
146
147 return GetTextMetricsW(font->hdc, metrics);
148}
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221

◆ d3dx_font_PreloadCharacters()

static HRESULT WINAPI d3dx_font_PreloadCharacters ( ID3DX10Font *  iface,
UINT  first,
UINT  last 
)
static

Definition at line 168 of file font.c.

169{
170 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
171 unsigned int i, count, start, end;
172 WORD *indices;
173 WCHAR *chars;
174
175 TRACE("iface %p, first %u, last %u.\n", iface, first, last);
176
177 if (last < first)
178 return S_OK;
179
180 count = last - first + 1;
181 indices = malloc(count * sizeof(*indices));
182 if (!indices)
183 return E_OUTOFMEMORY;
184
185 chars = malloc(count * sizeof(*chars));
186 if (!chars)
187 {
188 free(indices);
189 return E_OUTOFMEMORY;
190 }
191
192 for (i = 0; i < count; ++i)
193 chars[i] = first + i;
194
195 GetGlyphIndicesW(font->hdc, chars, count, indices, 0);
196
197 start = end = indices[0];
198 for (i = 1; i < count; ++i)
199 {
200 if (indices[i] == end + 1)
201 {
202 end = indices[i];
203 continue;
204 }
206 start = end = indices[i];
207 }
209
210 free(chars);
211 free(indices);
212
213 return S_OK;
214}
#define ID3DX10Font_PreloadGlyphs(p, a, b)
Definition: d3dx10core.h:258
#define malloc
Definition: debug_ros.c:4
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
const GLint * first
Definition: glext.h:5794
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
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
Definition: sync.c:64
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)

◆ d3dx_font_PreloadGlyphs()

static HRESULT WINAPI d3dx_font_PreloadGlyphs ( ID3DX10Font *  iface,
UINT  first,
UINT  last 
)
static

Definition at line 216 of file font.c.

217{
218 FIXME("iface %p, first %u, last %u stub!\n", iface, first, last);
219
220 return E_NOTIMPL;
221}

◆ d3dx_font_PreloadTextA()

static HRESULT WINAPI d3dx_font_PreloadTextA ( ID3DX10Font *  iface,
const char *  string,
INT  count 
)
static

Definition at line 223 of file font.c.

224{
225 WCHAR *wstr;
226 HRESULT hr;
227 int countW;
228
229 TRACE("iface %p, string %s, count %d.\n", iface, debugstr_an(string, count), count);
230
231 if (!string && !count)
232 return S_OK;
233
234 if (!string)
235 return D3DERR_INVALIDCALL;
236
237 countW = MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, NULL, 0);
238
239 if (!(wstr = malloc(countW * sizeof(*wstr))))
240 return E_OUTOFMEMORY;
241
242 MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, wstr, countW);
243
244 hr = ID3DX10Font_PreloadTextW(iface, wstr, count < 0 ? countW - 1 : countW);
245
246 free(wstr);
247
248 return hr;
249}
#define ID3DX10Font_PreloadTextW(p, a, b)
Definition: d3dx10core.h:260
HRESULT hr
Definition: delayimp.cpp:582

◆ d3dx_font_PreloadTextW()

static HRESULT WINAPI d3dx_font_PreloadTextW ( ID3DX10Font *  iface,
const WCHAR *  string,
INT  count 
)
static

Definition at line 251 of file font.c.

252{
253 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
254 WORD *indices;
255 int i;
256
257 TRACE("iface %p, string %s, count %d.\n", iface, debugstr_wn(string, count), count);
258
259 if (!string && !count)
260 return S_OK;
261
262 if (!string)
263 return D3DERR_INVALIDCALL;
264
265 if (count < 0)
266 count = lstrlenW(string);
267
268 indices = malloc(count * sizeof(*indices));
269 if (!indices)
270 return E_OUTOFMEMORY;
271
272 GetGlyphIndicesW(font->hdc, string, count, indices, 0);
273
274 for (i = 0; i < count; ++i)
276
277 free(indices);
278
279 return S_OK;
280}
#define lstrlenW
Definition: compat.h:750

◆ d3dx_font_QueryInterface()

static HRESULT WINAPI d3dx_font_QueryInterface ( ID3DX10Font *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 45 of file font.c.

46{
47 TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
48
49 if (IsEqualGUID(riid, &IID_ID3DX10Font)
51 {
52 IUnknown_AddRef(iface);
53 *out = iface;
54 return S_OK;
55 }
56
57 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
58
59 *out = NULL;
60 return E_NOINTERFACE;
61}
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d3dx_font_Release()

static ULONG WINAPI d3dx_font_Release ( ID3DX10Font *  iface)
static

Definition at line 72 of file font.c.

73{
74 struct d3dx_font *font = impl_from_ID3DX10Font(iface);
76
77 TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
78
79 if (!refcount)
80 {
81 DeleteObject(font->hfont);
82 DeleteDC(font->hdc);
83 ID3D10Device_Release(font->device);
84 free(font);
85 }
86 return refcount;
87}
#define InterlockedDecrement
Definition: armddk.h:52
pKey DeleteObject()

◆ impl_from_ID3DX10Font()

static struct d3dx_font * impl_from_ID3DX10Font ( ID3DX10Font *  iface)
inlinestatic

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dx  )

Variable Documentation

◆ d3dx_font_vtbl

const ID3DX10FontVtbl d3dx_font_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3dx_font_GetDescW(ID3DX10Font *iface, D3DX10_FONT_DESCW *desc)
Definition: font.c:118
static HRESULT WINAPI d3dx_font_GetDevice(ID3DX10Font *iface, ID3D10Device **device)
Definition: font.c:89
static BOOL WINAPI d3dx_font_GetTextMetricsW(ID3DX10Font *iface, TEXTMETRICW *metrics)
Definition: font.c:141
static INT WINAPI d3dx_font_DrawTextW(ID3DX10Font *iface, ID3DX10Sprite *sprite, const WCHAR *string, INT count, RECT *rect, UINT format, D3DXCOLOR color)
Definition: font.c:311
static HRESULT WINAPI d3dx_font_QueryInterface(ID3DX10Font *iface, REFIID riid, void **out)
Definition: font.c:45
static HRESULT WINAPI d3dx_font_GetDescA(ID3DX10Font *iface, D3DX10_FONT_DESCA *desc)
Definition: font.c:102
static HRESULT WINAPI d3dx_font_GetGlyphData(ID3DX10Font *iface, UINT glyph, ID3D10ShaderResourceView **view, RECT *black_box, POINT *cell_inc)
Definition: font.c:159
static ULONG WINAPI d3dx_font_Release(ID3DX10Font *iface)
Definition: font.c:72
static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *string, INT count)
Definition: font.c:251
static INT WINAPI d3dx_font_DrawTextA(ID3DX10Font *iface, ID3DX10Sprite *sprite, const char *string, INT count, RECT *rect, UINT format, D3DXCOLOR color)
Definition: font.c:282
static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first, UINT last)
Definition: font.c:168
static BOOL WINAPI d3dx_font_GetTextMetricsA(ID3DX10Font *iface, TEXTMETRICA *metrics)
Definition: font.c:132
static HRESULT WINAPI d3dx_font_PreloadGlyphs(ID3DX10Font *iface, UINT first, UINT last)
Definition: font.c:216
static HRESULT WINAPI d3dx_font_PreloadTextA(ID3DX10Font *iface, const char *string, INT count)
Definition: font.c:223
static ULONG WINAPI d3dx_font_AddRef(ID3DX10Font *iface)
Definition: font.c:63
static HDC WINAPI d3dx_font_GetDC(ID3DX10Font *iface)
Definition: font.c:150

Definition at line 321 of file font.c.

Referenced by D3DX10CreateFontIndirectW().