... |
... |
@@ -15,6 +15,7 @@ |
15
|
15
|
|
16
|
16
|
#include <ft2build.h>
|
17
|
17
|
#include <freetype/freetype.h>
|
|
18
|
+#include <freetype/ftoutln.h>
|
18
|
19
|
#include <freetype/ftbitmap.h>
|
19
|
20
|
|
20
|
21
|
|
... |
... |
@@ -84,6 +85,58 @@ |
84
|
85
|
}
|
85
|
86
|
|
86
|
87
|
|
|
88
|
+ static void
|
|
89
|
+ Examine( FT_GlyphSlot slot )
|
|
90
|
+ {
|
|
91
|
+ unsigned long format = slot->format;
|
|
92
|
+ FT_Outline* outline = &slot->outline;
|
|
93
|
+ short c, p, first, last;
|
|
94
|
+ FT_Vector u, v;
|
|
95
|
+ FT_Pos taxi;
|
|
96
|
+ FT_BBox cbox;
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+ if ( format != FT_GLYPH_FORMAT_OUTLINE )
|
|
100
|
+ {
|
|
101
|
+ putchar( ' ' );
|
|
102
|
+ putchar( ( format >> 24 ) & 0xFF );
|
|
103
|
+ putchar( ( format >> 16 ) & 0xFF );
|
|
104
|
+ putchar( ( format >> 8 ) & 0xFF );
|
|
105
|
+ putchar( ( format ) & 0xFF );
|
|
106
|
+ putchar( ' ' );
|
|
107
|
+ return;
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+ taxi = 0;
|
|
111
|
+ last = -1;
|
|
112
|
+ for ( c = 0; c < outline->n_contours; c++ )
|
|
113
|
+ {
|
|
114
|
+ first = last + 1;
|
|
115
|
+ last = outline->contours[c];
|
|
116
|
+
|
|
117
|
+ u = outline->points[last];
|
|
118
|
+ for ( p = first; p <= last; p++ )
|
|
119
|
+ {
|
|
120
|
+ v = outline->points[p];
|
|
121
|
+
|
|
122
|
+ taxi += v.x > u.x ? v.x - u.x : u.x - v.x;
|
|
123
|
+ taxi += v.y > u.y ? v.y - u.y : u.y - v.y;
|
|
124
|
+
|
|
125
|
+ u = v;
|
|
126
|
+ }
|
|
127
|
+ }
|
|
128
|
+
|
|
129
|
+ if ( taxi )
|
|
130
|
+ {
|
|
131
|
+ FT_Outline_Get_CBox( outline, &cbox );
|
|
132
|
+ printf( "%5.2f ", 0.5 * taxi /
|
|
133
|
+ ( cbox.xMax - cbox.xMin + cbox.yMax - cbox.yMin ) );
|
|
134
|
+ }
|
|
135
|
+ else
|
|
136
|
+ printf( " void " );
|
|
137
|
+ }
|
|
138
|
+
|
|
139
|
+
|
87
|
140
|
/* Analyze X- and Y-acutance; bitmap should have positive pitch */
|
88
|
141
|
static void
|
89
|
142
|
Analyze( FT_Bitmap* bitmap )
|
... |
... |
@@ -281,9 +334,9 @@ |
281
|
334
|
|
282
|
335
|
if ( !quiet )
|
283
|
336
|
{
|
284
|
|
- /* "NNNNN AAAxBBBB X.XXXX Y.YYYY MMDD55MMDD55MMDD55MMDD55MMDD55MM" */
|
285
|
|
- printf( "\n GID imgsize Xacut Yacut MD5 hashsum" );
|
286
|
|
- printf( "\n-------------------------------------------------------------\n" );
|
|
337
|
+ /* "NNNNN SS.SS WWWxHHHH X.XXXX Y.YYYY MMDD55MMDD55MMDD55MMDD55MMDD55MM" */
|
|
338
|
+ printf( "\n GID shape imgsize Xacut Yacut MD5 hashsum" );
|
|
339
|
+ printf( "\n-------------------------------------------------------------------\n" );
|
287
|
340
|
}
|
288
|
341
|
|
289
|
342
|
Fail = 0;
|
... |
... |
@@ -309,6 +362,8 @@ |
309
|
362
|
|
310
|
363
|
printf( "%5u ", id );
|
311
|
364
|
|
|
365
|
+ Examine( face->glyph );
|
|
366
|
+
|
312
|
367
|
error = FT_Render_Glyph( face->glyph, render_mode );
|
313
|
368
|
if ( error && error != FT_Err_Cannot_Render_Glyph )
|
314
|
369
|
{
|