Commit 23a0670b9891535765ebd2e7ac51fb02e1e2b9a8

David Turner 2000-11-08T00:20:25

removed the file <freetype/internal/ftlist.h> and corrected files that depended on it. the ftlist.c function definitions are now FT_EXPORT_DEF instead of FT_BASE_DEF

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
diff --git a/docs/design/design-5.html b/docs/design/design-5.html
index b85badd..42736c5 100644
--- a/docs/design/design-5.html
+++ b/docs/design/design-5.html
@@ -17,7 +17,7 @@
 </h1>
 
 <center>
-<table width="75%">
+<table width="600">
 <tr><td>
 
   <table width="100%">
diff --git a/docs/ft2faq.html b/docs/ft2faq.html
index 19b3f5a..c8a9f85 100644
--- a/docs/ft2faq.html
+++ b/docs/ft2faq.html
@@ -103,6 +103,22 @@
       <a href="#other">Other questions</a>
       <ul><p>
         <li>
+          <a href="#other-color">How can I set the color of text rendered
+          by FreeType ?</a>
+        </li>
+        <li>
+          <a href="#other-depth">Can I use FreeType to draw text on a pixmap
+          with arbitrary depth ?</a>
+        </li>
+        <li>
+          <a href="#other-size">I set the pixel size to 8x8, but the resulting
+          glyphs are larger than that. Why ?</a>
+        </li>
+        <li>
+          <a href="#other-bbox">How can I compute the bounding box of a text
+          string without loading its glyphs ?</a>
+        </li>
+        <li>
           <a href="#other-antialias">Which anti-aliasing algorithm is
           used in the FreeType&nbsp;2 renderer?</a>
         </li>
@@ -141,6 +157,7 @@
     to broadly communicate about it until we've got a satisfying
     implementation to show.</p>
 
+    <hr>
     <a name="general-long">
     <h3>
       I.2 Why did it take so long to release FreeType&nbsp;2?
@@ -174,6 +191,7 @@
     software library available on the market that supports the new Adobe
     "CEF" font format.</p>
 
+    <hr>
     <a name="general-unix">
     <h3>
       I.3 Is FreeType&nbsp;2 a Unix-only project?
@@ -190,6 +208,7 @@
     code is highly generic and modular to adapt even the most strict
     environments like low-memory embedded systems.</p>
 
+    <hr>
     <a name="general-x11">
     <h3>
       I.4 When will X11/XFree support anti-aliased text?
@@ -222,13 +241,14 @@
     basically impossible to draw anti-aliased glyphs without performing
     <em>huge</em> hacks within the server.</p>
 
-    <p>Note that Keith Packard, from XFree fame, has recently started
+    <p>Note that Keith Packard, from XFree86 fame, has recently started
     working on a new rendering model for X11 in order to support new
     features (mainly transparency and anti-aliased fonts).  This will be
     provided through protocol extensions.  The question of knowing whether
     legacy X applications will be able to display anti-aliased text is still
     very uncertain.</p>
 
+    <hr>
     <a name="general-ft1">
     <h3>
       I.5 Is FreeType&nbsp;2 backwards compatible with FreeType&nbsp;1.x?
@@ -244,6 +264,7 @@
     while being much more powerful.  We thus encourage you to adapt your
     source code to it as this should not involve much work.</p>
 
+    <hr>
     <a name="general-edit">
     <h3>
       I.6 Can I use FreeType&nbsp;2 to edit fonts or create new ones?
@@ -361,6 +382,7 @@
       except that you need to set the include paths, source code paths, etc.
       in dialog boxes before running the compilation.</p>
 
+    <hr>
     <a name="builds-config">
     <h3>
       II.2 How do I configure my build of the library?
@@ -392,6 +414,7 @@
     directory (e.g. the Unix-specific <tt>ftsystem.c</tt> that uses
     memory-mapped file for i/o).</p>
 
+    <hr>
     <a name="builds-modules">
     <h3>
       II.3 How do I select the modules I need in my build?
@@ -435,6 +458,7 @@
     <p>This example only emphasizes the flexibility that is left to
     developers when building the library.</p>
 
+    <hr>
     <a name="builds-flat">
     <h3>
       II.4 How do I compile all FreeType&nbsp;2 files in a single
@@ -482,6 +506,7 @@
     <p>Other than that, you still have the same freedom than with the good
     old FreeType license.  Enjoy!</p>
 
+    <hr>
     <a name="autohint-work">
     <h3>
       III.2 How does the auto-hinter work?
@@ -509,6 +534,7 @@
     constraint system.  That could be used to support native hints in
     Type&nbsp;1/Type&nbsp;2 fonts, for example.</p>
 
+    <hr>
     <a name="autohint-cjk">
     <h3>
       III.3 Why does the auto-hinter doesn't work correctly with CJK
@@ -539,6 +565,111 @@
   </td></tr>
   <tr><td>
 
+    <a name="other-depth">
+    <h3>
+      IV.1 Can I use FreeType to draw text on a pixmap with arbitratry depth ?
+    </h3>
+
+    <p>No directly, as FreeType is a font library, not a general purpose
+    graphics library or text rendering service. However, note that the
+    anti-aliased renderer allows you to convert a vectorial glyph outline
+    into a list of "spans" (i.e. horizontal pixel segments with same coverage)
+    that can be rendered through user-provided callbacks.</p>
+
+     <p>By providing the appropriate span callback, you can render anti-aliased
+     text to any kind of surface. You can also use any color or fill
+     pattern/image if you want to. This process is called
+     <em>direct rendering</em>. For more information, please read the
+     documentation contained in the following files:</p>
+     
+     <ul>
+       <li><p>
+       <b><tt>&lt;freetype/ftimage.h&gt;</tt></b> contains the definition
+       of the <tt>FT_Raster_Params</tt> type used with direct rendering.
+       </p></li>
+          
+       <li><p>
+       <b><tt>&lt;freetype/ftoutln.h&gt;</tt></b> contains the definition
+       of the <tt>FT_Outline_Render</tt> function that can be used to
+       convert vectorial outlines to span lists.
+       </p></li>
+     </ul>
+
+     <p>Here's some code that uses them:</p>
+     <font color="blue"><pre>
+     
+       FT_Raster_Params  params;
+       FT_Outline        outline;
+       
+       .. load vectorial glyph in "outline"
+       
+       params.flags      = ft_raster_flag_aa | ft_raster_flag_direct;
+       params.gray_spans = (FT_Raster_Span_Func)your_own_span_function_here;
+       params.user       = your_own_data_pointer;
+       
+       error = FT_Outline_Render( library, &amp;outline, &amp;params );
+     </pre></font>
+     
+     <p>Note that direct rendering is <em>not</em> available with monochrome
+     output, as the current renderer uses a two-pass algorithm to generate
+     glyphs with correct drop-out control.</p>
+
+    <hr>
+    <a name="other-color">
+    <h3>
+      IV.2 How can I set the color of text rendered by FreeType ?
+    </h3>
+    
+    <p>Basically, you can't do that, because FreeType is simply a font
+    library. In general, you'll need to use your favorite graphics library
+    to draw the FreeType glyphs with the appropriate color.</p>
+
+    <p>Note that for anti-aliased glyphs, you can "set the color" by using
+    <em>direct rendering</em> as described in <a href="#other-depth">this
+    answer</a></p>
+
+
+    <hr>
+    <a name="other-size">
+    <h3>
+      IV.3 I set the pixel size to 8x8, but the resulting glyphs are larger
+           (or smaller) than that. Why ??
+    </h3>
+
+    <p>A lot of people have a hard time understanding this topic, because
+    they think of glyphs as fixed-width/height "cells", like those of
+    fonts used in terminals/consoles. This assumption is simply not valid
+    with most "modern" font formats, even bitmapped-based ones like
+    PCF or BDF.</p>
+
+    <p>Be aware that the <em>character size</em> that is set either through
+    <tt>FT_Set_Char_Size</tt> or <tt>FT_Set_Pixel_Sizes</tt> isn't directly
+    related to the dimension of the glyph bitmaps generated.</p>
+    
+    <p>Rather, the character size is indeed the size of
+    <em>an abstract square</em>, called the <em>EM</em>, used by typographers
+    to design fonts. Scaling two distinct fonts to the same character size, be
+    it expressed in points or pixels, will generally result in bitmaps with
+    <em>distinct dimensions</em> !</p>
+
+    <p>Note that historically, the EM corresponded to the width of a capital
+    "M" in Latin typefaces. However, later improvements in typography led to
+    the designs that greatly detract from this rule. Today, it is not possible
+    to connect the EM size to a specific font "feature" in a reliable way.</p>
+
+    <hr>
+
+    <a name="other-bbox">
+    <h3>
+    IV.4 How can I compute the bounding box of a given string of text without
+         loading its glyphs before ?
+    </h3>
+    
+    <p>A lot of people want to be able to compute the size in pixels of a simple
+    string of text with minimal overhead. For example, that can be useful to
+    draw centered text within a button.</p>
+    
+    
     <a name="other-antialias">
     <h3>
       IV.1 Which anti-aliasing algorithm is used by FreeType&nbsp;2?</h3>
@@ -565,6 +696,7 @@
     <p>We will try to document its design in a later document, though this
     is not a priority for now.</p>
 
+    <hr>
     <a name="other-opentype">
     <h3>
       IV.2 When will FreeType&nbsp;2 support OpenType?
diff --git a/include/freetype/internal/ftlist.h b/include/freetype/internal/ftlist.h
deleted file mode 100644
index 2ae03e4..0000000
--- a/include/freetype/internal/ftlist.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <freetype/ftlist.h>
-
diff --git a/src/base/ftlist.c b/src/base/ftlist.c
index 6cb384a..b2688b0 100644
--- a/src/base/ftlist.c
+++ b/src/base/ftlist.c
@@ -23,7 +23,7 @@
   /*************************************************************************/
 
 
-#include <freetype/internal/ftlist.h>
+#include <freetype/ftlist.h>
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftobjs.h>
 
@@ -40,8 +40,8 @@
 
   /* documentation is in ftlist.h */
 
-  FT_BASE_DEF( FT_ListNode )  FT_List_Find( FT_List  list,
-                                            void*    data )
+  FT_EXPORT_DEF( FT_ListNode )  FT_List_Find( FT_List  list,
+                                              void*    data )
   {
     FT_ListNode  cur;
 
@@ -61,8 +61,8 @@
 
   /* documentation is in ftlist.h */
 
-  FT_BASE_DEF( void )  FT_List_Add( FT_List      list,
-                                    FT_ListNode  node )
+  FT_EXPORT_DEF( void )  FT_List_Add( FT_List      list,
+                                      FT_ListNode  node )
   {
     FT_ListNode  before = list->tail;
 
@@ -81,8 +81,8 @@
 
   /* documentation is in ftlist.h */
 
-  FT_BASE_DEF( void )  FT_List_Insert( FT_List      list,
-                                       FT_ListNode  node )
+  FT_EXPORT_DEF( void )  FT_List_Insert( FT_List      list,
+                                         FT_ListNode  node )
   {
     FT_ListNode  after = list->head;
 
@@ -101,8 +101,8 @@
 
   /* documentation is in ftlist.h */
 
-  FT_BASE_DEF( void )  FT_List_Remove( FT_List      list,
-                                       FT_ListNode  node )
+  FT_EXPORT_DEF( void )  FT_List_Remove( FT_List      list,
+                                         FT_ListNode  node )
   {
     FT_ListNode  before, after;
 
@@ -124,8 +124,8 @@
 
   /* documentation is in ftlist.h */
 
-  FT_BASE_DEF( void )  FT_List_Up( FT_List      list,
-                                   FT_ListNode  node )
+  FT_EXPORT_DEF( void )  FT_List_Up( FT_List      list,
+                                     FT_ListNode  node )
   {
     FT_ListNode  before, after;
 
@@ -153,9 +153,9 @@
 
   /* documentation is in ftlist.h */
 
-  FT_BASE_DEF( FT_Error )  FT_List_Iterate( FT_List            list,
-                                            FT_List_Iterator   iterator,
-                                            void*              user )
+  FT_EXPORT_DEF( FT_Error )  FT_List_Iterate( FT_List            list,
+                                              FT_List_Iterator   iterator,
+                                              void*              user )
   {
     FT_ListNode  cur   = list->head;
     FT_Error     error = FT_Err_Ok;
@@ -179,10 +179,10 @@
 
   /* documentation is in ftlist.h */
 
-  FT_BASE_DEF( void )  FT_List_Finalize( FT_List             list,
-                                         FT_List_Destructor  destroy,
-                                         FT_Memory           memory,
-                                         void*               user )
+  FT_EXPORT_DEF( void )  FT_List_Finalize( FT_List             list,
+                                           FT_List_Destructor  destroy,
+                                           FT_Memory           memory,
+                                           void*               user )
   {
     FT_ListNode  cur;
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 7bc48eb..c3cc8d4 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -16,8 +16,8 @@
 /***************************************************************************/
 
 
+#include <freetype/ftlist.h>
 #include <freetype/internal/ftobjs.h>
-#include <freetype/internal/ftlist.h>
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftstream.h>
 
diff --git a/src/cache/ftcchunk.c b/src/cache/ftcchunk.c
index a8dec04..adea14c 100644
--- a/src/cache/ftcchunk.c
+++ b/src/cache/ftcchunk.c
@@ -17,9 +17,9 @@
 
 
 #include <freetype/cache/ftcchunk.h>
+#include <freetype/ftlist.h>
 #include <freetype/fterrors.h>
 #include <freetype/internal/ftobjs.h>
-#include <freetype/internal/ftlist.h>
 #include <freetype/fterrors.h>
 
 
diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c
index bbe2b62..2a8b06b 100644
--- a/src/cache/ftcglyph.c
+++ b/src/cache/ftcglyph.c
@@ -18,8 +18,8 @@
 
 #include <freetype/cache/ftcglyph.h>
 #include <freetype/fterrors.h>
+#include <freetype/ftlist.h>
 #include <freetype/internal/ftobjs.h>
-#include <freetype/internal/ftlist.h>
 #include <freetype/internal/ftdebug.h>
 
 
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index 7a41db6..b2480d8 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -17,8 +17,8 @@
 
 
 #include <freetype/cache/ftlru.h>
+#include <freetype/ftlist.h>
 #include <freetype/internal/ftobjs.h>
-#include <freetype/internal/ftlist.h>
 
 
   static