Rename quad function to quadr to avoid clash with Solaris quad typedef
[mesa.git] / src / mesa / drivers / d3d / D3DTEXT.CPP
1 /*===========================================================================*/
2 /* */
3 /* Mesa-3.0 DirectX 6 Driver */
4 /* */
5 /* By Leigh McRae */
6 /* */
7 /* http://www.altsoftware.com/ */
8 /* */
9 /* Copyright (c) 1999-1998 alt.software inc. All Rights Reserved */
10 /*===========================================================================*/
11 #include "d3dText.h"
12
13 /*=============================================================================
14
15 1
16 ------
17 | |
18 6 | | 2
19 | 7 |
20 ------
21 | |
22 5 | | 3
23 | |
24 ------
25 4
26
27 TL_0 TR_0
28 TLL TL_1 TR_1 TRR
29
30 MLL_0 ML_0 MR_0 MRR_0
31 MLL_1 ML_1 MR_1 MRR_1
32
33 BLL BL_0 BR_0 BRR
34 BL_1 BR_1
35
36 =============================================================================*/
37
38 #define TLL 0
39 #define TRR 1
40 #define TL_0 2
41 #define TL_1 3
42 #define TR_0 4
43 #define TR_1 5
44
45 #define MLL_0 6
46 #define MLL_1 7
47 #define MRR_0 8
48 #define MRR_1 9
49
50 #define ML_0 10
51 #define ML_1 11
52 #define MR_0 12
53 #define MR_1 13
54
55 #define BL_0 14
56 #define BL_1 15
57 #define BR_0 16
58 #define BR_1 17
59 #define BLL 18
60 #define BRR 19
61
62 #define BIT1 0x00000001
63 #define BIT2 0x00000002
64 #define BIT3 0x00000004
65 #define BIT4 0x00000008
66 #define BIT5 0x00000010
67 #define BIT6 0x00000020
68 #define BIT7 0x00000040
69
70 #define TOP BIT4
71 #define MIDDLE BIT7
72 #define BOTTOM BIT1
73 #define TLEFT BIT5
74 #define BLEFT BIT6
75 #define LEFT (TLEFT|BLEFT)
76 #define TRIGHT BIT3
77 #define BRIGHT BIT2
78 #define RIGHT (TRIGHT|BRIGHT)
79 #define ALL 0xFFFFFFFF
80
81 /*===========================================================================*/
82 /* This is the static array that will map the ASCII value of the character */
83 /* being draw to the bit mask that will be scan converted to the LED display.*/
84 /*===========================================================================*/
85 DWORD textBitMasks[] =
86 {
87 0xFFFFFFFF, // 000
88 0xFFFFFFFF, // 001
89 0xFFFFFFFF, // 002
90 0xFFFFFFFF, // 003
91 0xFFFFFFFF, // 004
92 0xFFFFFFFF, // 005
93 0xFFFFFFFF, // 006
94 0xFFFFFFFF, // 007
95 0xFFFFFFFF, // 008
96 0xFFFFFFFF, // 009
97 0xFFFFFFFF, // 010
98 0xFFFFFFFF, // 011
99 0xFFFFFFFF, // 012
100 0xFFFFFFFF, // 013
101 0xFFFFFFFF, // 014
102 0xFFFFFFFF, // 015
103 0xFFFFFFFF, // 016
104 0xFFFFFFFF, // 017
105 0xFFFFFFFF, // 018
106 0xFFFFFFFF, // 019
107 0xFFFFFFFF, // 020
108 0xFFFFFFFF, // 021
109 0xFFFFFFFF, // 022
110 0xFFFFFFFF, // 023
111 0xFFFFFFFF, // 024
112 0xFFFFFFFF, // 025
113 0xFFFFFFFF, // 026
114 0xFFFFFFFF, // 027
115 0xFFFFFFFF, // 028
116 0xFFFFFFFF, // 029
117 0xFFFFFFFF, // 030
118 0XFFFFFFFF, // 031
119 0x00000000, // 032 'SPC'
120 0xFFFFFFFF, // 033
121 0xFFFFFFFF, // 034
122 0xFFFFFFFF, // 035
123 0xFFFFFFFF, // 036
124 0xFFFFFFFF, // 037
125 0xFFFFFFFF, // 038
126 0xFFFFFFFF, // 039
127 0xFFFFFFFF, // 040
128 0xFFFFFFFF, // 041
129 0xFFFFFFFF, // 042
130 0xFFFFFFFF, // 043
131 0xFFFFFFFF, // 044
132 0xFFFFFFFF, // 045
133 0xFFFFFFFF, // 046
134 0xFFFFFFFF, // 047
135 (ALL &~ MIDDLE), // 048 '0'
136 (RIGHT), // 049 '1'
137 (ALL &~ TLEFT &~ BRIGHT), // 050 '2'
138 (ALL &~ LEFT), // 051 '3'
139 (TLEFT | MIDDLE | RIGHT), // 052 '4'
140 (ALL &~ TRIGHT &~ BLEFT), // 053 '5'
141 (ALL &~ TRIGHT), // 054 '6'
142 (TOP | RIGHT), // 055 '7'
143 (ALL), // 056 '8'
144 (ALL &~ BOTTOM &~ BLEFT), // 057 '9'
145 0xFFFFFFFF, // 058
146 0xFFFFFFFF, // 059
147 0xFFFFFFFF, // 060
148 0XFFFFFFFF, // 061
149 0xFFFFFFFF, // 062
150 0xFFFFFFFF, // 063
151 0xFFFFFFFF, // 064
152 (ALL &~ BOTTOM), // 065 'A'
153 (ALL), // 066 'B'
154 (TOP | LEFT | BOTTOM), // 067 'C'
155 (ALL &~ MIDDLE), // 068 'D'
156 (ALL &~ RIGHT), // 069 'E'
157 (LEFT | TOP | MIDDLE), // 070 'F'
158 0x00000000, // 071 'G'
159 (ALL &~ TOP &~ BOTTOM), // 072 'H'
160 (RIGHT), // 073 'I'
161 (RIGHT | BOTTOM), // 074 'J'
162 0x00000000, // 075 'K'
163 (LEFT | BOTTOM), // 076 'L'
164 0x00000000, // 088 'M'
165 0x00000000, // 089 'N'
166 (ALL &~ MIDDLE), // 090 'O'
167 (ALL &~ BRIGHT &~ BOTTOM),// 091 'P'
168 0x00000000, // 092 'Q'
169 0x00000000, // 093 'R'
170 (ALL &~ TRIGHT &~ BLEFT), // 094 'S'
171 0X00000000, // 095 'T'
172 (LEFT | RIGHT | BOTTOM), // 096 'U'
173 0x00000000, // 097 'V'
174 0x00000000, // 098 'W'
175 0x00000000, // 099 'X'
176 0x00000000, // 1000 'Z'
177 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 100
178 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 104
179 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 108
180 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 112
181 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 116
182 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, // 120
183 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF // 124
184 };
185
186 #define CT 1.0f
187 #define CX 7.0f
188 #define CY 13.0f
189 #define CM ((CY-(CT*3.0f))/2.0f)
190
191 float lCoords[][2] =
192 {
193 /* Top outsides. */
194 { 0, (CY-CT) },
195 { CX, (CY-CT) },
196
197 /* Top Line. */
198 { CT, CY },
199 { CT, (CY-CT) },
200 { (CX-CT), CY },
201 { (CX-CT), (CY-CT) },
202
203 /* Middle outsides. */
204 { 0.0f, (CT+CM+CT) },
205 { 0.0f, (CT+CM) },
206 { CX, (CT+CM+CT) },
207 { CX, (CT+CM) },
208
209 /* Middle Line. */
210 { CT, (CT+CM+CT) },
211 { CT, (CT+CM) },
212 { (CX-CT), (CT+CM+CT) },
213 { (CX-CT), (CT+CM) },
214
215 /* Bottom line. */
216 { CT, CT },
217 { CT, 0.0f },
218 { (CX-CT), CT },
219 { (CX-CT), 0.0f },
220
221 /* Bottom outsides. */
222 { 0.0f, CT},
223 { CX, CT }
224 };
225
226 static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics );
227
228 D3DTLVERTEX TextVertices[MAX_VERTICES];
229 /*===========================================================================*/
230 /* When we attach I will zero out the whole D3D vertex buffer I'm using for */
231 /* the text. This way I don't need to set all the redundant values. I also */
232 /* set all the oow values to 1 as I will be doing direct rendering. */
233 /*===========================================================================*/
234 /* RETURN: TRUE, FALSE. */
235 /*===========================================================================*/
236 extern "C" BOOL InitD3DText( void )
237 {
238 int index;
239
240 /* Set the D3D Vertex Buffer up once so we don't do redundant changes. */
241 memset( &TextVertices[0], 0, sizeof(TextVertices) );
242 for( index = 0; index < MAX_VERTICES; index++ )
243 TextVertices[index].rhw = D3DVAL( 1.0 );
244
245 return TRUE;
246 }
247 /*===========================================================================*/
248 /* This function takes a single character and draw it using the supplied */
249 /* fontmetrics structure. */
250 /*===========================================================================*/
251 /* RETURN: */
252 /*===========================================================================*/
253 extern "C" void d3dTextDrawString( char *pszString, int x, int y, PD3DFONTMETRICS pfntMetrics )
254 {
255 int cIndex,
256 nIndex,
257 index;
258 float cWidth = CX,
259 cHeight = CY;
260
261 /* Find the max width/height of a character and add the spacing so */
262 /* that we can use this value to calculate the x,y of the character.*/
263 cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing;
264 cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing;
265
266 /* Walk the string. This must be NULL terminated. */
267 for( cIndex = 0, nIndex = 0; *pszString; pszString++, cIndex = nIndex, x++ )
268 {
269 /* Convert the character and get the index into the text vertex buffer. */
270 nIndex = ConvertCharacter( &pszString[0], cIndex, pfntMetrics );
271 if ( (nIndex - cIndex) > 2 )
272 {
273 /* Modify the text vertex buffer based on the fntMetrics structure. */
274 for( index = cIndex; index < nIndex; index++ )
275 {
276 /* Scale the character. */
277 TextVertices[index].sx *= pfntMetrics->fntXScale;
278 TextVertices[index].sy *= pfntMetrics->fntYScale;
279
280 /* Move the character. */
281 TextVertices[index].sx += (cWidth*x);
282 TextVertices[index].sy += (cHeight*y);
283
284 /* Set the color. */
285 TextVertices[index].color = pfntMetrics->dwColor;
286 }
287 }
288 }
289
290 if ( nIndex < 3 )
291 return;
292
293 /* Set the states that slim things down. */
294 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
295 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
296 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
297 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE );
298 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
299 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
300
301 /* Blast them baby... */
302 pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST,
303 D3DFVF_TLVERTEX,
304 (LPVOID)&TextVertices[0],
305 nIndex,
306 (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
307 }
308 /*===========================================================================*/
309 /* This function takes a single character and draw it directly to the screen*/
310 /* unsing the supplied fntMetrics structure. The character will be drawn at */
311 /* the supplied x,y. The x,y position is relative to the top left and uses */
312 /* the spacing in the fntMetrics structure. */
313 /*===========================================================================*/
314 /* RETURN: */
315 /*===========================================================================*/
316 extern "C" void d3dTextDrawCharacter( char *c, int x, int y, PD3DFONTMETRICS pfntMetrics )
317 {
318 int cIndex = 0,
319 index;
320 float cWidth = CX,
321 cHeight = CY;
322
323 /* Convert the character and get the index into the text vertex buffer. */
324 cIndex = ConvertCharacter( c, 0, pfntMetrics );
325 if ( cIndex < 3 )
326 return;
327
328 /* Find the max width/height of a character and add the spacing so */
329 /* that we can use this value to calculate the x,y of the character.*/
330 cWidth = (cWidth * pfntMetrics->fntXScale) + pfntMetrics->fntXSpacing;
331 cHeight = (cHeight * pfntMetrics->fntYScale) + pfntMetrics->fntYSpacing;
332
333 /* Modify the text vertex buffer based on the fntMetrics structure. */
334 for( index = 0; index < cIndex; index++ )
335 {
336 /* Scale the character. */
337 TextVertices[index].sx *= pfntMetrics->fntXScale;
338 TextVertices[index].sy *= pfntMetrics->fntYScale;
339
340 /* Move the character. */
341 TextVertices[index].sx += (cWidth*x);
342 TextVertices[index].sy += (cHeight*y);
343
344 /* Set the color. */
345 TextVertices[index].color = pfntMetrics->dwColor;
346 }
347
348
349 /* Set the states that slim things down. */
350 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_CULLMODE, D3DCULL_NONE );
351 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_FILLMODE, D3DFILL_SOLID );
352 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZENABLE, FALSE );
353 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ZWRITEENABLE , FALSE );
354 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHATESTENABLE, FALSE );
355 pfntMetrics->lpD3DDevice->SetRenderState( D3DRENDERSTATE_ALPHABLENDENABLE, FALSE );
356
357 /* Blast them baby... */
358 pfntMetrics->lpD3DDevice->DrawPrimitive( D3DPT_TRIANGLELIST,
359 D3DFVF_TLVERTEX,
360 (LPVOID)&TextVertices[0],
361 cIndex,
362 (D3DDP_DONOTCLIP | D3DDP_DONOTLIGHT) );
363 }
364 /*===========================================================================*/
365 /* This function takes a single character and draw it using the supplied */
366 /* fontmetrics structure. */
367 /*===========================================================================*/
368 /* RETURN: */
369 /*===========================================================================*/
370 static int ConvertCharacter( char *c, int cIndex, PD3DFONTMETRICS pfntMetrics )
371 {
372 DWORD asciiChar = (int)(*c);
373
374 /* Handle the TOP line. */
375 if ( textBitMasks[asciiChar] & BIT1 )
376 {
377 TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] );
378 TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] );
379 TextVertices[cIndex].sx = D3DVAL( lCoords[TR_0][0] );
380 TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_0][1] );
381 TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
382 TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
383 TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
384 TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
385 TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
386 TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] );
387 TextVertices[cIndex].sx = D3DVAL( lCoords[TL_0][0] );
388 TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_0][1] );
389 }
390
391 /* Handle the TOP/BOTTOM RIGHT lines. */
392 // if ( textBitMasks[index] & (BIT2|BIT3) )
393 if ( 1 == 0 )
394 {
395 TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
396 TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
397 TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] );
398 TextVertices[cIndex++].sy= D3DVAL( lCoords[TRR][1] );
399 TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
400 TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] );
401 TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
402 TextVertices[cIndex++].sy= D3DVAL( lCoords[BRR][1] );
403 TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
404 TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] );
405 TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
406 TextVertices[cIndex++].sy= D3DVAL( lCoords[TR_1][1] );
407 }
408 else
409 {
410 if ( textBitMasks[asciiChar] & BIT2 )
411 {
412 TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
413 TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] );
414 TextVertices[cIndex].sx = D3DVAL( lCoords[TRR][0] );
415 TextVertices[cIndex++].sy = D3DVAL( lCoords[TRR][1] );
416 TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] );
417 TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] );
418 TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_0][0] );
419 TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_0][1] );
420 TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] );
421 TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_0][1] );
422 TextVertices[cIndex].sx = D3DVAL( lCoords[TR_1][0] );
423 TextVertices[cIndex++].sy = D3DVAL( lCoords[TR_1][1] );
424 }
425 if ( textBitMasks[asciiChar] & BIT3 )
426 {
427 TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
428 TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] );
429 TextVertices[cIndex].sx = D3DVAL( lCoords[MRR_1][0] );
430 TextVertices[cIndex++].sy = D3DVAL( lCoords[MRR_1][1] );
431 TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
432 TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] );
433 TextVertices[cIndex].sx = D3DVAL( lCoords[BRR][0] );
434 TextVertices[cIndex++].sy = D3DVAL( lCoords[BRR][1] );
435 TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
436 TextVertices[cIndex++].sy = D3DVAL( lCoords[BR_0][1] );
437 TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
438 TextVertices[cIndex++].sy = D3DVAL( lCoords[MR_1][1] );
439 }
440 }
441
442 /* Handle the TOP/BOTTOM LEFT lines. */
443 // if ( textBitMasks[asciiChar] & (BIT5|BIT6) )
444 if ( 1 == 0 )
445 {
446 TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
447 TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] );
448 TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
449 TextVertices[cIndex++].sy= D3DVAL( lCoords[TL_1][1] );
450 TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
451 TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
452 TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
453 TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
454 TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] );
455 TextVertices[cIndex++].sy= D3DVAL( lCoords[BLL][1] );
456 TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
457 TextVertices[cIndex++].sy= D3DVAL( lCoords[TLL][1] );
458 }
459 else
460 {
461 if ( textBitMasks[asciiChar] & BIT5 )
462 {
463 TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] );
464 TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] );
465 TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] );
466 TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_1][1] );
467 TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
468 TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] );
469 TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
470 TextVertices[cIndex++].sy = D3DVAL( lCoords[BL_0][1] );
471 TextVertices[cIndex].sx = D3DVAL( lCoords[BLL][0] );
472 TextVertices[cIndex++].sy = D3DVAL( lCoords[BLL][1] );
473 TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_1][0] );
474 TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_1][1] );
475 }
476 if ( textBitMasks[asciiChar] & BIT6 )
477 {
478 TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
479 TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] );
480 TextVertices[cIndex].sx = D3DVAL( lCoords[TL_1][0] );
481 TextVertices[cIndex++].sy = D3DVAL( lCoords[TL_1][1] );
482 TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
483 TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] );
484 TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
485 TextVertices[cIndex++].sy = D3DVAL( lCoords[ML_0][1] );
486 TextVertices[cIndex].sx = D3DVAL( lCoords[MLL_0][0] );
487 TextVertices[cIndex++].sy = D3DVAL( lCoords[MLL_0][1] );
488 TextVertices[cIndex].sx = D3DVAL( lCoords[TLL][0] );
489 TextVertices[cIndex++].sy = D3DVAL( lCoords[TLL][1] );
490 }
491 }
492
493 /* Handle the MIDDLE line. */
494 if ( textBitMasks[asciiChar] & BIT7 )
495 {
496 TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
497 TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] );
498 TextVertices[cIndex].sx = D3DVAL( lCoords[MR_0][0] );
499 TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_0][1] );
500 TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
501 TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] );
502 TextVertices[cIndex].sx = D3DVAL( lCoords[MR_1][0] );
503 TextVertices[cIndex++].sy= D3DVAL( lCoords[MR_1][1] );
504 TextVertices[cIndex].sx = D3DVAL( lCoords[ML_1][0] );
505 TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_1][1] );
506 TextVertices[cIndex].sx = D3DVAL( lCoords[ML_0][0] );
507 TextVertices[cIndex++].sy= D3DVAL( lCoords[ML_0][1] );
508 }
509
510 /* Handle the BOTTOM line. */
511 if ( textBitMasks[asciiChar] & BIT4 )
512 {
513 TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
514 TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
515 TextVertices[cIndex].sx = D3DVAL( lCoords[BR_0][0] );
516 TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_0][1] );
517 TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] );
518 TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] );
519 TextVertices[cIndex].sx = D3DVAL( lCoords[BR_1][0] );
520 TextVertices[cIndex++].sy= D3DVAL( lCoords[BR_1][1] );
521 TextVertices[cIndex].sx = D3DVAL( lCoords[BL_1][0] );
522 TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_1][1] );
523 TextVertices[cIndex].sx = D3DVAL( lCoords[BL_0][0] );
524 TextVertices[cIndex++].sy= D3DVAL( lCoords[BL_0][1] );
525 }
526
527 return cIndex;
528 }
529
530 #undef CM
531 #undef CY
532 #undef CX
533 #undef CT
534
535 #undef TLL
536 #undef TRR
537 #undef TL_0
538 #undef TL_1
539 #undef TR_0
540 #undef TR_1
541
542 #undef MLL_0
543 #undef MLL_1
544 #undef MRR_0
545 #undef MRR_1
546
547 #undef ML_0
548 #undef ML_1
549 #undef MR_0
550 #undef MR_1
551
552 #undef BL_0
553 #undef BL_1
554 #undef BR_0
555 #undef BR_1
556 #undef BLL
557 #undef BRR
558
559 #undef BIT1
560 #undef BIT2
561 #undef BIT3
562 #undef BIT4
563 #undef BIT5
564 #undef BIT6
565 #undef BIT7
566
567 #undef TOP
568 #undef MIDDLE
569 #undef BOTTOM
570 #undef TLEFT
571 #undef BLEFT
572 #undef LEFT
573 #undef TRIGHT
574 #undef BRIGHT
575 #undef RIGHT
576 #undef ALL