Formatting.
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
diff --git a/ChangeLog b/ChangeLog
index 2f6763a..a596d30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,51 +1,47 @@
2001-12-07 David Turner <david@freetype.org>
- * include/freetype/cache/ftccmap.h, src/cache/ftccmap.c: added new
- charmap cache
-
+ * include/freetype/cache/ftccmap.h, src/cache/ftccmap.c: Added new
+ charmap cache.
2001-12-06 Leonard Rosenthol <leonardr@lazerware.com>
- * src/base/ftmac.c: Added support for reading .dfont files on
- Mac OS X. Aldo added a new routine (FT_GetFile_From_Mac_Name())
- which looks up a given font by name in the Mac OS and returns
- the disk file where it resides.
-
- * include/freetype/ftmac.h: Exported FT_GetFile_From_Mac_Name()
+ Added support for reading .dfont files on Mac OS X. Also added a
+ new routine which looks up a given font by name in the Mac OS and
+ returns the disk file where it resides.
+
+ * src/base/ftmac.c (is_dfont): New auxiliary function.
+ (FT_New_Face_From_dfont): New function.
+ (FT_GetFile_From_Mac_Name): New exported function.
+ (FT_New_Face): Updated.
+ * include/freetype/ftmac.h: Updated.
+
+2001-12-06 David Turner <david@freetype.org>
+ * src/cache/Jamfile: Updated.
2001-12-06 Werner Lemberg <wl@gnu.org>
* INSTALL: Small update.
-
2001-12-05 David Turner <david@freetype.org>
- * src/base/ftglyph.c (FT_Glyph_To_Bitmap): re-ordered code for debugging
- purposes..
+ * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Re-ordered code for
+ debugging purposes.
- * src/smooth/ftsmooth.c (ft_smooth_render): fixed a nasty hidden bug where
- outline shifting wasn't correctly undone after bitmap rasterization. this
- created problems with certain glyphs (like '"' of certain fonts..) and
- the cache system..
+ * src/smooth/ftsmooth.c (ft_smooth_render): Fixed a nasty hidden bug
+ where outline shifting wasn't correctly undone after bitmap
+ rasterization. This created problems with certain glyphs (like '"'
+ of certain fonts) and the cache system.
+ * src/pshinter/pshalgo1.c (psh1_hint_table_init): Fix typo.
+ * src/pshinter/pshalgo2.c (psh2_hint_table_init): Fix typo.
+ (ps2_hints_apply): Small fix.
2001-12-05 David Turner <david@freetype.org>
- First of all, a big thanks to Werner and Antoine for their latest work !!
-
- * src/pshinter/pshalgo2.c (psh2_hint_table_init),
- src/pshinter/pshalgo1.c (psh1_hint_table_init): removed compiler
- warnings
-
- * include/freetype/cache/*, src/cache/*: yet another massive rewrite of
- the caching sub-system, in order to both increase performance and allow
- simpler cache sub-classing. As an example, the code for the image and
- sbit caches is now much simpler
-
* src/pshinter/pshalgo2.c (psh2_hint_table_init),
src/pshinter/pshalgo1.c (psh1_hint_table_init): Removed compiler
- warnings
+ warnings.
* include/freetype/cache/*, src/cache/*: Yet another massive rewrite
of the caching sub-system in order to both increase performance and
@@ -280,7 +276,7 @@
2001-10-18 David Turner <david@freetype.org>
* src/psnames/pstables.h, src/tools/glnames.py: Rewrote the
- "glnames.py" script used to generate the "pstables.h" header file.
+ "glnames.py" script used to generate the "pstables.h" header file.
The old one contained a serious bug that made FreeType return
incorrect glyph names for certain glyphs.
diff --git a/docs/BUGS b/docs/BUGS
index e4d62cf..b350d73 100644
--- a/docs/BUGS
+++ b/docs/BUGS
@@ -186,16 +186,15 @@ ADVANCED-COMPOSITES
GLYPH_TO_BITMAP-BUG
- Calling FT_Glyph_To_Bitmap sometimes modifies the original glyph outline,
- creating weird alignment artefacts.
+ Calling FT_Glyph_To_Bitmap() sometimes modifies the original glyph
+ outline, creating weird alignment artefacts.
- this subtle bug was really in the file src/smooth/ftsmooth.c. Basically,
+ This subtle bug was really in the file src/smooth/ftsmooth.c. Basically,
the outline was shifted before rendering it into a new bitmap buffer.
- However, it wasn't properly un-shifted after that operation..
+ However, it wasn't properly un-shifted after that operation.
- this was only noticeable with certain glyphs or certain fonts and crept
- for a long time here..
+ This was only noticeable with certain glyphs or certain fonts; it crept in
+ a long time ago.
-
=== end of file ===
diff --git a/include/freetype/ftmac.h b/include/freetype/ftmac.h
index 7743448..b9f89ba 100644
--- a/include/freetype/ftmac.h
+++ b/include/freetype/ftmac.h
@@ -25,8 +25,8 @@
/***************************************************************************/
-#ifndef __FT_MAC_H__
-#define __FT_MAC_H__
+#ifndef __FTMAC_H__
+#define __FTMAC_H__
#include <ft2build.h>
@@ -95,35 +95,34 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Function> */
- /* FT_GetFile_From_Mac_Name */
+ /* FT_GetFile_From_Mac_Name */
/* */
/* <Description> */
/* Returns an FSSpec for the disk file containing the named font. */
/* */
/* <Input> */
- /* fontName :: Mac OS name of the font (eg. Times New Roman Bold) */
+ /* fontName :: Mac OS name of the font (eg. Times New Roman Bold). */
/* */
/* <Output> */
- /* pathSpec :: FSSpec to the file. For passing to FT_New_Face */
+ /* pathSpec :: FSSpec to the file. For passing to @FT_New_Face. */
/* */
- /* face_index :: index of the face For passing to FT_New_Face */
+ /* face_index :: Index of the face. For passing to @FT_New_Face. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
- /* */
FT_EXPORT_DEF( FT_Error )
- FT_GetFile_From_Mac_Name( char* fontName,
- FSSpec* pathSpec,
- FT_Long* face_index );
-
+ FT_GetFile_From_Mac_Name( char* fontName,
+ FSSpec* pathSpec,
+ FT_Long* face_index );
+
/* */
FT_END_HEADER
-#endif /* __FT_MAC_H__ */
+#endif /* __FTMAC_H__ */
/* END */
diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c
index eb9e13b..aba2297 100644
--- a/src/autohint/ahhint.c
+++ b/src/autohint/ahhint.c
@@ -384,8 +384,8 @@
ah_debug_disable_horz = no_horz_edges;
ah_debug_disable_vert = no_vert_edges;
#else
- FT_UNUSED(no_horz_edges);
- FT_UNUSED(no_vert_edges);
+ FT_UNUSED( no_horz_edges );
+ FT_UNUSED( no_vert_edges );
#endif
/* AH_Interpolate_Blue_Edges( hinter ); -- doesn't seem to help */
/* reduce the problem of the disappearing eye in the `e' of Times... */
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 8939b13..bca789b 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -663,7 +663,7 @@
#else /* !FT_DEBUG_MEMORY */
- /* ansi C doesn't like empty source files */
+ /* ANSI C doesn't like empty source files */
extern const FT_Byte _debug_mem_dummy = 0;
#endif /* !FT_DEBUG_MEMORY */
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index d7f8f25..b0934c3 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -601,10 +601,10 @@
/* create result bitmap glyph */
error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class,
(FT_Glyph*)&bitmap );
- if (error)
+ if ( error )
goto Exit;
-#if 0
+#if 0
/* if `origin' is set, translate the glyph image */
if ( origin )
FT_Glyph_Transform( glyph, 0, origin );
@@ -627,7 +627,7 @@
}
#endif
- if (error)
+ if ( error )
goto Exit;
/* in case of success, copy the bitmap to the glyph bitmap */
@@ -644,9 +644,9 @@
*the_glyph = FT_GLYPH( bitmap );
Exit:
- if (error && bitmap)
- FT_Done_Glyph( FT_GLYPH(bitmap) );
-
+ if ( error && bitmap )
+ FT_Done_Glyph( FT_GLYPH( bitmap ) );
+
return error;
Bad:
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index f56c429..0c96116 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -74,7 +74,6 @@
#include FT_MAC_H
-
/* Set PREFER_LWFN to 1 if LWFN (Type 1) is preferred over
TrueType in case *both* are available (this is not common,
but it *is* possible). */
@@ -83,7 +82,6 @@
#endif
-
/* Quick'n'dirty Pascal string to C string converter.
Warning: this call is not thread safe! Use with caution. */
static char*
@@ -134,22 +132,25 @@
return finfo.fdType;
}
- /* is this a Mac OS X .dfont file */
- static Boolean is_dfont( FSSpec* spec )
- {
- int nameLen = spec->name[0];
-
- if ( spec->name[nameLen-5] == '.' &&
- spec->name[nameLen-4] == 'd' &&
- spec->name[nameLen-3] == 'f' &&
- spec->name[nameLen-2] == 'o' &&
- spec->name[nameLen-1] == 'n' &&
- spec->name[nameLen] == 't')
- return true;
- else
- return false;
- }
-
+
+ /* is this a Mac OS X .dfont file */
+ static Boolean
+ is_dfont( FSSpec* spec )
+ {
+ int nameLen = spec->name[0];
+
+
+ if ( spec->name[nameLen - 5] == '.' &&
+ spec->name[nameLen - 4] == 'd' &&
+ spec->name[nameLen - 3] == 'f' &&
+ spec->name[nameLen - 2] == 'o' &&
+ spec->name[nameLen - 1] == 'n' &&
+ spec->name[nameLen ] == 't' )
+ return true;
+ else
+ return false;
+ }
+
/* Given a PostScript font name, create the Macintosh LWFN file name. */
static void
@@ -236,9 +237,9 @@
/* Look inside the FOND data, answer whether there should be an SFNT
- resource, and answer the name of a possible LWFN Type 1 file.
-
- Thanks to Paul Miller (paulm@profoundeffects.com) for the fix
+ resource, and answer the name of a possible LWFN Type 1 file.
+
+ Thanks to Paul Miller (paulm@profoundeffects.com) for the fix
to load a face OTHER than the first one in the FOND!
*/
static void
@@ -305,8 +306,8 @@
unsigned char* suffixes = names[style->indexes[0] - 1];
- for ( i=1; i<=suffixes[0]; i++ )
- strcat( ps_name, p2c_str( names[suffixes[i] - 1 ] ) );
+ for ( i = 1; i <= suffixes[0]; i++ )
+ strcat( ps_name, p2c_str( names[suffixes[i] - 1] ) );
}
create_lwfn_name( ps_name, lwfn_file_name );
}
@@ -384,7 +385,6 @@
if ( code != last_code )
{
-
if ( last_code != -1 )
{
/* we're done adding a chunk, fill in the size field */
@@ -648,48 +648,51 @@
return error;
}
+
/* Create a new FT_Face from a file spec to a suitcase file. */
static FT_Error
FT_New_Face_From_dfont( FT_Library library,
- FSSpec* spec,
- FT_Long face_index,
- FT_Face* aface )
+ FSSpec* spec,
+ FT_Long face_index,
+ FT_Face* aface )
{
- FT_Error error = FT_Err_Ok;
- short res_ref, res_index;
- Handle fond;
- FSRef hostContainerRef;
-
- error = FSpMakeFSRef( spec, &hostContainerRef );
- if ( error == noErr )
- error = FSOpenResourceFile( &hostContainerRef, 0, NULL, fsRdPerm, &res_ref );
-
- if ( error != noErr )
- return FT_Err_Cannot_Open_Resource;
-
- UseResFile( res_ref );
-
- /* face_index may be -1, in which case we
- just need to do a sanity check */
- if ( face_index < 0 )
- res_index = 1;
- else
- {
- res_index = (short)( face_index + 1 );
- face_index = 0;
- }
- fond = Get1IndResource( 'FOND', res_index );
- if ( ResError() )
- {
- error = FT_Err_Cannot_Open_Resource;
- goto Error;
- }
-
- error = FT_New_Face_From_FOND( library, fond, face_index, aface );
-
-Error:
- CloseResFile( res_ref );
- return error;
+ FT_Error error = FT_Err_Ok;
+ short res_ref, res_index;
+ Handle fond;
+ FSRef hostContainerRef;
+
+
+ error = FSpMakeFSRef( spec, &hostContainerRef );
+ if ( error == noErr )
+ error = FSOpenResourceFile( &hostContainerRef,
+ 0, NULL, fsRdPerm, &res_ref );
+
+ if ( error != noErr )
+ return FT_Err_Cannot_Open_Resource;
+
+ UseResFile( res_ref );
+
+ /* face_index may be -1, in which case we
+ just need to do a sanity check */
+ if ( face_index < 0 )
+ res_index = 1;
+ else
+ {
+ res_index = (short)( face_index + 1 );
+ face_index = 0;
+ }
+ fond = Get1IndResource( 'FOND', res_index );
+ if ( ResError() )
+ {
+ error = FT_Err_Cannot_Open_Resource;
+ goto Error;
+ }
+
+ error = FT_New_Face_From_FOND( library, fond, face_index, aface );
+
+ Error:
+ CloseResFile( res_ref );
+ return error;
}
@@ -740,72 +743,92 @@ Error:
return FT_Err_Unknown_File_Format;
}
+
/* documentation in ftmac.h */
+
FT_EXPORT_DEF( FT_Error )
- FT_GetFile_From_Mac_Name( char* fontName, FSSpec* pathSpec, FT_Long* face_index )
-{
- OptionBits options = kFMUseGlobalScopeOption;
- FMFontFamilyIterator famIter;
- OSStatus status = FMCreateFontFamilyIterator(NULL, NULL, options, &famIter);
- FMFont the_font = NULL;
- FMFontFamily family = NULL;
+ FT_GetFile_From_Mac_Name( char* fontName,
+ FSSpec* pathSpec,
+ FT_Long* face_index )
+ {
+ OptionBits options = kFMUseGlobalScopeOption;
+
+ FMFontFamilyIterator famIter;
+ OSStatus status = FMCreateFontFamilyIterator( NULL, NULL,
+ options,
+ &famIter );
+ FMFont the_font = NULL;
+ FMFontFamily family = NULL;
+
+
*face_index = 0;
- while (status == 0 && !the_font)
+ while ( status == 0 && !the_font )
{
- status = FMGetNextFontFamily(&famIter, &family);
- if (status == 0)
+ status = FMGetNextFontFamily( &famIter, &family );
+ if ( status == 0 )
+ {
+ int stat2;
+ FMFontFamilyInstanceIterator instIter;
+ Str255 famNameStr;
+ char famName[256];
+
+
+ /* get the family name */
+ FMGetFontFamilyName( family, famNameStr );
+ CopyPascalStringToC( famNameStr, famName );
+
+ /* iterate through the styles */
+ FMCreateFontFamilyInstanceIterator( family, &instIter );
+
+ *face_index = 0;
+ stat2 = 0;
+ while ( stat2 == 0 && !the_font )
+ {
+ FMFontStyle style;
+ FMFontSize size;
+ FMFont font;
+
+
+ stat2 = FMGetNextFontFamilyInstance( &instIter, &font,
+ &style, &size );
+ if ( stat2 == 0 && size == 0 )
+ {
+ char fullName[256];
+
+
+ /* build up a complete face name */
+ strcpy( fullName, famName );
+ if ( style & bold )
+ strcat( fullName, " Bold" );
+ if ( style & italic )
+ strcat( fullName, " Italic" );
+
+ /* compare with the name we are looking for */
+ if ( strcmp( fullName, fontName ) == 0 )
{
- int stat2;
- FMFontFamilyInstanceIterator instIter;
-
- /* get the family name */
- Str255 famNameStr;
- char famName[256];
- FMGetFontFamilyName(family, famNameStr);
- CopyPascalStringToC(famNameStr, famName);
-
- /* iterate through the styles */
- FMCreateFontFamilyInstanceIterator(family, &instIter);
- *face_index = 0;
- stat2 = 0;
- while (stat2 == 0 && !the_font)
- {
- FMFontStyle style;
- FMFontSize size;
- FMFont font;
- stat2 = FMGetNextFontFamilyInstance(&instIter, &font, &style, &size);
- if (stat2 == 0 && size == 0)
- {
- /* build up a complete face name */
- char fullName[256];
- strcpy( fullName, famName );
- if (style & bold)
- strcat( fullName, " Bold" );
- if (style & italic)
- strcat( fullName, " Italic" );
-
- /* compare with the name we are looking for */
- if (strcmp( fullName, fontName ) == 0 )
- {
- /* found it! */
- the_font = font;
- }
- else
- ++(*face_index);
- }
- }
- FMDisposeFontFamilyInstanceIterator(&instIter);
+ /* found it! */
+ the_font = font;
}
+ else
+ ++(*face_index);
+ }
+ }
+
+ FMDisposeFontFamilyInstanceIterator( &instIter );
+ }
+ }
+
+ FMDisposeFontFamilyIterator( &famIter );
+
+ if ( the_font )
+ {
+ FMGetFontContainer( the_font, pathSpec );
+ return FT_Err_Ok;
}
- FMDisposeFontFamilyIterator(&famIter);
-
- if ( the_font ) {
- FMGetFontContainer(the_font, pathSpec);
- return FT_Err_Ok;
- } else
- return FT_Err_Unknown_File_Format;
-
-}
+ else
+ return FT_Err_Unknown_File_Format;
+ }
+
/*************************************************************************/
/* */
@@ -843,7 +866,7 @@ Error:
return FT_New_Face_From_LWFN( library, &spec, face_index, aface );
else if ( is_dfont( &spec ) )
return FT_New_Face_From_dfont( library, &spec, face_index, aface );
- else /* let it fall through to normal loader (.ttf, .otf, etc.) */
+ else /* let it fall through to normal loader (.ttf, .otf, etc.) */
{
args.flags = ft_open_pathname;
args.pathname = (char*)pathname;