aboutsummaryrefslogtreecommitdiff
path: root/docs/doxygen/nel/font__generator_8cpp-source.html
blob: c101e4600b95d0b7816ff9a4cf9585f931b23e51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
	<TITLE>nevrax.org : docs</TITLE>
	<LINK REL=stylesheet TYPE="text/css" HREF="/inc/css/nevrax.css">
	<link href="doxygen.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY MARGINHEIGHT="0" MARGINWIDTH="0">

<!-- uplinks -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0>
 <TR>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=140 BGCOLOR=#dddddd><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
        <TD><IMG width=6 height=14 SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>Home</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
        <TD><IMG  width=6 height=14  SRC="/inc/img/reddots.gif" ALT="#" VSPACE=2 HSPACE=2 BORDER=0 ></TD><TD VALIGN=middle>&nbsp;<A CLASS=uplinks HREF='/'><b>nevrax.com</B></FONT></A>&nbsp;&nbsp;&nbsp;</TD>
 </TR>
</TABLE> 

<!-- banner Nevrax -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 WIDTH=100%>
 <TR><TD  BGCOLOR="#000000" BACKGROUND="/inc/img/black_banner.jpg"><A HREF=""><IMG  SRC="/inc/img/nevrax.gif" WIDTH="170" HEIGHT="45" BORDER=0 ALT="Nevrax" ></A></TD></TR>
</TABLE>

<!-- main table -->
<TABLE CELLSPACING=0 CELLPADDING=0  BORDER=0 height=100%>
 <TR>
	<TD WIDTH=16><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="10" BORDER=0 ALT=""></TD>
	<TD WIDTH=140   BGCOLOR=#dddddd VALIGN=TOP ALIGN=middle><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

		<!------ Begin Box ------>
		<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 BGCOLOR=black><TR><TD><TABLE border=0  cellspacing=2 cellpadding=0 width=120><tr><TD ALIGN=middle bgcolor=black>
		<FONT COLOR=white FACE="sans-serif"><B>Nevrax.org</B></FONT></TD></TR><tr><td  colspan=2 bgcolor=#FFFFFF>
		<TABLE cellspacing=0 cellpadding=1 border=0>
			<tr><td ALIGN=middle><a  class='linkbox' href="/news/" TITLE="Rubrique news"><img width=13 height=15  hspace=5 border=0 src=/inc/img/picto-news.gif ALT=#></A></td><td><a  class='linkbox' href="/news/" TITLE="News">News</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/mail/" TITLE="Rubrique mail"><img width=15 height=11  hspace=5 border=0 src=/inc/img/picto-mail.gif ALT=#></A></td><td><a  class='linkbox' href="/mail/" TITLE="Mailing list archive">Mailing-list</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/docs/" TITLE="Rubrique docs"><img width=14 height=16  hspace=5 border=0 src=/inc/img/picto-docs.gif ALT=#></A></td><td><a  class='linkbox' href="/docs/" TITLE="Documentation">Documentation</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/cvs/" TITLE="Rubrique cvs"><img width=13 height=17  hspace=5 border=0 src=/inc/img/picto-cvs.gif ALT=#></A></td><td><a  class='linkbox' href="/cvs/" TITLE="CVS Web">CVS</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/bugs/" TITLE="Rubrique bugs"><img width=20 height=16  hspace=5 border=0 src=/inc/img/picto-bugs.gif ALT=#></A></td><td><a  class='linkbox' href="/bugs/" TITLE="Bugtracking">Bugs</a></td></tr>
			<tr><td ALIGN=middle><a  class='linkbox' href="/GPL.php3" TITLE="Rubrique license"><img  width=18 height=12   hspace=5 border=0 src=/inc/img/picto-gpl.gif ALT=#></A></td><td><a  class='linkbox' href="/GPL.php3" TITLE="License">License</a></td></tr>
		</TABLE>
		</TD></TR></TABLE></TD></TR></TABLE>
		<!------ End Box  ------>

	</TD>
	<TD WIDTH=15><IMG  SRC="/inc/img/pixel.gif" WIDTH="16" HEIGHT="16" BORDER=0 ALT=""></TD>
	<TD ALIGN=left valign=top><IMG  SRC="/inc/img/pixel.gif" WIDTH="140" HEIGHT="10" BORDER=0 ALT="">

<!-- title -->
<TABLE  background="/inc/img/redline.gif" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td>
<A HREF="/docs/"><img src="/inc/img/t_docs.gif" ALT="Docs" HEIGHT=20 BORDER=0></A>
</td><td><IMG  SRC="/inc/img/pixel.gif" WIDTH="1" HEIGHT="1" BORDER=0 ALT="">
</td></tr></table>
&nbsp;

<!-- block -->
<TABLE  bgcolor="#dddddd" CELLSPACING=0 CELLPADDING=0  BORDER=0 width=100%><tr><td width=1% valign=middle><img width=6 height=14 hspace=2 vspace=2 src="/inc/img/reddots.gif"></TD>
	<TD><B>Documentation</B></TD>
	<TD ALIGN=RIGHT>&nbsp;</td>
</tr></table>
<!-- Generated by Doxygen 1.2.14 -->
<center>
<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="namespaces.html">Namespace List</a> &nbsp; <a class="qindex" href="hierarchy.html">Class Hierarchy</a> &nbsp; <a class="qindex" href="classes.html">Alphabetical List</a> &nbsp; <a class="qindex" href="annotated.html">Compound List</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="namespacemembers.html">Namespace Members</a> &nbsp; <a class="qindex" href="functions.html">Compound Members</a> &nbsp; <a class="qindex" href="globals.html">File Members</a> &nbsp; <a class="qindex" href="pages.html">Related Pages</a> &nbsp; <a class="qindexRef" doxygen="_cgi:/cgi-bin/nel-search.cgi" href="/cgi-bin/nel-search.cgi">Search</a> &nbsp; </center>
<hr><h1>font_generator.cpp</h1><a href="font__generator_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 
00007 <font class="comment">/* Copyright, 2000 Nevrax Ltd.</font>
00008 <font class="comment"> *</font>
00009 <font class="comment"> * This file is part of NEVRAX NEL.</font>
00010 <font class="comment"> * NEVRAX NEL is free software; you can redistribute it and/or modify</font>
00011 <font class="comment"> * it under the terms of the GNU General Public License as published by</font>
00012 <font class="comment"> * the Free Software Foundation; either version 2, or (at your option)</font>
00013 <font class="comment"> * any later version.</font>
00014 <font class="comment"></font>
00015 <font class="comment"> * NEVRAX NEL is distributed in the hope that it will be useful, but</font>
00016 <font class="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</font>
00017 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</font>
00018 <font class="comment"> * General Public License for more details.</font>
00019 <font class="comment"></font>
00020 <font class="comment"> * You should have received a copy of the GNU General Public License</font>
00021 <font class="comment"> * along with NEVRAX NEL; see the file COPYING. If not, write to the</font>
00022 <font class="comment"> * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,</font>
00023 <font class="comment"> * MA 02111-1307, USA.</font>
00024 <font class="comment"> */</font>
00025 
00026 <font class="preprocessor">#include "<a class="code" href="std3d_8h.html">std3d.h</a>"</font>
00027 
00028 <font class="preprocessor">#include &lt;string&gt;</font>
00029 
00030 <font class="preprocessor">#include "<a class="code" href="types__nl_8h.html">nel/misc/types_nl.h</a>"</font>
00031 <font class="preprocessor">#include "<a class="code" href="debug_8h.html">nel/misc/debug.h</a>"</font>
00032 <font class="preprocessor">#include "<a class="code" href="common_8h.html">nel/misc/common.h</a>"</font>
00033 <font class="preprocessor">#include "<a class="code" href="path_8h.html">nel/misc/path.h</a>"</font>
00034 
00035 <font class="preprocessor">#include "<a class="code" href="font__generator_8h.html">3d/font_generator.h</a>"</font>
00036 
00037 <font class="keyword">using</font> <font class="keyword">namespace </font>std;
00038 
00039 <font class="preprocessor">#ifndef NL_DONT_USE_EXTERNAL_CODE</font>
00040 <font class="preprocessor"></font>
00041 <font class="preprocessor">#include &lt;freetype/freetype.h&gt;</font>
00042 
00043 <font class="comment">// for freetype 2.0</font>
00044 <font class="preprocessor">#ifdef FTERRORS_H</font>
00045 <font class="preprocessor"></font><font class="preprocessor">#undef FTERRORS_H</font>
00046 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00047 <font class="preprocessor"></font>
00048 <font class="comment">// for freetype 2.0.1</font>
00049 <font class="preprocessor">#ifdef __FTERRORS_H__</font>
00050 <font class="preprocessor"></font><font class="preprocessor">#undef __FTERRORS_H__</font>
00051 <font class="preprocessor"></font><font class="preprocessor">#endif</font>
00052 <font class="preprocessor"></font>
<a name="l00053"></a><a class="code" href="font__generator_8cpp.html#a0">00053</a> <font class="preprocessor">#define FT_ERRORDEF( e, v, s )  { e, s },</font>
<a name="l00054"></a><a class="code" href="font__generator_8cpp.html#a1">00054</a> <font class="preprocessor"></font><font class="preprocessor">#define FT_ERROR_START_LIST  {</font>
<a name="l00055"></a><a class="code" href="font__generator_8cpp.html#a2">00055</a> <font class="preprocessor"></font><font class="preprocessor">#define FT_ERROR_END_LIST    { 0, 0 } };</font>
00056 <font class="preprocessor"></font>
00057 <font class="keyword">const</font> <font class="keyword">struct</font>
00058 <font class="keyword"></font>{
<a name="l00059"></a><a class="code" href="font__generator_8cpp.html#a3">00059</a> <font class="keywordtype">int</font>          <a class="code" href="font__generator_8cpp.html#a3">err_code</a>;
<a name="l00060"></a><a class="code" href="font__generator_8cpp.html#a4">00060</a> <font class="keyword">const</font> <font class="keywordtype">char</font>*  <a class="code" href="font__generator_8cpp.html#a4">err_msg</a>;
00061 } <a class="code" href="font__generator_8cpp.html#a5">ft_errors</a>[] = 
00062 
00063 <font class="preprocessor">#include &lt;freetype/fterrors.h&gt;</font>
00064 
00065 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00066 
00067 <font class="keyword">namespace </font>NL3D {
00068 
<a name="l00069"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#r0">00069</a> FT_Library      CFontGenerator::_Library;
<a name="l00070"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#r1">00070</a> <font class="keywordtype">bool</font>            CFontGenerator::_LibraryInit = <font class="keyword">false</font>;
00071 
00072 
<a name="l00073"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#c0">00073</a> <font class="keyword">const</font> <font class="keywordtype">char</font> *CFontGenerator::getFT2Error(FT_Error fte)
00074 {
00075         NL_ALLOC_CONTEXT (FreeTyp);
00076 
00077         <font class="keyword">static</font> <font class="keywordtype">char</font> ukn[1024];
00078 
00079         <font class="keywordflow">for</font> (uint32 i = 0; <a class="code" href="font__generator_8cpp.html#a5">ft_errors</a>[i].err_code != 0 || <a class="code" href="font__generator_8cpp.html#a5">ft_errors</a>[i].err_msg != 0; i++)
00080         {
00081                 <font class="keywordflow">if</font> (<a class="code" href="font__generator_8cpp.html#a5">ft_errors</a>[i].err_code == fte)
00082                         <font class="keywordflow">return</font> <a class="code" href="font__generator_8cpp.html#a5">ft_errors</a>[i].err_msg;
00083         }
00084         <a class="code" href="namespaceNLMISC.html#a211">smprintf</a> (ukn, 1024, <font class="stringliteral">"Unknown freetype2 error, errcode: 0x%x"</font>, fte);
00085         <font class="keywordflow">return</font> ukn;
00086 }
00087 
00088 
00089  
00090 <font class="comment">/*</font>
00091 <font class="comment"> * Constructor</font>
00092 <font class="comment"> */</font>
<a name="l00093"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#a0">00093</a> CFontGenerator::CFontGenerator (<font class="keyword">const</font> std::string &amp;fontFileName, <font class="keyword">const</font> std::string &amp;fontExFileName)
00094 {
00095         NL_ALLOC_CONTEXT (FreeTyp);
00096 
00097         FT_Error error;
00098 
00099         <font class="keywordflow">if</font> (!<a class="code" href="classNL3D_1_1CFontGenerator.html#r1">_LibraryInit</a>)
00100         {
00101                 error = FT_Init_FreeType (&amp;<a class="code" href="classNL3D_1_1CFontGenerator.html#r0">_Library</a>);
00102                 <font class="keywordflow">if</font> (error)
00103                 {
00104                         <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Init_FreeType() failed: %s"</font>, <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00105                 }
00106                 <a class="code" href="classNL3D_1_1CFontGenerator.html#r1">_LibraryInit</a> = <font class="keyword">true</font>;
00107         }
00108 
00109         error = FT_New_Face (<a class="code" href="classNL3D_1_1CFontGenerator.html#r0">_Library</a>, fontFileName.c_str (), 0, &amp;<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>);
00110         <font class="keywordflow">if</font> (error)
00111         {
00112                 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_New_Face() failed with file '%s': %s"</font>, fontFileName.c_str(), <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00113         }
00114 
00115         string fontEx = fontExFileName;
00116         <font class="keywordflow">if</font> (fontEx == <font class="stringliteral">""</font>)
00117         {
00118                 <font class="comment">// try to see if the ex filename exists based on the fontExFileName</font>
00119                 fontEx = CPath::lookup(CFile::getFilenameWithoutExtension (fontFileName)+<font class="stringliteral">".afm"</font>, <font class="keyword">false</font>, <font class="keyword">false</font>);
00120         }
00121 
00122         <font class="keywordflow">if</font> (fontEx != <font class="stringliteral">""</font>)
00123         {
00124                 error = FT_Attach_File (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, fontEx.c_str ());
00125                 <font class="keywordflow">if</font> (error)
00126                 {
00127                         <a class="code" href="debug_8h.html#a2">nlwarning</a> (<font class="stringliteral">"FT_Attach_File() failed with file '%s': %s"</font>, fontEx.c_str(), <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00128                 }
00129         }
00130 
00131         error = FT_Select_Charmap (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, ft_encoding_unicode);
00132         <font class="keywordflow">if</font> (error)
00133         {
00134                 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Select_Charmap() failed with file '%s': %s"</font>, fontFileName.c_str(), <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00135         }
00136 }
00137 
<a name="l00138"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#a1">00138</a> CFontGenerator::~CFontGenerator ()
00139 {
00140 }
00141 
<a name="l00142"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#a3">00142</a> <font class="keywordtype">void</font> CFontGenerator::getSizes (<a class="code" href="types__nl_8h.html#a15">ucchar</a> c, uint32 size, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>)
00143 {
00144         NL_ALLOC_CONTEXT (FreeTyp);
00145 
00146         FT_Error error;
00147 
00148         error = FT_Set_Pixel_Sizes (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, size, size);
00149         <font class="keywordflow">if</font> (error)
00150         {
00151                 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Set_Pixel_Sizes() failed: %s"</font>, <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00152         }
00153 
00154         <font class="comment">// retrieve glyph index from character code</font>
00155         FT_UInt glyph_index = FT_Get_Char_Index (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, c);
00156 
00157         <font class="comment">// load glyph image into the slot (erase previous one)</font>
00158         error = FT_Load_Glyph (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, glyph_index, FT_LOAD_DEFAULT);
00159         <font class="keywordflow">if</font> (error)
00160         {
00161                 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Load_Glyph() failed: %s"</font>, <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00162         }
00163 
00164         <font class="comment">// convert 24.6 fixed point into integer</font>
00165         <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;metrics.width &gt;&gt; 6;
00166         <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;metrics.height &gt;&gt; 6;
00167 }
00168 
<a name="l00169"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#a2">00169</a> uint8 *CFontGenerator::getBitmap (<a class="code" href="types__nl_8h.html#a15">ucchar</a> c, uint32 size, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>, uint32 &amp;pitch, sint32 &amp;left, sint32 &amp;top, sint32 &amp;advx, uint32 &amp;glyphIndex)
00170 {
00171         NL_ALLOC_CONTEXT (FreeTyp);
00172 
00173         FT_Error error;
00174 
00175         error = FT_Set_Pixel_Sizes (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, size, size);
00176         <font class="keywordflow">if</font> (error)
00177         {
00178                 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Set_Pixel_Sizes() failed: %s"</font>, <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00179         }
00180 
00181         <font class="comment">// retrieve glyph index from character code</font>
00182         FT_UInt glyph_index = FT_Get_Char_Index (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, c);
00183 
00184         <font class="comment">// load glyph image into the slot (erase previous one)</font>
00185         error = FT_Load_Glyph (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, glyph_index, FT_LOAD_DEFAULT);
00186         <font class="keywordflow">if</font> (error)
00187         {
00188                 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Load_Glyph() failed: %s"</font>, <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00189         }
00190 
00191         <font class="keywordflow">if</font> (size == 0)
00192         {
00193                 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = 0;
00194                 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = 0;
00195                 pitch = 0;
00196                 left = 0;
00197                 top = 0;
00198                 advx = 0;
00199                 glyphIndex = glyph_index;
00200                 <font class="keywordflow">return</font> NULL;
00201         }
00202 
00203         <font class="comment">// convert to an anti-aliased bitmap</font>
00204         error = FT_Render_Glyph (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph, ft_render_mode_normal);
00205         <font class="keywordflow">if</font> (error)
00206         {
00207                 <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Render_Glyph() failed: %s"</font>, <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00208         }
00209 
00210         <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;bitmap.width;
00211         <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;bitmap.rows;
00212         pitch = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;bitmap.pitch;
00213 
00214         left = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;bitmap_left;
00215         top = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;bitmap_top;
00216 
00217         advx = <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;advance.x &gt;&gt; 6;
00218 
00219         glyphIndex = glyph_index;
00220 
00221         <font class="keywordflow">return</font> (uint8 *) <a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>-&gt;glyph-&gt;bitmap.buffer;
00222 }
00223 
00224 
00225 
<a name="l00226"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#a4">00226</a> <font class="keywordtype">void</font> CFontGenerator::getKerning (<a class="code" href="types__nl_8h.html#a15">ucchar</a> left, <a class="code" href="types__nl_8h.html#a15">ucchar</a> right, sint32 &amp;kernx)
00227 {
00228         NL_ALLOC_CONTEXT (FreeTyp);
00229 
00230         <font class="keywordflow">if</font> (!FT_HAS_KERNING(<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>))
00231         {
00232                 kernx = 0;
00233         }
00234         <font class="keywordflow">else</font>
00235         {
00236                 FT_Vector  kerning;
00237                 FT_Error error = FT_Get_Kerning (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, left, right, ft_kerning_default, &amp;kerning);
00238                 <font class="keywordflow">if</font> (error)
00239                 {
00240                         <a class="code" href="debug_8h.html#a3">nlerror</a> (<font class="stringliteral">"FT_Get_Kerning() failed: %s"</font>, <a class="code" href="classNL3D_1_1CFontGenerator.html#c0">getFT2Error</a>(error));
00241                 }
00242                 kernx = kerning.x;
00243         }
00244 }
00245 
00246 
00247 
<a name="l00248"></a><a class="code" href="classNL3D_1_1CFontGenerator.html#a5">00248</a> uint32   CFontGenerator::getCharIndex (<a class="code" href="types__nl_8h.html#a15">ucchar</a> c)
00249 {
00250         NL_ALLOC_CONTEXT (FreeTyp);
00251 
00252         <font class="keywordflow">return</font> FT_Get_Char_Index (<a class="code" href="classNL3D_1_1CFontGenerator.html#o0">_Face</a>, c);
00253 }
00254 
00255 } <font class="comment">// NL3D</font>
00256 
00257 <font class="preprocessor">#else // NL_DONT_USE_EXTERNAL_CODE</font>
00258 <font class="preprocessor"></font>
00259 <font class="preprocessor">#include &lt;windows.h&gt;</font>
00260 
00261 <font class="keyword">using</font> <font class="keyword">namespace </font>NLMISC;
00262 
00263 <font class="keyword">namespace </font>NL3D {
00264  
00265 HBITMAP Dib;
00266 uint32 *Buffer;
00267 HDC hdcDib;
00268 <font class="keywordtype">int</font> Width = 100;
00269 <font class="keywordtype">int</font> Height = 100;
00270 
00271 <font class="comment">/*</font>
00272 <font class="comment"> * Constructor</font>
00273 <font class="comment"> */</font>
00274 CFontGenerator::CFontGenerator (<font class="keyword">const</font> std::string &amp;fontFileName, <font class="keyword">const</font> std::string &amp;fontExFileName)
00275 {
00276 
00277 <font class="comment">//      HWND win=(HWND)winHack;</font>
00278 <font class="comment">//      WindowHandle = win;</font>
00279 <font class="comment">//      Format = format;</font>
00280 <font class="comment">//      RECT rect;</font>
00281 <font class="comment">//      BOOL ret = GetClientRect( WindowHandle, &amp;rect);</font>
00282 <font class="comment">//      assert (ret);</font>
00283 
00284 <font class="comment">//      uint f = AddFontResource ("");</font>
00285 <font class="comment">//      nlassert (f);</font>
00286 
00287         BITMAPINFO info;
00288         info.bmiHeader.biWidth = Width;
00289         info.bmiHeader.biHeight= -Height;
00290         info.bmiHeader.biSize = <font class="keyword">sizeof</font> (BITMAPINFOHEADER);
00291         info.bmiHeader.biPlanes = 1; 
00292         info.bmiHeader.biBitCount = 32;
00293         info.bmiHeader.biCompression = BI_RGB;
00294         info.bmiHeader.biSizeImage = 4*Width*Height;
00295         info.bmiHeader.biXPelsPerMeter = 1;
00296         info.bmiHeader.biYPelsPerMeter = 1;
00297         info.bmiHeader.biClrUsed = 0;
00298         info.bmiHeader.biClrImportant = 0;
00299 
00300         HDC hdc = GetDC (NULL);
00301         <a class="code" href="debug_8h.html#a6">nlassert</a> (hdc);
00302         Dib = CreateDIBSection (hdc, &amp;info, DIB_RGB_COLORS, (<font class="keywordtype">void</font>**)&amp;Buffer, NULL, NULL);
00303 
00304         hdcDib = CreateCompatibleDC (hdc);
00305         <a class="code" href="debug_8h.html#a6">nlassert</a> (hdcDib);
00306 
00307 
00308         ReleaseDC (NULL, hdc);
00309 
00310         SetTextAlign (hdcDib, TA_TOP | TA_LEFT | TA_NOUPDATECP);
00311         SetBkColor (hdcDib, RGB (0,0,0));
00312         SetTextColor (hdcDib, RGB (255, 255, 255));
00313         
00314         <font class="comment">/*FT_Error error;</font>
00315 <font class="comment"></font>
00316 <font class="comment">        if (!_LibraryInit)</font>
00317 <font class="comment">        {</font>
00318 <font class="comment">                error = FT_Init_FreeType (&amp;_Library);</font>
00319 <font class="comment">                if (error)</font>
00320 <font class="comment">                {</font>
00321 <font class="comment">                        nlerror ("FT_Init_FreeType() failed: %s", getFT2Error(error));</font>
00322 <font class="comment">                }</font>
00323 <font class="comment">                _LibraryInit = true;</font>
00324 <font class="comment">        }</font>
00325 <font class="comment"></font>
00326 <font class="comment">        error = FT_New_Face (_Library, fontFileName.c_str (), 0, &amp;_Face);</font>
00327 <font class="comment">        if (error)</font>
00328 <font class="comment">        {</font>
00329 <font class="comment">                nlerror ("FT_New_Face() failed with file '%s': %s", fontFileName.c_str(), getFT2Error(error));</font>
00330 <font class="comment">        }</font>
00331 <font class="comment"></font>
00332 <font class="comment">        if (fontExFileName != "")</font>
00333 <font class="comment">        {</font>
00334 <font class="comment">                error = FT_Attach_File (_Face, fontExFileName.c_str ());</font>
00335 <font class="comment">                if (error)</font>
00336 <font class="comment">                {</font>
00337 <font class="comment">                        nlwarning ("FT_Attach_File() failed with file '%s': %s", fontExFileName.c_str(), getFT2Error(error));</font>
00338 <font class="comment">                }</font>
00339 <font class="comment">        }*/</font>
00340 }
00341 
00342 CFontGenerator::~CFontGenerator ()
00343 {
00344         DeleteObject (Dib);
00345 
00346         DeleteDC (hdcDib);
00347 }
00348 
00349 <font class="keywordtype">void</font> CFontGenerator::getSizes (<a class="code" href="types__nl_8h.html#a15">ucchar</a> c, uint32 size, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>)
00350 {
00351 <font class="comment">/*      FT_Error error;</font>
00352 <font class="comment"></font>
00353 <font class="comment">        error = FT_Set_Pixel_Sizes (_Face, size, size);</font>
00354 <font class="comment">        if (error)</font>
00355 <font class="comment">        {</font>
00356 <font class="comment">                nlerror ("FT_Set_Pixel_Sizes() failed: %s", getFT2Error(error));</font>
00357 <font class="comment">        }</font>
00358 <font class="comment"></font>
00359 <font class="comment">        // retrieve glyph index from character code</font>
00360 <font class="comment">        FT_UInt glyph_index = FT_Get_Char_Index (_Face, c);</font>
00361 <font class="comment"></font>
00362 <font class="comment">        // load glyph image into the slot (erase previous one)</font>
00363 <font class="comment">        error = FT_Load_Glyph (_Face, glyph_index, FT_LOAD_DEFAULT);</font>
00364 <font class="comment">        if (error)</font>
00365 <font class="comment">        {</font>
00366 <font class="comment">                nlerror ("FT_Load_Glyph() failed: %s", getFT2Error(error));</font>
00367 <font class="comment">        }</font>
00368 <font class="comment"></font>
00369 <font class="comment">        // convert 24.6 fixed point into integer</font>
00370 <font class="comment">        width = _Face-&gt;glyph-&gt;metrics.width &gt;&gt; 6;</font>
00371 <font class="comment">        height = _Face-&gt;glyph-&gt;metrics.height &gt;&gt; 6;</font>
00372 <font class="comment">        */</font>
00373 }
00374 
00375 HFONT hFont = NULL;
00376 uint32 CurrentFontSize = 0;
00377 
00378 uint8 *CFontGenerator::getBitmap (<a class="code" href="types__nl_8h.html#a15">ucchar</a> c, uint32 size, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a>, uint32 &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a>, uint32 &amp;pitch, sint32 &amp;left, sint32 &amp;top, sint32 &amp;advx, uint32 &amp;glyphIndex)
00379 {
00380 <font class="comment">/*      FT_Error error;</font>
00381 <font class="comment"></font>
00382 <font class="comment">        error = FT_Set_Pixel_Sizes (_Face, size, size);</font>
00383 <font class="comment">        if (error)</font>
00384 <font class="comment">        {</font>
00385 <font class="comment">                nlerror ("FT_Set_Pixel_Sizes() failed: %s", getFT2Error(error));</font>
00386 <font class="comment">        }</font>
00387 <font class="comment"></font>
00388 <font class="comment">        // retrieve glyph index from character code</font>
00389 <font class="comment">        FT_UInt glyph_index = FT_Get_Char_Index (_Face, c);</font>
00390 <font class="comment"></font>
00391 <font class="comment">        // load glyph image into the slot (erase previous one)</font>
00392 <font class="comment">        error = FT_Load_Glyph (_Face, glyph_index, FT_LOAD_DEFAULT);</font>
00393 <font class="comment">        if (error)</font>
00394 <font class="comment">        {</font>
00395 <font class="comment">                nlerror ("FT_Load_Glyph() failed: %s", getFT2Error(error));</font>
00396 <font class="comment">        }</font>
00397 <font class="comment"></font>
00398 <font class="comment">        if (size == 0)</font>
00399 <font class="comment">        {</font>
00400 <font class="comment">                width = 0;</font>
00401 <font class="comment">                height = 0;</font>
00402 <font class="comment">                pitch = 0;</font>
00403 <font class="comment">                left = 0;</font>
00404 <font class="comment">                top = 0;</font>
00405 <font class="comment">                advx = 0;</font>
00406 <font class="comment">                glyphIndex = glyph_index;</font>
00407 <font class="comment">                return NULL;</font>
00408 <font class="comment">        }</font>
00409 <font class="comment"></font>
00410 <font class="comment">        // convert to an anti-aliased bitmap</font>
00411 <font class="comment">        error = FT_Render_Glyph (_Face-&gt;glyph, ft_render_mode_normal);</font>
00412 <font class="comment">        if (error)</font>
00413 <font class="comment">        {</font>
00414 <font class="comment">                nlerror ("FT_Render_Glyph() failed: %s", getFT2Error(error));</font>
00415 <font class="comment">        }</font>
00416 <font class="comment"></font>
00417 <font class="comment">        width = _Face-&gt;glyph-&gt;bitmap.width;</font>
00418 <font class="comment">        height = _Face-&gt;glyph-&gt;bitmap.rows;</font>
00419 <font class="comment">        pitch = _Face-&gt;glyph-&gt;bitmap.pitch;</font>
00420 <font class="comment"></font>
00421 <font class="comment">        left = _Face-&gt;glyph-&gt;bitmap_left;</font>
00422 <font class="comment">        top = _Face-&gt;glyph-&gt;bitmap_top;</font>
00423 <font class="comment"></font>
00424 <font class="comment">        advx = _Face-&gt;glyph-&gt;advance.x &gt;&gt; 6;</font>
00425 <font class="comment"></font>
00426 <font class="comment">        glyphIndex = glyph_index;</font>
00427 <font class="comment"></font>
00428 <font class="comment">        return (uint8 *) _Face-&gt;glyph-&gt;bitmap.buffer;</font>
00429 <font class="comment">*/</font>
00430 
00431         <font class="keywordflow">if</font> (size == 0)
00432         {
00433                 <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = 0;
00434                 <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = 0;
00435                 pitch = 0;
00436                 left = 0;
00437                 top = 0;
00438                 advx = 0;
00439                 glyphIndex = 0;
00440                 <font class="keywordflow">return</font> NULL;
00441         }
00442 
00443         <font class="comment">// Create the font</font>
00444         <font class="keywordflow">if</font> (hFont ==  NULL || CurrentFontSize != size)
00445         {
00446                 <font class="keywordflow">if</font> (hFont !=  NULL)
00447                 {
00448                         DeleteObject (hFont);
00449                 }
00450 
00451                 hFont=CreateFont
00452                 (
00453                         size,                                   <font class="comment">// logical height of font</font>
00454                         0,                                      <font class="comment">// logical average character width</font>
00455                         0,                                      <font class="comment">// angle of escapement</font>
00456                         0,                                      <font class="comment">// base-line orientation angle</font>
00457                         FW_DONTCARE, <font class="comment">//FW_NORMAL,                       // font weight</font>
00458                         FALSE,                          <font class="comment">// italic attribute flag</font>
00459                         FALSE,                          <font class="comment">// underline attribute flag</font>
00460                         FALSE,                          <font class="comment">// strikeout attribute flag</font>
00461                         DEFAULT_CHARSET,        <font class="comment">// character set identifier</font>
00462                         OUT_DEVICE_PRECIS,  <font class="comment">// output precision</font>
00463                         CLIP_DEFAULT_PRECIS,    <font class="comment">// clipping precision</font>
00464                         DEFAULT_QUALITY,        <font class="comment">// output quality</font>
00465                         DEFAULT_PITCH|FF_DONTCARE,  <font class="comment">// pitch and family</font>
00466                         <font class="stringliteral">"Arial Unicode MS Normal"</font>         <font class="comment">// pointer to typeface name string</font>
00467                 );
00468                 <a class="code" href="debug_8h.html#a6">nlassert</a> (hFont);
00469 
00470                 CurrentFontSize = size;
00471         }
00472 
00473         SelectObject (hdcDib, hFont);
00474         SelectObject (hdcDib, Dib);
00475         
00476         <font class="keyword">const</font> <font class="keywordtype">char</font> cc = (char) c;
00477 
00478         RECT rect;
00479         rect.bottom = Height;
00480         rect.top = 0;
00481         rect.left = 0;
00482         rect.right = Width;
00483 
00484         <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a> = DrawText (hdcDib, &amp;cc, 1, &amp;rect, DT_LEFT | DT_TOP);
00485 
00486         POINT point;
00487         point.y = <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
00488 
00489         <font class="keywordtype">int</font> <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a400">res</a>;
00490         BOOL rey = GetCharWidth32 (hdcDib, (uint8) cc,  (uint8) cc, &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>);
00491         <a class="code" href="debug_8h.html#a6">nlassert</a> (rey);
00492         point.x = <a class="code" href="driver__opengl__extension__def_8h.html#a367">w</a>;
00493 
00494 <font class="comment">//      ABC abc;</font>
00495 <font class="comment">//      BOOL rey = GetCharABCWidths (hdcDib, (uint8) cc, (uint8) cc, &amp;abc);</font>
00496 <font class="comment">//      nlassert (rey);</font>
00497 <font class="comment">//      point.x = abc.abcA;</font>
00498 
00499         SIZE <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>;
00500         GetTextExtentPoint32 (hdcDib, &amp;cc, 1, &amp;<a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>);
00501         
00502         BOOL ret = LPtoDP (hdcDib, &amp;point, 1);
00503         <a class="code" href="debug_8h.html#a6">nlassert</a> (ret);
00504 
00505         <font class="keyword">static</font> uint8 buf[100*100];
00506 
00507         sint32 _top = 0, _left = point.x;
00508         sint32 right = 0, bottom = point.y;
00509         <font class="keywordtype">bool</font> emptyLine;
00510         <font class="keywordflow">for</font> (sint <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> = 0; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a> &lt; point.y; <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>++)
00511         {
00512                 emptyLine = <font class="keyword">true</font>;
00513                 <font class="keywordflow">for</font> (sint <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> = 0; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &lt; point.x; <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>++)
00514                 {
00515                         buf[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*100+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>] = (uint8) Buffer[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*100+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>];
00516                         <font class="keywordflow">if</font> (buf[<a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>*100+<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>])
00517                         {
00518                                 emptyLine = <font class="keyword">false</font>;
00519                                 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &lt; _left)
00520                                         _left = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00521                                 <font class="keywordflow">if</font> (<a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a> &gt; right)
00522                                         right = <a class="code" href="driver__opengl__extension__def_8h.html#a364">x</a>;
00523                         }
00524 
00525 <font class="comment">//                      printf (buf[y*100+x]?"*":".");</font>
00526                 }
00527                 <font class="keywordflow">if</font> (!emptyLine)
00528                 {
00529                         <font class="keywordflow">if</font> (_top == 0)
00530                                 _top = <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
00531 
00532                         bottom = <a class="code" href="driver__opengl__extension__def_8h.html#a365">y</a>;
00533                 }
00534 
00535 <font class="comment">//              printf ("\n");</font>
00536         }
00537         <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = right - _left + 1;
00538         <font class="keywordflow">if</font> (right - _left + 1 &lt; 0) <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = 0;
00539         <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = bottom - _top + 1;
00540         <font class="keywordflow">if</font> (bottom - _top + 1 &lt; 0) <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = 0;
00541         pitch = 100;
00542         advx = point.x;
00543         
00544         WORD ag = 0;
00545         <font class="comment">/*uint t = GetGlyphIndices (hdcDib, &amp;cc, 1, &amp;ag, 0);</font>
00546 <font class="comment">        if (t == GDI_ERROR)</font>
00547 <font class="comment">        {</font>
00548 <font class="comment">                nlstop;</font>
00549 <font class="comment">        }</font>
00550 <font class="comment">*/</font>
00551         glyphIndex = ag;
00552 
00553         top = -_top;
00554         left = -_left;
00555 
00556 <font class="comment">/*      {</font>
00557 <font class="comment">                for (sint y = _top; y &lt; _top + height; y++)</font>
00558 <font class="comment">                {</font>
00559 <font class="comment">                        for (sint x = _left; x &lt; _left + width; x++)</font>
00560 <font class="comment">                        {</font>
00561 <font class="comment">                                printf (buf[y*100+x]?"*":".");</font>
00562 <font class="comment">                        }</font>
00563 <font class="comment">                        printf ("\n");</font>
00564 <font class="comment">                }</font>
00565 <font class="comment">                printf ("w: %d h: %d s: %d a: %d l: %d t: %d", width, height, size, advx, left, top);</font>
00566 <font class="comment">                getchar();</font>
00567 <font class="comment">        }</font>
00568 <font class="comment">*/</font>
00569         _top = _left = top = left = 0;
00570         top = <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.cy;
00571         <a class="code" href="driver__opengl__extension__def_8h.html#a389">width</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.cx;
00572         <a class="code" href="driver__opengl__extension__def_8h.html#a390">height</a> = <a class="code" href="driver__opengl__extension__def_8h.html#a383">s</a>.cy;
00573 
00574         <font class="keywordflow">return</font> buf + _top * 100 + _left;
00575 }
00576 
00577 
00578 
00579 
00580 <font class="keywordtype">void</font> CFontGenerator::getKerning (<a class="code" href="types__nl_8h.html#a15">ucchar</a> left, <a class="code" href="types__nl_8h.html#a15">ucchar</a> right, sint32 &amp;kernx)
00581 {
00582 <font class="comment">/*      if (!FT_HAS_KERNING(_Face))</font>
00583 <font class="comment">        {</font>
00584 <font class="comment">                kernx = 0;</font>
00585 <font class="comment">        }</font>
00586 <font class="comment">        else</font>
00587 <font class="comment">        {</font>
00588 <font class="comment">                FT_Vector  kerning;</font>
00589 <font class="comment">                FT_Error error = FT_Get_Kerning (_Face, left, right, ft_kerning_default, &amp;kerning);</font>
00590 <font class="comment">                if (error)</font>
00591 <font class="comment">                {</font>
00592 <font class="comment">                        nlerror ("FT_Get_Kerning() failed: %s", getFT2Error(error));</font>
00593 <font class="comment">                }</font>
00594 <font class="comment">                kernx = kerning.x;</font>
00595 <font class="comment">        }*/</font>
00596 }
00597 
00598 
00599 
00600 uint32   CFontGenerator::getCharIndex (<a class="code" href="types__nl_8h.html#a15">ucchar</a> c)
00601 {
00602 <font class="comment">//      return FT_Get_Char_Index (_Face, c);</font>
00603         <font class="keywordflow">return</font> 0;
00604 }
00605 
00606 
00607 } <font class="comment">// NL3D</font>
00608 
00609 <font class="preprocessor">#endif // NL_DONT_USE_EXTERNAL_CODE</font>
00610 <font class="preprocessor"></font>
</pre></div>

<!-- footer -->
<BR><FONT Size=+5>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </FONT>
</TD>
<TD WIDTH=15><IMG  SRC=/inc/img/pixel.gif WIDTH=15 HEIGHT=15 BORDER=0 ALT=""></TD>
</TR>
</TABLE>
</BODY>
</HTML>