Commit b79b5133803371d7db88135cdafd2af8da2b2d78

Werner Lemberg 2005-12-20T12:01:58

Formatting, improving comments.

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
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
diff --git a/ChangeLog b/ChangeLog
index 7547942..6bdc065 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -18,33 +18,65 @@
 
 2005-12-13  David Turner  <david@freetype.org>
 
-	* src/autofit/aflatin.c, src/autofit/afhints.c: changed the
-        implementation of the LIGHT hinting mode to completely disable
-        horizontal hinting. This is an experimental effort to integrate
-        David Chester's latest patch without fucking the other hinting
-        modes as well.
+	Change the implementation of the LIGHT hinting mode to completely
+	disable horizontal hinting.  This is an experimental effort to
+	integrate David Chester's latest patch without affecting the other
+	hinting modes as well.
 
-        Note that this doesn't force auto-hinting for all fonts however.
+	Note that this doesn't force auto-hinting for all fonts, however.
 
-        * Jamfile: small fix to ensure that ftexport.sym is placed in the
-        same location than other generated objects (i.e. within the 'objs'
-        directory of the current dir)
+	* src/autofit/afhints.c (af_glyph_hints_reload): Don't set
+	scaler_fiags here but...
+	(af_glyph_hints_rescale): Here.
 
-        * include/freetype/config/ftoption.h,
-        include/freetype/config/ftstdlib.h,
-        include/freetype/internal/tttypes.h,
-        src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c,
-        src/sfnt/ttbdf.h, src/sfnt/ttbdf.c, src/sfnt/sfobjs.c:
+	* src/autofit/aflatin.c (af_latin_hints_init): Disable horizontal
+	hinting for `light' hinting mode.
 
-        Added support for an embedded 'BDF ' table within SFNT-based
-        bitmap font files. This is used to store atoms & properties from
-        the original BDF fonts that were used to generate the font file.
 
-        the feature is controled by TT_CONFIG_OPTION_BDF within 'ftoption.h'
-        and is used to implement FT_Get_BDF_Property for these font files.
+	* Jamfile: Small fix to ensure that ftexport.sym is placed into the
+	same location as other generated objects (i.e., within the `objs'
+	directory of the current directory).
 
-        At the moment, this is still experimental, the BDF table format isn't
-        cast into stone yet.
+
+	Add support for an embedded `BDF ' table within SFNT-based bitmap
+	font files.  This is used to store atoms & properties from the
+	original BDF fonts that were used to generate the font file.
+
+	The feature is controlled by TT_CONFIG_OPTION_BDF within
+	`ftoption.h' and is used to implement FT_Get_BDF_Property for these
+	font files.
+
+	At the moment, this is still experimental, the BDF table format
+	isn't cast into stone yet.
+
+	* include/freetype/config/ftoption.h (TT_CONFIG_OPTION_BDF): New
+	macro.
+
+	* include/freetype/config/ftstdlib.h (ft_memchr): New macro.
+
+	* include/freetype/internal/tttypes.h (TT_BDFRec, TT_BDF)
+	[TT_CONFIG_OPTION_BDF]: New structure.
+	(TT_FaceRec) [TT_CONFIG_OPTION_BDF]: New member `bdf'.
+
+	* include/freetype/ttags.h (TTAG_BDF): New macro.
+
+	* src/sfnt/Jamfile (_sources): Add ttbdf.
+
+	* src/sfnt/rules.mk (SFNT_DRV_SRC): Add ttbdf.c.
+
+	* src/sfnt/sfdriver.c [TT_CONFIG_OPTION_BDF]: Include ttbdf.h and
+	FT_SERVICE_BDF_H.
+	(sfnt_get_charset_it) [TT_CONFIG_OPTION_BDF]: New function.
+	(sfnt_service_bdf) [TT_CONFIG_OPTION_BDF]: New service.
+	(sfnt_servives) [TT_CONFIG_OPTION_BDF]: Add sfnt_service_bdf.
+
+	* src/sfnt/sfnt.c [TT_CONFIG_OPTION_BDF]: Include ttbdf.c.
+
+	* src/sfnt/sfobjs.c [TT_CONFIG_OPTION_BDF]: Include ttbdf.h.
+	(sfnt_done_face) [TT_CONFIG_OPTION_BDF]: Call
+	tt_face_free_bdf_props.
+
+	* src/sfnt/ttbdf.h, src/sfnt/ttbdf.c: New files.
 
 2005-12-07  Werner Lemberg  <wl@gnu.org>
 
diff --git a/docs/CHANGES b/docs/CHANGES
index 37ed7eb..092387f 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -14,8 +14,8 @@ LATEST CHANGES BETWEEN 2.2.0 and 2.1.10
 
   II. IMPORTANT CHANGES
 
-    - Face metrics (face->size->metrics) and glyph metrics are no
-      longer rounded.  If you do not round in your applications too,
+    - Face  metrics  (face->size->metrics)  and glyph  metrics are  no
+      longer rounded.   If you do not round  in your applications too,
       you may find glyphs become blurry.
 
     - A  new API  `FT_TrueTypeGX_Validate'  (in FT_GX_VALIDATE_H)  has
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index fcd142e..74b6b66 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -493,11 +493,12 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
-  /* Define TT_CONFIG_OPTION_BDF if upi want to include support for        */
-  /* an embedded 'BDF' table within SFNT-based bitmap formats.             */
+  /* Define TT_CONFIG_OPTION_BDF if you want to include support for        */
+  /* an embedded `BDF ' table within SFNT-based bitmap formats.            */
   /*                                                                       */
 #define TT_CONFIG_OPTION_BDF
 
+
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h
index 2839e15..1e9eaf8 100644
--- a/include/freetype/config/ftstdlib.h
+++ b/include/freetype/config/ftstdlib.h
@@ -5,7 +5,7 @@
 /*    ANSI-specific library and header configuration file (specification   */
 /*    only).                                                               */
 /*                                                                         */
-/*  Copyright 2002, 2003, 2004 by                                          */
+/*  Copyright 2002, 2003, 2004, 2005 by                                    */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 368ab68..3d951c7 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -848,59 +848,63 @@ FT_BEGIN_HEADER
   /*************************************************************************/
   /***                                                                   ***/
   /***                                                                   ***/
-  /***       EMBEDDED BDF PROPERTIES TABLE SUPPORT                       ***/
+  /***              EMBEDDED BDF PROPERTIES TABLE SUPPORT                ***/
   /***                                                                   ***/
   /***                                                                   ***/
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
 
-/* these types are used to support a 'BDF' table that isn't part of the
- * official TrueType specification. It is mainly used in SFNT-based bitmap
- * fonts that were generated from a set of BDF fonts
- *
- * the format of the table is the following:
- *
- *   USHORT   version      'BDF' table version number, should be 0x0001
- *   USHORT   strikeCount  number of strikes (bitmap sizes) in this table
- *   ULONG    stringTable  offset (froms start of BDF table) to string table
- *
- * followed by an array of 'strikeCount' descriptors that look like:
- *
- *   USHORT   ppem         vertical pixels per EM for this strike
- *   USHORT   numItems     number of items for this strike (properties and
- *                         atoms), max is 255
- *
- * this array is followed by 'strikeCount' value sets. Each "value set"
- * is an array of 'numItems' items that look like the following:
- *
- *   ULONG    item_name     offset in string table to item name
- *   USHORT   item_type     0 => string (e.g. COMMENT)
- *                          1 => atom   (e.g. FONT or even SIZE)
- *                          2 => int32
- *                          3 => uint32
- *                       0x10 => flag for properties, ored with above values
- *
- *   ULONG    item_value    for strings => offset in string table without
- *                                         the corresponding double quotes
- *
- *                              atoms   => offset in string table
- *
- *                              integers => direct value
- *
- * all strings in the string table are 8-bit, zero-terminated
- */
+  /*
+   * These types are used to support a `BDF ' table that isn't part of the
+   * official TrueType specification.  It is mainly used in SFNT-based
+   * bitmap fonts that were generated from a set of BDF fonts.
+   *
+   * The format of the table is as follows.
+   *
+   *   USHORT   version      `BDF ' table version number, should be 0x0001.
+   *   USHORT   strikeCount  Number of strikes (bitmap sizes) in this table.
+   *   ULONG    stringTable  Offset (froms start of BDF table) to string
+   *                         table.
+   *
+   * This is followed by an array of `strikeCount' descriptors, having the
+   * following format.
+   *
+   *   USHORT   ppem         Vertical pixels per EM for this strike.
+   *   USHORT   numItems     Number of items for this strike (properties and
+   *                         atoms).  Maximum is 255.
+   *
+   * This array in turn is followed by `strikeCount' value sets.  Each
+   * `value set' is an array of `numItems' items with the following format.
+   *
+   *   ULONG    item_name    Offset in string table to item name.
+   *   USHORT   item_type    The item type.  Possible values are
+   *                            0 => string (e.g., COMMENT)
+   *                            1 => atom   (e.g., FONT or even SIZE)
+   *                            2 => int32
+   *                            3 => uint32
+   *                         0x10 => A flag to indicate a properties.  This
+   *                                 is ORed with the above values.
+   *   ULONG    item_value   For strings  => Offset into string table without
+   *                                         the corresponding double quotes.
+   *                         For atoms    => Offset into string table.
+   *                         For integers => Direct value.
+   *
+   * All strings in the string table consist of bytes and are
+   * zero-terminated.
+   *
+   */
 
 #ifdef TT_CONFIG_OPTION_BDF
 
-  typedef struct TT_BDFRec_
+  typedef struct  TT_BDFRec_
   {
-    FT_Byte*       table;
-    FT_Byte*       table_end;
-    FT_Byte*       strings;
-    FT_UInt32      strings_size;
-    FT_UInt        num_strikes;
-    FT_Bool        loaded;
+    FT_Byte*   table;
+    FT_Byte*   table_end;
+    FT_Byte*   strings;
+    FT_UInt32  strings_size;
+    FT_UInt    num_strikes;
+    FT_Bool    loaded;
 
   } TT_BDFRec, *TT_BDF;
 
@@ -1405,7 +1409,7 @@ FT_BEGIN_HEADER
 #endif
 
 #ifdef TT_CONFIG_OPTION_BDF
-    TT_BDFRec        bdf;
+    TT_BDFRec             bdf;
 #endif /* TT_CONFIG_OPTION_BDF */
 
     /***********************************************************************/
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index 8b62557..0f17cc2 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1308,7 +1308,7 @@
     hints->y_scale = metrics->axis[AF_DIMENSION_VERT].scale;
     hints->y_delta = metrics->axis[AF_DIMENSION_VERT].delta;
 
-    /* compute flags depending on render mode, etc... */
+    /* compute flags depending on render mode, etc. */
     mode = metrics->root.scaler.render_mode;
 
     scaler_flags = hints->scaler_flags;
@@ -1337,7 +1337,8 @@
     if ( mode == FT_RENDER_MODE_MONO )
       other_flags |= AF_LATIN_HINTS_MONO;
 
-    /* in 'light' hinting mode, we disable horizontal hinting completely
+    /*
+     *  In `light' hinting mode we disable horizontal hinting completely.
      */
     if ( mode == FT_RENDER_MODE_LIGHT )
       scaler_flags |= AF_SCALER_FLAG_NO_HORIZONTAL;
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index c7fc713..feb767e 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -289,15 +289,15 @@
   };
 
 
- /*
-  *  TT CMAP INFO
-  *
-  */
+  /*
+   *  TT CMAP INFO
+   */
   static const FT_Service_TTCMapsRec  tt_service_get_cmap_info =
   {
     (TT_CMap_Info_GetFunc)tt_get_cmap_info
   };
 
+
 #ifdef TT_CONFIG_OPTION_BDF
 
   static FT_Error
@@ -305,15 +305,16 @@
                        const char*  *acharset_encoding,
                        const char*  *acharset_registry )
   {
-    BDF_PropertyRec   encoding, registry;
-    FT_Error          error;
-
-   /* XXX: I don't know if this is correct, since tt_face_find_bdf_prop
-    *      will only return something correct if we have previously
-    *      selected a size that is listed in the BDF table.
-    *      should we change the BDF table format to include single
-    *      offsets for "CHARSET_REGISTRY" and "CHARSET_ENCODING" ?
-    */
+    BDF_PropertyRec  encoding, registry;
+    FT_Error         error;
+
+
+    /* XXX: I don't know whether this is correct, since
+     *      tt_face_find_bdf_prop only returns something correct if we have
+     *      previously selected a size that is listed in the BDF table. 
+     *      Should we change the BDF table format to include single offsets
+     *      for `CHARSET_REGISTRY' and `CHARSET_ENCODING'?
+     */
     error = tt_face_find_bdf_prop( face, "CHARSET_REGISTRY", &registry );
     if ( !error )
     {
@@ -344,10 +345,9 @@
 #endif /* TT_CONFIG_OPTION_BDF */
 
 
- /*
-  *  SERVICE LIST
-  *
-  */
+  /*
+   *  SERVICE LIST
+   */
 
   static const FT_ServiceDescRec  sfnt_services[] =
   {
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index ba3194a..6ffc5a2 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -31,6 +31,7 @@
 #include "ttbdf.h"
 #endif
 
+
   /*************************************************************************/
   /*                                                                       */
   /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c
index 0e679c6..aa08b90 100644
--- a/src/sfnt/ttbdf.c
+++ b/src/sfnt/ttbdf.c
@@ -24,6 +24,7 @@
 
 #include "sferrors.h"
 
+
 #ifdef TT_CONFIG_OPTION_BDF
 
   /*************************************************************************/
@@ -35,168 +36,176 @@
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_ttbdf
 
-FT_LOCAL_DEF( void )
-tt_face_free_bdf_props( TT_Face  face )
-{
-  TT_BDF   bdf = &face->bdf;
 
-  if ( bdf->loaded )
+  FT_LOCAL_DEF( void )
+  tt_face_free_bdf_props( TT_Face  face )
   {
-    FT_Stream  stream = FT_FACE(face)->stream;
-
-    if ( bdf->table != NULL )
-      FT_FRAME_RELEASE( bdf->table );
+    TT_BDF  bdf = &face->bdf;
 
-    bdf->table_end    = NULL;
-    bdf->strings      = NULL;
-    bdf->strings_size = 0;
-  }
-}
 
+    if ( bdf->loaded )
+    {
+      FT_Stream  stream = FT_FACE(face)->stream;
 
-static FT_Error
-tt_face_load_bdf_props( TT_Face    face,
-                        FT_Stream  stream )
-{
-  TT_BDF    bdf = &face->bdf;
-  FT_ULong  length;
-  FT_Error  error;
 
-  FT_ZERO( bdf );
+      if ( bdf->table != NULL )
+        FT_FRAME_RELEASE( bdf->table );
 
-  error = tt_face_goto_table( face, TTAG_BDF, stream, &length );
-  if ( error                                  ||
-       length < 8                             ||
-       FT_FRAME_EXTRACT( length, bdf->table ) )
-  {
-    error = FT_Err_Invalid_Table;
-    goto Exit;
+      bdf->table_end    = NULL;
+      bdf->strings      = NULL;
+      bdf->strings_size = 0;
+    }
   }
 
-  bdf->table_end = bdf->table + length;
 
+  static FT_Error
+  tt_face_load_bdf_props( TT_Face    face,
+                          FT_Stream  stream )
   {
-    FT_Byte*  p           = bdf->table;
-    FT_UInt   version     = FT_NEXT_USHORT(p);
-    FT_UInt   num_strikes = FT_NEXT_USHORT(p);
-    FT_UInt32 strings     = FT_NEXT_ULONG(p);
-
-    if ( version != 0x0001           ||
-         strings < 8                 ||
-         (strings-8)/4 < num_strikes ||
-         strings+1 > length          )
+    TT_BDF    bdf = &face->bdf;
+    FT_ULong  length;
+    FT_Error  error;
+
+
+    FT_ZERO( bdf );
+
+    error = tt_face_goto_table( face, TTAG_BDF, stream, &length );
+    if ( error                                  ||
+         length < 8                             ||
+         FT_FRAME_EXTRACT( length, bdf->table ) )
     {
-    BadTable:
-      FT_FRAME_RELEASE( bdf->table );
-      FT_ZERO( bdf );
       error = FT_Err_Invalid_Table;
       goto Exit;
     }
 
-    bdf->num_strikes  = num_strikes;
-    bdf->strings      = bdf->table + strings;
-    bdf->strings_size = length - strings;
-  }
-
- /* check the strike descriptors
-  */
-  {
-    FT_UInt   count  = bdf->num_strikes;
-    FT_Byte*  p      = bdf->table + 8;
-    FT_Byte*  strike = p + count*4;
+    bdf->table_end = bdf->table + length;
 
-    for ( ; count > 0; count-- )
     {
-      FT_UInt  num_items = FT_PEEK_USHORT(p+2);
+      FT_Byte*   p           = bdf->table;
+      FT_UInt    version     = FT_NEXT_USHORT( p );
+      FT_UInt    num_strikes = FT_NEXT_USHORT( p );
+      FT_UInt32  strings     = FT_NEXT_ULONG ( p );
+
 
-     /* we don't need to check the value sets themselves, since this
-      * is done later
-      */
-      strike += 10*num_items;
+      if ( version != 0x0001                 ||
+           strings < 8                       ||
+           ( strings - 8 ) / 4 < num_strikes ||
+           strings + 1 > length              )
+      {
+      BadTable:
+        FT_FRAME_RELEASE( bdf->table );
+        FT_ZERO( bdf );
+        error = FT_Err_Invalid_Table;
+        goto Exit;
+      }
 
-      p += 4;
+      bdf->num_strikes  = num_strikes;
+      bdf->strings      = bdf->table + strings;
+      bdf->strings_size = length - strings;
     }
 
-    if ( strike > bdf->strings )
-      goto BadTable;
-  }
+    /* check the strike descriptors */
+    {
+      FT_UInt   count  = bdf->num_strikes;
+      FT_Byte*  p      = bdf->table + 8;
+      FT_Byte*  strike = p + count * 4;
 
-  bdf->loaded = 1;
 
-Exit:
-  return error;
-}
+      for ( ; count > 0; count-- )
+      {
+        FT_UInt  num_items = FT_PEEK_USHORT( p + 2 );
 
+        /*
+         *  We don't need to check the value sets themselves, since this
+         *  is done later.
+         */
+        strike += 10 * num_items;
 
-FT_LOCAL_DEF( FT_Error )
-tt_face_find_bdf_prop( TT_Face           face,
-                       const char*       property_name,
-                       BDF_PropertyRec  *aprop )
-{
-  TT_BDF    bdf   = &face->bdf;
-  FT_Size   size  = FT_FACE(face)->size;
-  FT_Error  error = 0;
-  FT_Byte*  p;
-  FT_UInt   count;
-  FT_Byte*  strike;
-  FT_UInt   property_len;
+        p += 4;
+      }
 
-  aprop->type = BDF_PROPERTY_TYPE_NONE;
+      if ( strike > bdf->strings )
+        goto BadTable;
+    }
 
-  if ( bdf->loaded == 0 )
-  {
-    error = tt_face_load_bdf_props( face, FT_FACE(face)->stream );
-    if ( error )
-      goto Exit;
-  }
+    bdf->loaded = 1;
 
-  count  = bdf->num_strikes;
-  p      = bdf->table + 8;
-  strike = p + 4*count;
+  Exit:
+    return error;
+  }
 
-  error = FT_Err_Invalid_Argument;
 
-  if ( size == NULL || property_name == NULL )
-    goto Exit;
+  FT_LOCAL_DEF( FT_Error )
+  tt_face_find_bdf_prop( TT_Face           face,
+                         const char*       property_name,
+                         BDF_PropertyRec  *aprop )
+  {
+    TT_BDF    bdf   = &face->bdf;
+    FT_Size   size  = FT_FACE(face)->size;
+    FT_Error  error = 0;
+    FT_Byte*  p;
+    FT_UInt   count;
+    FT_Byte*  strike;
+    FT_UInt   property_len;
 
-  property_len = ft_strlen( property_name );
-  if ( property_len == 0 )
-    goto Exit;
 
-  for ( ; count > 0; count-- )
-  {
-    FT_UInt   _ppem  = FT_NEXT_USHORT(p);
-    FT_UInt   _count = FT_NEXT_USHORT(p);
+    aprop->type = BDF_PROPERTY_TYPE_NONE;
 
-    if ( _ppem == size->metrics.y_ppem )
+    if ( bdf->loaded == 0 )
     {
-      count = _count;
-      goto FoundStrike;
+      error = tt_face_load_bdf_props( face, FT_FACE( face )->stream );
+      if ( error )
+        goto Exit;
     }
 
-    strike += 10*_count;
-  }
-  goto Exit;
+    count  = bdf->num_strikes;
+    p      = bdf->table + 8;
+    strike = p + 4 * count;
 
-FoundStrike:
-  p = strike;
-  for ( ; count > 0; count-- )
-  {
-    FT_UInt   type = FT_PEEK_USHORT(p+4);
+    error = FT_Err_Invalid_Argument;
 
-    if ( (type & 0x10) != 0 )
+    if ( size == NULL || property_name == NULL )
+      goto Exit;
+
+    property_len = ft_strlen( property_name );
+    if ( property_len == 0 )
+      goto Exit;
+
+    for ( ; count > 0; count-- )
     {
-      FT_UInt32  name_offset = FT_PEEK_ULONG(p);
-      FT_UInt32  value       = FT_PEEK_ULONG(p+6);
-
-      /* be a bit paranoid for invalid entries here */
-      if ( name_offset < bdf->strings_size                        &&
-           property_len < bdf->strings_size - name_offset         &&
-           ft_strncmp( property_name, (const char*)bdf->strings + name_offset,
-                       bdf->strings_size - name_offset ) == 0     )
+      FT_UInt  _ppem  = FT_NEXT_USHORT( p );
+      FT_UInt  _count = FT_NEXT_USHORT( p );
+
+      if ( _ppem == size->metrics.y_ppem )
       {
-        switch ( type & 0x0F )
+        count = _count;
+        goto FoundStrike;
+      }
+
+      strike += 10 * _count;
+    }
+    goto Exit;
+
+  FoundStrike:
+    p = strike;
+    for ( ; count > 0; count-- )
+    {
+      FT_UInt  type = FT_PEEK_USHORT( p + 4 );
+
+      if ( ( type & 0x10 ) != 0 )
+      {
+        FT_UInt32  name_offset = FT_PEEK_ULONG( p     );
+        FT_UInt32  value       = FT_PEEK_ULONG( p + 6 );
+
+        /* be a bit paranoid for invalid entries here */
+        if ( name_offset < bdf->strings_size                    &&
+             property_len < bdf->strings_size - name_offset     &&
+             ft_strncmp( property_name,
+                         (const char*)bdf->strings + name_offset,
+                         bdf->strings_size - name_offset ) == 0 )
         {
+          switch ( type & 0x0F )
+          {
           case 0x00:  /* string */
           case 0x01:  /* atoms */
             /* check that the content is really 0-terminated */
@@ -204,7 +213,7 @@ FoundStrike:
                  ft_memchr( bdf->strings + value, 0, bdf->strings_size ) )
             {
               aprop->type   = BDF_PROPERTY_TYPE_ATOM;
-              aprop->u.atom = (const char*) bdf->strings + value;
+              aprop->u.atom = (const char*)bdf->strings + value;
               error         = 0;
               goto Exit;
             }
@@ -224,14 +233,17 @@ FoundStrike:
 
           default:
             ;
+          }
         }
       }
+      p += 10;
     }
-    p += 10;
-  }
 
-Exit:
-  return error;
-}
+  Exit:
+    return error;
+  }
 
 #endif /* TT_CONFIG_OPTION_BDF */
+
+
+/* END */
\ No newline at end of file