Formatting.

This commit is contained in:
Werner Lemberg 2001-12-07 21:56:32 +00:00
parent 145f94cb26
commit e9e130c071
7 changed files with 191 additions and 174 deletions

View File

@ -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.

View File

@ -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 ===

View File

@ -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 */

View File

@ -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... */

View File

@ -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 */

View File

@ -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:

View File

@ -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;
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 );
error = FSpMakeFSRef( spec, &hostContainerRef );
if ( error == noErr )
error = FSOpenResourceFile( &hostContainerRef,
0, NULL, fsRdPerm, &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;
}
if ( error != noErr )
return FT_Err_Cannot_Open_Resource;
error = FT_New_Face_From_FOND( library, fond, face_index, aface );
UseResFile( res_ref );
Error:
CloseResFile( res_ref );
return error;
/* 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;
} else
return FT_Err_Unknown_File_Format;
}
FMDisposeFontFamilyIterator( &famIter );
if ( the_font )
{
FMGetFontContainer( the_font, pathSpec );
return FT_Err_Ok;
}
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;