2000-07-28 03:10:35 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftmac.c */
|
|
|
|
/* */
|
2000-07-29 22:38:19 +02:00
|
|
|
/* Mac FOND support. Written by just@letterror.com. */
|
2006-01-11 10:28:38 +01:00
|
|
|
/* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */
|
2000-07-28 03:10:35 +02:00
|
|
|
/* */
|
2006-01-11 11:57:42 +01:00
|
|
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006 by */
|
2000-07-28 03:10:35 +02:00
|
|
|
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Notes
|
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
Mac suitcase files can (and often do!) contain multiple fonts. To
|
2000-07-28 03:10:35 +02:00
|
|
|
support this I use the face_index argument of FT_(Open|New)_Face()
|
|
|
|
functions, and pretend the suitcase file is a collection.
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
Warning: fbit and NFNT bitmap resources are not supported yet. In old
|
|
|
|
sfnt fonts, bitmap glyph data for each size is stored in each `NFNT'
|
|
|
|
resources instead of the `bdat' table in the sfnt resource. Therefore,
|
|
|
|
face->num_fixed_sizes is set to 0, because bitmap data in `NFNT'
|
|
|
|
resource is unavailable at present.
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
The Mac FOND support works roughly like this:
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
- Check whether the offered stream points to a Mac suitcase file. This
|
|
|
|
is done by checking the file type: it has to be 'FFIL' or 'tfil'. The
|
|
|
|
stream that gets passed to our init_face() routine is a stdio stream,
|
|
|
|
which isn't usable for us, since the FOND resources live in the
|
|
|
|
resource fork. So we just grab the stream->pathname field.
|
|
|
|
|
|
|
|
- Read the FOND resource into memory, then check whether there is a
|
|
|
|
TrueType font and/or(!) a Type 1 font available.
|
|
|
|
|
|
|
|
- If there is a Type 1 font available (as a separate `LWFN' file), read
|
|
|
|
its data into memory, massage it slightly so it becomes PFB data, wrap
|
|
|
|
it into a memory stream, load the Type 1 driver and delegate the rest
|
|
|
|
of the work to it by calling FT_Open_Face(). (XXX TODO: after this
|
|
|
|
has been done, the kerning data from the FOND resource should be
|
|
|
|
appended to the face: On the Mac there are usually no AFM files
|
|
|
|
available. However, this is tricky since we need to map Mac char
|
|
|
|
codes to ps glyph names to glyph ID's...)
|
|
|
|
|
|
|
|
- If there is a TrueType font (an `sfnt' resource), read it into memory,
|
|
|
|
wrap it into a memory stream, load the TrueType driver and delegate
|
|
|
|
the rest of the work to it, by calling FT_Open_Face().
|
2000-07-28 03:10:35 +02:00
|
|
|
*/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
#include FT_INTERNAL_STREAM_H
|
2003-05-11 09:12:26 +02:00
|
|
|
|
2004-08-28 10:02:46 +02:00
|
|
|
#if defined( __GNUC__ ) || defined( __IBMC__ )
|
2004-04-14 10:49:11 +02:00
|
|
|
/* This is for Mac OS X. Without redefinition, OS_INLINE */
|
|
|
|
/* expands to `static inline' which doesn't survive the */
|
|
|
|
/* -ansi compilation flag of GCC. */
|
2006-01-11 11:57:42 +01:00
|
|
|
#define OS_INLINE static __inline__
|
2003-05-11 09:12:26 +02:00
|
|
|
#include <Carbon/Carbon.h>
|
|
|
|
#else
|
2000-07-28 03:10:35 +02:00
|
|
|
#include <Resources.h>
|
|
|
|
#include <Fonts.h>
|
|
|
|
#include <Errors.h>
|
2001-12-06 18:52:06 +01:00
|
|
|
#include <Files.h>
|
|
|
|
#include <TextUtils.h>
|
2003-05-11 09:12:26 +02:00
|
|
|
#endif
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
|
|
|
|
#include <FSp_fopen.h>
|
|
|
|
#endif
|
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include FT_MAC_H
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
/* FSSpec functions are deprecated since Mac OS X 10.4 */
|
2006-01-11 10:28:38 +01:00
|
|
|
#ifndef HAVE_FSSPEC
|
|
|
|
#if TARGET_API_MAC_OS8 || TARGET_API_MAC_CARBON
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_FSSPEC 1
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_FSSPEC 0
|
2006-01-11 10:28:38 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* most FSRef functions were introduced since Mac OS 9 */
|
|
|
|
#ifndef HAVE_FSREF
|
|
|
|
#if TARGET_API_MAC_OSX
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_FSREF 1
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_FSREF 0
|
2006-01-11 10:28:38 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HFS_MAXPATHLEN
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HFS_MAXPATHLEN 1024
|
2006-01-11 10:28:38 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
/* QuickDraw is deprecated since Mac OS X 10.4 */
|
2006-01-11 10:28:38 +01:00
|
|
|
#ifndef HAVE_QUICKDRAW_CARBON
|
|
|
|
#if TARGET_API_MAC_OS8 || TARGET_API_MAC_CARBON
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_QUICKDRAW_CARBON 1
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_QUICKDRAW_CARBON 0
|
2006-01-11 10:28:38 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* AppleTypeService is available since Mac OS X */
|
|
|
|
#ifndef HAVE_ATS
|
|
|
|
#if TARGET_API_MAC_OSX
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_ATS 1
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
#define HAVE_ATS 0
|
2006-01-11 10:28:38 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
/* 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). */
|
|
|
|
#ifndef PREFER_LWFN
|
2006-01-11 11:57:42 +01:00
|
|
|
#define PREFER_LWFN 1
|
2000-07-28 03:10:35 +02:00
|
|
|
#endif
|
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if !HAVE_QUICKDRAW_CARBON /* QuickDraw is deprecated since Mac OS X 10.4 */
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_GetFile_From_Mac_Name( const char* fontName,
|
|
|
|
FSSpec* pathSpec,
|
|
|
|
FT_Long* face_index )
|
|
|
|
{
|
|
|
|
return FT_Err_Unimplemented_Feature;
|
|
|
|
}
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_GetFile_From_Mac_Name( const char* fontName,
|
|
|
|
FSSpec* pathSpec,
|
|
|
|
FT_Long* face_index )
|
|
|
|
{
|
|
|
|
OptionBits options = kFMUseGlobalScopeOption;
|
|
|
|
|
|
|
|
FMFontFamilyIterator famIter;
|
|
|
|
OSStatus status = FMCreateFontFamilyIterator( NULL, NULL,
|
|
|
|
options,
|
|
|
|
&famIter );
|
|
|
|
FMFont the_font = 0;
|
|
|
|
FMFontFamily family = 0;
|
|
|
|
|
|
|
|
|
|
|
|
*face_index = 0;
|
|
|
|
while ( status == 0 && !the_font )
|
|
|
|
{
|
|
|
|
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;
|
2006-01-11 11:57:42 +01:00
|
|
|
stat2 = 0;
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
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 */
|
|
|
|
ft_strcpy( fullName, famName );
|
|
|
|
if ( style & bold )
|
Further C library abstraction. Based on a patch from
msn2@bidyut.com.
* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions. Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).
* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 09:31:16 +02:00
|
|
|
ft_strcat( fullName, " Bold" );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( style & italic )
|
Further C library abstraction. Based on a patch from
msn2@bidyut.com.
* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions. Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).
* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 09:31:16 +02:00
|
|
|
ft_strcat( fullName, " Italic" );
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
/* compare with the name we are looking for */
|
|
|
|
if ( ft_strcmp( fullName, fontName ) == 0 )
|
|
|
|
{
|
|
|
|
/* 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;
|
|
|
|
}
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_QUICKDRAW_CARBON */
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
#if !HAVE_ATS
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_GetFile_From_Mac_ATS_Name( const char* fontName,
|
|
|
|
FSSpec* pathSpec,
|
|
|
|
FT_Long* face_index )
|
|
|
|
{
|
|
|
|
return FT_Err_Unimplemented_Feature;
|
|
|
|
}
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_GetFile_From_Mac_ATS_Name( const char* fontName,
|
|
|
|
FSSpec* pathSpec,
|
|
|
|
FT_Long* face_index )
|
|
|
|
{
|
|
|
|
CFStringRef cf_fontName;
|
|
|
|
ATSFontRef ats_font_id;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
*face_index = 0;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
cf_fontName = CFStringCreateWithCString( NULL, fontName,
|
|
|
|
kCFStringEncodingMacRoman );
|
|
|
|
ats_font_id = ATSFontFindFromName( cf_fontName,
|
|
|
|
kATSOptionFlagsUnRestrictedScope );
|
|
|
|
|
|
|
|
if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
|
2006-01-11 10:28:38 +01:00
|
|
|
return FT_Err_Unknown_File_Format;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
if ( 0 != ATSFontGetFileSpecification( ats_font_id, pathSpec ) )
|
2006-01-11 10:28:38 +01:00
|
|
|
return FT_Err_Unknown_File_Format;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
/* face_index calculation by searching preceding fontIDs */
|
|
|
|
/* with same FSRef */
|
2006-01-11 10:28:38 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
FSSpec f;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
for ( i = 1; i < ats_font_id; i++ )
|
|
|
|
{
|
|
|
|
if ( 0 != ATSFontGetFileSpecification( ats_font_id - i,
|
|
|
|
&f ) ||
|
|
|
|
f.vRefNum != pathSpec->vRefNum ||
|
|
|
|
f.parID != pathSpec->parID ||
|
|
|
|
f.name[0] != pathSpec->name[0] ||
|
|
|
|
0 != ft_strncmp( (char *)f.name + 1,
|
|
|
|
(char *)pathSpec->name + 1,
|
|
|
|
f.name[0] ) )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
*face_index = ( i - 1 );
|
|
|
|
}
|
|
|
|
return FT_Err_Ok;
|
|
|
|
}
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_ATS */
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
#if defined( __MWERKS__ ) && !TARGET_RT_MAC_MACHO
|
|
|
|
|
Further C library abstraction. Based on a patch from
msn2@bidyut.com.
* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions. Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).
* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 09:31:16 +02:00
|
|
|
#define STREAM_FILE( stream ) ( (FT_FILE*)stream->descriptor.pointer )
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( void )
|
|
|
|
ft_FSp_stream_close( FT_Stream stream )
|
|
|
|
{
|
Further C library abstraction. Based on a patch from
msn2@bidyut.com.
* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions. Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).
* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 09:31:16 +02:00
|
|
|
ft_fclose( STREAM_FILE( stream ) );
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
stream->descriptor.pointer = NULL;
|
|
|
|
stream->size = 0;
|
|
|
|
stream->base = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_CALLBACK_DEF( unsigned long )
|
|
|
|
ft_FSp_stream_io( FT_Stream stream,
|
|
|
|
unsigned long offset,
|
|
|
|
unsigned char* buffer,
|
|
|
|
unsigned long count )
|
|
|
|
{
|
Further C library abstraction. Based on a patch from
msn2@bidyut.com.
* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions. Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).
* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 09:31:16 +02:00
|
|
|
FT_FILE* file;
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
file = STREAM_FILE( stream );
|
|
|
|
|
Further C library abstraction. Based on a patch from
msn2@bidyut.com.
* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions. Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).
* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 09:31:16 +02:00
|
|
|
ft_fseek( file, offset, SEEK_SET );
|
2004-02-26 22:56:27 +01:00
|
|
|
|
Further C library abstraction. Based on a patch from
msn2@bidyut.com.
* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions. Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).
* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 09:31:16 +02:00
|
|
|
return (unsigned long)ft_fread( buffer, 1, count, file );
|
2004-02-26 22:56:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __MWERKS__ && !TARGET_RT_MAC_MACHO */
|
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if HAVE_FSSPEC && !HAVE_FSREF
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
static OSErr
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_FSPathMakeSpec( const UInt8* pathname,
|
|
|
|
FSSpec* spec_p,
|
|
|
|
Boolean isDirectory )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2006-01-11 10:28:38 +01:00
|
|
|
const char *p, *q;
|
|
|
|
short vRefNum;
|
|
|
|
long dirID;
|
|
|
|
Str255 nodeName;
|
|
|
|
OSErr err;
|
2004-02-26 22:56:27 +01:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
p = q = (const char *)pathname;
|
|
|
|
dirID = 0;
|
|
|
|
vRefNum = 0;
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
while ( 1 )
|
2006-01-11 11:57:42 +01:00
|
|
|
{
|
2006-01-11 10:28:38 +01:00
|
|
|
q = p + FT_MIN( 255, ft_strlen( p ) );
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
if ( q == p )
|
2006-01-11 10:28:38 +01:00
|
|
|
return 0;
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( 255 < ft_strlen( (char *)pathname ) )
|
|
|
|
{
|
|
|
|
while ( p < q && *q != ':' )
|
|
|
|
q--;
|
|
|
|
}
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( p < q )
|
|
|
|
*(char *)nodeName = q - p;
|
|
|
|
else if ( ft_strlen( p ) < 256 )
|
|
|
|
*(char *)nodeName = ft_strlen( p );
|
|
|
|
else
|
|
|
|
return errFSNameTooLong;
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
ft_strncpy( (char *)nodeName + 1, (char *)p, *(char *)nodeName );
|
|
|
|
err = FSMakeFSSpec( vRefNum, dirID, nodeName, spec_p );
|
|
|
|
if ( err || '\0' == *q )
|
|
|
|
return err;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
vRefNum = spec_p->vRefNum;
|
|
|
|
dirID = spec_p->parID;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
p = q;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static OSErr
|
|
|
|
FT_FSpMakePath( const FSSpec* spec_p,
|
|
|
|
UInt8* path,
|
|
|
|
UInt32 maxPathSize )
|
|
|
|
{
|
|
|
|
OSErr err;
|
|
|
|
FSSpec spec = *spec_p;
|
|
|
|
short vRefNum;
|
|
|
|
long dirID;
|
|
|
|
Str255 parDir_name;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_MEM_SET( path, 0, maxPathSize );
|
|
|
|
while ( 1 )
|
|
|
|
{
|
|
|
|
int child_namelen = ft_strlen( (char *)path );
|
|
|
|
unsigned char node_namelen = spec.name[0];
|
|
|
|
unsigned char* node_name = spec.name + 1;
|
|
|
|
|
|
|
|
|
|
|
|
if ( node_namelen + child_namelen > maxPathSize )
|
|
|
|
return errFSNameTooLong;
|
|
|
|
|
|
|
|
FT_MEM_MOVE( path + node_namelen + 1, path, child_namelen );
|
|
|
|
FT_MEM_COPY( path, node_name, node_namelen );
|
|
|
|
if ( child_namelen > 0 )
|
2006-01-11 11:57:42 +01:00
|
|
|
path[node_namelen] = ':';
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
vRefNum = spec.vRefNum;
|
|
|
|
dirID = spec.parID;
|
|
|
|
parDir_name[0] = '\0';
|
|
|
|
err = FSMakeFSSpec( vRefNum, dirID, parDir_name, &spec );
|
|
|
|
if ( noErr != err || dirID == spec.parID )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return noErr;
|
|
|
|
}
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_FSSPEC && !HAVE_FSREF */
|
2004-02-26 22:56:27 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
static OSErr
|
|
|
|
FT_FSPathMakeRes( const UInt8* pathname,
|
|
|
|
short* res )
|
|
|
|
{
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if HAVE_FSREF
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
OSErr err;
|
|
|
|
FSRef ref;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
/* at present, no support for dfont format */
|
2006-01-11 10:28:38 +01:00
|
|
|
err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res );
|
|
|
|
if ( noErr == err )
|
|
|
|
return err;
|
|
|
|
|
|
|
|
/* fallback to original resource-fork font */
|
|
|
|
*res = FSOpenResFile( &ref, fsRdPerm );
|
|
|
|
err = ResError();
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
OSErr err;
|
2006-01-11 10:28:38 +01:00
|
|
|
FSSpec spec;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != FT_FSPathMakeSpec( pathname, &spec, FALSE ) )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
/* at present, no support for dfont format without FSRef */
|
|
|
|
/* (see above), try original resource-fork font */
|
2006-01-11 10:28:38 +01:00
|
|
|
*res = FSpOpenResFile( &spec, fsRdPerm );
|
|
|
|
err = ResError();
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_FSREF */
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
return err;
|
2000-07-28 03:10:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
/* Return the file type for given pathname */
|
2001-06-27 18:18:10 +02:00
|
|
|
static OSType
|
2006-01-11 10:28:38 +01:00
|
|
|
get_file_type_from_path( const UInt8* pathname )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if HAVE_FSREF
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FSRef ref;
|
|
|
|
FSCatalogInfo info;
|
|
|
|
|
|
|
|
|
|
|
|
if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
|
|
|
|
return ( OSType ) 0;
|
|
|
|
|
|
|
|
if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoFinderInfo, &info,
|
|
|
|
NULL, NULL, NULL ) )
|
|
|
|
return ( OSType ) 0;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
return ((FInfo *)(info.finderInfo))->fdType;
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FSSpec spec;
|
2000-07-29 22:38:19 +02:00
|
|
|
FInfo finfo;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != FT_FSPathMakeSpec( pathname, &spec, FALSE ) )
|
|
|
|
return ( OSType ) 0;
|
|
|
|
|
|
|
|
if ( noErr != FSpGetFInfo( &spec, &finfo ) )
|
|
|
|
return ( OSType ) 0;
|
2000-07-29 22:38:19 +02:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
return finfo.fdType;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_FSREF */
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
}
|
|
|
|
|
2001-12-07 22:56:32 +01:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
/* Given a PostScript font name, create the Macintosh LWFN file name. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static void
|
|
|
|
create_lwfn_name( char* ps_name,
|
|
|
|
Str255 lwfn_file_name )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
int max = 5, count = 0;
|
|
|
|
FT_Byte* p = lwfn_file_name;
|
|
|
|
FT_Byte* q = (FT_Byte*)ps_name;
|
|
|
|
|
|
|
|
|
|
|
|
lwfn_file_name[0] = 0;
|
|
|
|
|
|
|
|
while ( *q )
|
|
|
|
{
|
2003-05-21 09:39:42 +02:00
|
|
|
if ( ft_isupper( *q ) )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
if ( count )
|
|
|
|
max = 3;
|
|
|
|
count = 0;
|
|
|
|
}
|
* README.UNX: updated the Unix-specific quick-compilation guide to
warn about the GNU Make requirement at compile time..
* include/freetype/config/ftstdlib.h,
include/freetype/config/ftconfig.h,
include/freetype/config/ftheader.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h,
src/autohint/ahoptim.c,
src/base/ftdbgmem.c, src/base/ftdebug.c,
src/base/ftmac.c, src/base/ftobjs.c,
src/base/ftsystem.c,
src/cache/ftcimage.c, src/cache/ftcsbits.c,
src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,
src/pcf/pcfdriver.c, src/pcf/pcfread.c,
src/psaux/t1cmap.c, src/psaux/t1decode.c,
src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
src/pshinter/pshrec.c,
src/psnames/psmodule.c,
src/raster/ftraster.c,
src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
src/smooth/ftgrays.c,
src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c,
src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c:
added the new configuration file "ftstdlib.h" used to define
aliases for all ISO C library functions used by the engine
(e.g. strlen, qsort, setjmp, etc...)
this eases the porting of FreeType 2 to exotic environments like
XFree86 modules/extensions..
also removed many #include <string.h>, #include <stdlib.h>, etc...
from the engine's sources where they're not needed..
2002-04-12 11:31:48 +02:00
|
|
|
if ( count < max && ( ft_isalnum( *q ) || *q == '_' ) )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
*++p = *q;
|
|
|
|
lwfn_file_name[0]++;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
q++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
static short
|
2005-12-23 16:10:54 +01:00
|
|
|
count_faces_sfnt( char* fond_data )
|
2004-02-26 22:56:27 +01:00
|
|
|
{
|
|
|
|
/* The count is 1 greater than the value in the FOND. */
|
|
|
|
/* Isn't that cute? :-) */
|
|
|
|
|
2005-12-23 16:10:54 +01:00
|
|
|
return 1 + *( (short*)( fond_data + sizeof ( FamRec ) ) );
|
2004-02-26 22:56:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-12-23 13:22:46 +01:00
|
|
|
static short
|
2005-12-23 16:10:54 +01:00
|
|
|
count_faces_scalable( char* fond_data )
|
2005-12-23 13:22:46 +01:00
|
|
|
{
|
|
|
|
AsscEntry* assoc;
|
|
|
|
FamRec* fond;
|
|
|
|
short i, face, face_all;
|
|
|
|
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
fond = (FamRec*)fond_data;
|
|
|
|
face_all = *( (short *)( fond_data + sizeof ( FamRec ) ) ) + 1;
|
|
|
|
assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
|
|
|
|
face = 0;
|
2005-12-23 13:22:46 +01:00
|
|
|
|
|
|
|
for ( i = 0; i < face_all; i++ )
|
|
|
|
{
|
|
|
|
if ( 0 == assoc[i].fontSize )
|
2005-12-23 16:10:54 +01:00
|
|
|
face++;
|
2005-12-23 13:22:46 +01:00
|
|
|
}
|
|
|
|
return face;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
/* Look inside the FOND data, answer whether there should be an SFNT
|
2001-12-07 22:56:32 +01:00
|
|
|
resource, and answer the name of a possible LWFN Type 1 file.
|
|
|
|
|
|
|
|
Thanks to Paul Miller (paulm@profoundeffects.com) for the fix
|
2001-10-26 15:24:39 +02:00
|
|
|
to load a face OTHER than the first one in the FOND!
|
|
|
|
*/
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
static void
|
|
|
|
parse_fond( char* fond_data,
|
|
|
|
short* have_sfnt,
|
|
|
|
short* sfnt_id,
|
2001-10-26 15:24:39 +02:00
|
|
|
Str255 lwfn_file_name,
|
|
|
|
short face_index )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
AsscEntry* assoc;
|
2001-10-26 15:24:39 +02:00
|
|
|
AsscEntry* base_assoc;
|
2000-07-28 03:10:35 +02:00
|
|
|
FamRec* fond;
|
|
|
|
|
|
|
|
|
|
|
|
*sfnt_id = 0;
|
|
|
|
*have_sfnt = 0;
|
|
|
|
lwfn_file_name[0] = 0;
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
fond = (FamRec*)fond_data;
|
|
|
|
assoc = (AsscEntry*)( fond_data + sizeof ( FamRec ) + 2 );
|
2001-10-26 15:24:39 +02:00
|
|
|
base_assoc = assoc;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
/* Let's do a little range checking before we get too excited here */
|
|
|
|
if ( face_index < count_faces_sfnt( fond_data ) )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2004-02-26 22:56:27 +01:00
|
|
|
assoc += face_index; /* add on the face_index! */
|
|
|
|
|
|
|
|
/* if the face at this index is not scalable,
|
|
|
|
fall back to the first one (old behavior) */
|
|
|
|
if ( assoc->fontSize == 0 )
|
|
|
|
{
|
|
|
|
*have_sfnt = 1;
|
|
|
|
*sfnt_id = assoc->fontID;
|
|
|
|
}
|
|
|
|
else if ( base_assoc->fontSize == 0 )
|
|
|
|
{
|
|
|
|
*have_sfnt = 1;
|
|
|
|
*sfnt_id = base_assoc->fontID;
|
|
|
|
}
|
2001-10-26 15:24:39 +02:00
|
|
|
}
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
if ( fond->ffStylOff )
|
|
|
|
{
|
|
|
|
unsigned char* p = (unsigned char*)fond_data;
|
|
|
|
StyleTable* style;
|
|
|
|
unsigned short string_count;
|
|
|
|
char ps_name[256];
|
|
|
|
unsigned char* names[64];
|
|
|
|
int i;
|
|
|
|
|
2000-07-29 22:38:19 +02:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
p += fond->ffStylOff;
|
|
|
|
style = (StyleTable*)p;
|
2000-07-29 22:38:19 +02:00
|
|
|
p += sizeof ( StyleTable );
|
2000-07-28 03:10:35 +02:00
|
|
|
string_count = *(unsigned short*)(p);
|
2000-07-29 22:38:19 +02:00
|
|
|
p += sizeof ( short );
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
for ( i = 0; i < string_count && i < 64; i++ )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
names[i] = p;
|
2006-01-11 11:57:42 +01:00
|
|
|
p += names[i][0];
|
2000-07-28 03:10:35 +02:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2002-04-30 16:26:49 +02:00
|
|
|
size_t ps_name_len = (size_t)names[0][0];
|
|
|
|
|
|
|
|
|
|
|
|
if ( ps_name_len != 0 )
|
|
|
|
{
|
2003-05-21 09:39:42 +02:00
|
|
|
ft_memcpy(ps_name, names[0] + 1, ps_name_len);
|
2002-04-30 16:26:49 +02:00
|
|
|
ps_name[ps_name_len] = 0;
|
|
|
|
}
|
|
|
|
if ( style->indexes[0] > 1 )
|
|
|
|
{
|
|
|
|
unsigned char* suffixes = names[style->indexes[0] - 1];
|
|
|
|
|
|
|
|
|
2003-04-23 20:10:19 +02:00
|
|
|
for ( i = 1; i <= suffixes[0]; i++ )
|
2002-04-30 16:26:49 +02:00
|
|
|
{
|
|
|
|
unsigned char* s;
|
|
|
|
size_t j = suffixes[i] - 1;
|
|
|
|
|
|
|
|
|
|
|
|
if ( j < string_count && ( s = names[j] ) != NULL )
|
|
|
|
{
|
|
|
|
size_t s_len = (size_t)s[0];
|
2000-07-29 22:38:19 +02:00
|
|
|
|
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
if ( s_len != 0 && ps_name_len + s_len < sizeof ( ps_name ) )
|
|
|
|
{
|
2003-05-21 09:39:42 +02:00
|
|
|
ft_memcpy( ps_name + ps_name_len, s + 1, s_len );
|
2002-04-30 16:26:49 +02:00
|
|
|
ps_name_len += s_len;
|
|
|
|
ps_name[ps_name_len] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-07-28 03:10:35 +02:00
|
|
|
}
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
create_lwfn_name( ps_name, lwfn_file_name );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
static FT_Error
|
|
|
|
lookup_lwfn_by_fond( const UInt8* path_fond,
|
|
|
|
const StringPtr base_lwfn,
|
2006-01-11 11:57:42 +01:00
|
|
|
UInt8* path_lwfn,
|
2006-01-11 10:28:38 +01:00
|
|
|
int path_size )
|
|
|
|
{
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if HAVE_FSREF
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FSRef ref, par_ref;
|
|
|
|
int dirname_len;
|
|
|
|
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
/* Pathname for FSRef can be in various formats: HFS, HFS+, and POSIX. */
|
|
|
|
/* We should not extract parent directory by string manipulation. */
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
if ( noErr != FSPathMakeRef( path_fond, &ref, FALSE ) )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
|
|
|
if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,
|
|
|
|
NULL, NULL, NULL, &par_ref ) )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
|
|
|
if ( noErr != FSRefMakePath( &par_ref, path_lwfn, path_size ) )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
|
|
|
if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
|
|
|
/* now we have absolute dirname in lookup_path */
|
|
|
|
if ( path_lwfn[0] == '/' )
|
|
|
|
ft_strcat( (char *)path_lwfn, "/" );
|
|
|
|
else
|
|
|
|
ft_strcat( (char *)path_lwfn, ":" );
|
|
|
|
|
|
|
|
dirname_len = ft_strlen( (char *)path_lwfn );
|
|
|
|
ft_strcat( (char *)path_lwfn, (char *)base_lwfn + 1 );
|
2006-01-11 11:57:42 +01:00
|
|
|
path_lwfn[dirname_len + base_lwfn[0]] = '\0';
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
if ( noErr != FSPathMakeRef( path_lwfn, &ref, FALSE ) )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
|
|
|
|
|
|
|
if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,
|
|
|
|
NULL, NULL, NULL, NULL ) )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
|
|
|
|
|
|
|
return FT_Err_Ok;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
int i;
|
|
|
|
FSSpec spec;
|
|
|
|
|
|
|
|
|
|
|
|
/* pathname for FSSpec is always HFS format */
|
|
|
|
if ( ft_strlen( (char *)path_fond ) > path_size )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
|
|
|
ft_strcpy( (char *)path_lwfn, (char *)path_fond );
|
|
|
|
|
|
|
|
i = ft_strlen( (char *)path_lwfn ) - 1;
|
|
|
|
while ( i > 0 && ':' != path_lwfn[i] )
|
2006-01-11 11:57:42 +01:00
|
|
|
i--;
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
if ( i + 1 + base_lwfn[0] > path_size )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
|
|
|
if ( ':' == path_lwfn[i] )
|
|
|
|
{
|
|
|
|
ft_strcpy( (char *)path_lwfn + i + 1, (char *)base_lwfn + 1 );
|
2006-01-11 11:57:42 +01:00
|
|
|
path_lwfn[i + 1 + base_lwfn[0]] = '\0';
|
2006-01-11 10:28:38 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ft_strcpy( (char *)path_lwfn, (char *)base_lwfn + 1 );
|
2006-01-11 11:57:42 +01:00
|
|
|
path_lwfn[base_lwfn[0]] = '\0';
|
2006-01-11 10:28:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( noErr != FT_FSPathMakeSpec( path_lwfn, &spec, FALSE ) )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
|
|
|
|
|
|
|
return FT_Err_Ok;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_FSREF */
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
static short
|
2006-01-11 10:28:38 +01:00
|
|
|
count_faces( Handle fond,
|
|
|
|
const UInt8* pathname )
|
2004-02-26 22:56:27 +01:00
|
|
|
{
|
2006-01-11 10:28:38 +01:00
|
|
|
short sfnt_id;
|
|
|
|
short have_sfnt, have_lwfn;
|
2006-01-11 11:57:42 +01:00
|
|
|
Str255 lwfn_file_name;
|
2006-01-11 10:28:38 +01:00
|
|
|
UInt8 buff[HFS_MAXPATHLEN];
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_Error err;
|
2006-01-11 10:28:38 +01:00
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
have_sfnt = have_lwfn = 0;
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
HLock( fond );
|
|
|
|
parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, 0 );
|
|
|
|
HUnlock( fond );
|
|
|
|
|
|
|
|
if ( lwfn_file_name[0] )
|
|
|
|
{
|
2006-01-11 10:28:38 +01:00
|
|
|
err = lookup_lwfn_by_fond( pathname, lwfn_file_name,
|
2006-01-11 11:57:42 +01:00
|
|
|
buff, sizeof ( buff ) );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( FT_Err_Ok == err )
|
|
|
|
have_lwfn = 1;
|
2004-02-26 22:56:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )
|
|
|
|
return 1;
|
|
|
|
else
|
2005-12-23 13:22:46 +01:00
|
|
|
return count_faces_scalable( *fond );
|
2004-02-26 22:56:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
/* Read Type 1 data from the POST resources inside the LWFN file,
|
2006-01-11 11:57:42 +01:00
|
|
|
return a PFB buffer. This is somewhat convoluted because the FT2
|
2000-07-28 03:10:35 +02:00
|
|
|
PFB parser wants the ASCII header as one chunk, and the LWFN
|
2006-01-11 11:57:42 +01:00
|
|
|
chunks are often not organized that way, so we glue chunks
|
2000-07-28 03:10:35 +02:00
|
|
|
of the same type together. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static FT_Error
|
|
|
|
read_lwfn( FT_Memory memory,
|
2006-01-11 10:28:38 +01:00
|
|
|
short res,
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_Byte** pfb_data,
|
|
|
|
FT_ULong* size )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
FT_Error error = FT_Err_Ok;
|
2004-02-26 22:56:27 +01:00
|
|
|
short res_id;
|
2002-04-30 16:26:49 +02:00
|
|
|
unsigned char *buffer, *p, *size_p = NULL;
|
2000-07-28 03:10:35 +02:00
|
|
|
FT_ULong total_size = 0;
|
2006-05-02 11:00:29 +02:00
|
|
|
FT_ULong old_total_size = 0;
|
2000-07-28 03:10:35 +02:00
|
|
|
FT_ULong post_size, pfb_chunk_size;
|
|
|
|
Handle post_data;
|
|
|
|
char code, last_code;
|
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
UseResFile( res );
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
/* First pass: load all POST resources, and determine the size of */
|
|
|
|
/* the output buffer. */
|
2002-04-30 16:26:49 +02:00
|
|
|
res_id = 501;
|
2000-07-28 03:10:35 +02:00
|
|
|
last_code = -1;
|
2000-07-29 22:38:19 +02:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
post_data = Get1Resource( 'POST', res_id++ );
|
|
|
|
if ( post_data == NULL )
|
2006-01-11 11:57:42 +01:00
|
|
|
break; /* we are done */
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
code = (*post_data)[0];
|
|
|
|
|
|
|
|
if ( code != last_code )
|
|
|
|
{
|
|
|
|
if ( code == 5 )
|
|
|
|
total_size += 2; /* just the end code */
|
|
|
|
else
|
|
|
|
total_size += 6; /* code + 4 bytes chunk length */
|
|
|
|
}
|
|
|
|
|
|
|
|
total_size += GetHandleSize( post_data ) - 2;
|
|
|
|
last_code = code;
|
2006-05-02 11:00:29 +02:00
|
|
|
|
|
|
|
/* detect integer overflows */
|
|
|
|
if ( total_size < old_total_size )
|
|
|
|
{
|
|
|
|
error = FT_Err_Array_Too_Large;
|
|
|
|
goto Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
old_total_size = total_size;
|
2000-07-28 03:10:35 +02:00
|
|
|
}
|
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_ALLOC( buffer, (FT_Long)total_size ) )
|
2000-07-28 03:10:35 +02:00
|
|
|
goto Error;
|
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
/* Second pass: append all POST data to the buffer, add PFB fields. */
|
|
|
|
/* Glue all consecutive chunks of the same type together. */
|
2002-04-30 16:26:49 +02:00
|
|
|
p = buffer;
|
|
|
|
res_id = 501;
|
|
|
|
last_code = -1;
|
2000-07-28 03:10:35 +02:00
|
|
|
pfb_chunk_size = 0;
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
post_data = Get1Resource( 'POST', res_id++ );
|
|
|
|
if ( post_data == NULL )
|
2006-01-11 11:57:42 +01:00
|
|
|
break; /* we are done */
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
post_size = (FT_ULong)GetHandleSize( post_data ) - 2;
|
|
|
|
code = (*post_data)[0];
|
|
|
|
|
|
|
|
if ( code != last_code )
|
|
|
|
{
|
|
|
|
if ( last_code != -1 )
|
|
|
|
{
|
2006-01-11 11:57:42 +01:00
|
|
|
/* we are done adding a chunk, fill in the size field */
|
2002-04-30 16:26:49 +02:00
|
|
|
if ( size_p != NULL )
|
|
|
|
{
|
|
|
|
*size_p++ = (FT_Byte)( pfb_chunk_size & 0xFF );
|
|
|
|
*size_p++ = (FT_Byte)( ( pfb_chunk_size >> 8 ) & 0xFF );
|
|
|
|
*size_p++ = (FT_Byte)( ( pfb_chunk_size >> 16 ) & 0xFF );
|
|
|
|
*size_p++ = (FT_Byte)( ( pfb_chunk_size >> 24 ) & 0xFF );
|
|
|
|
}
|
2000-07-28 03:10:35 +02:00
|
|
|
pfb_chunk_size = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p++ = 0x80;
|
|
|
|
if ( code == 5 )
|
|
|
|
*p++ = 0x03; /* the end */
|
|
|
|
else if ( code == 2 )
|
|
|
|
*p++ = 0x02; /* binary segment */
|
|
|
|
else
|
|
|
|
*p++ = 0x01; /* ASCII segment */
|
|
|
|
|
|
|
|
if ( code != 5 )
|
|
|
|
{
|
|
|
|
size_p = p; /* save for later */
|
|
|
|
p += 4; /* make space for size field */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
* README.UNX: updated the Unix-specific quick-compilation guide to
warn about the GNU Make requirement at compile time..
* include/freetype/config/ftstdlib.h,
include/freetype/config/ftconfig.h,
include/freetype/config/ftheader.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h,
src/autohint/ahoptim.c,
src/base/ftdbgmem.c, src/base/ftdebug.c,
src/base/ftmac.c, src/base/ftobjs.c,
src/base/ftsystem.c,
src/cache/ftcimage.c, src/cache/ftcsbits.c,
src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,
src/pcf/pcfdriver.c, src/pcf/pcfread.c,
src/psaux/t1cmap.c, src/psaux/t1decode.c,
src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
src/pshinter/pshrec.c,
src/psnames/psmodule.c,
src/raster/ftraster.c,
src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
src/smooth/ftgrays.c,
src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c,
src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c:
added the new configuration file "ftstdlib.h" used to define
aliases for all ISO C library functions used by the engine
(e.g. strlen, qsort, setjmp, etc...)
this eases the porting of FreeType 2 to exotic environments like
XFree86 modules/extensions..
also removed many #include <string.h>, #include <stdlib.h>, etc...
from the engine's sources where they're not needed..
2002-04-12 11:31:48 +02:00
|
|
|
ft_memcpy( p, *post_data + 2, post_size );
|
2000-07-28 03:10:35 +02:00
|
|
|
pfb_chunk_size += post_size;
|
|
|
|
p += post_size;
|
|
|
|
last_code = code;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pfb_data = buffer;
|
|
|
|
*size = total_size;
|
|
|
|
|
2000-07-29 22:38:19 +02:00
|
|
|
Error:
|
2006-01-11 10:28:38 +01:00
|
|
|
CloseResFile( res );
|
2000-07-28 03:10:35 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Finalizer for a memory stream; gets called by FT_Done_Face().
|
|
|
|
It frees the memory it uses. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static void
|
|
|
|
memory_stream_close( FT_Stream stream )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
|
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( stream->base );
|
2000-07-29 22:38:19 +02:00
|
|
|
|
|
|
|
stream->size = 0;
|
|
|
|
stream->base = 0;
|
|
|
|
stream->close = 0;
|
2000-07-28 03:10:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a new memory stream from a buffer and a size. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static FT_Error
|
2002-04-30 16:26:49 +02:00
|
|
|
new_memory_stream( FT_Library library,
|
|
|
|
FT_Byte* base,
|
|
|
|
FT_ULong size,
|
|
|
|
FT_Stream_CloseFunc close,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Stream* astream )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2002-04-30 16:26:49 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory;
|
|
|
|
FT_Stream stream;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
if ( !library )
|
|
|
|
return FT_Err_Invalid_Library_Handle;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
if ( !base )
|
|
|
|
return FT_Err_Invalid_Argument;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
*astream = 0;
|
|
|
|
memory = library->memory;
|
|
|
|
if ( FT_NEW( stream ) )
|
|
|
|
goto Exit;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
FT_Stream_OpenMemory( stream, base, size );
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
stream->close = close;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
*astream = stream;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
2000-07-28 03:10:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a new FT_Face given a buffer and a driver name. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static FT_Error
|
|
|
|
open_face_from_buffer( FT_Library library,
|
|
|
|
FT_Byte* base,
|
|
|
|
FT_ULong size,
|
|
|
|
FT_Long face_index,
|
|
|
|
char* driver_name,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
FT_Open_Args args;
|
|
|
|
FT_Error error;
|
|
|
|
FT_Stream stream;
|
|
|
|
FT_Memory memory = library->memory;
|
|
|
|
|
|
|
|
|
|
|
|
error = new_memory_stream( library,
|
|
|
|
base,
|
|
|
|
size,
|
|
|
|
memory_stream_close,
|
|
|
|
&stream );
|
|
|
|
if ( error )
|
|
|
|
{
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( base );
|
2000-07-28 03:10:35 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
args.flags = FT_OPEN_STREAM;
|
2000-07-28 03:10:35 +02:00
|
|
|
args.stream = stream;
|
|
|
|
if ( driver_name )
|
|
|
|
{
|
2006-01-11 11:57:42 +01:00
|
|
|
args.flags = args.flags | FT_OPEN_DRIVER;
|
2000-07-28 03:10:35 +02:00
|
|
|
args.driver = FT_Get_Module( library, driver_name );
|
|
|
|
}
|
2000-07-29 22:38:19 +02:00
|
|
|
|
2004-03-20 15:26:38 +01:00
|
|
|
/* At this point, face_index has served its purpose; */
|
|
|
|
/* whoever calls this function has already used it to */
|
|
|
|
/* locate the correct font data. We should not propagate */
|
|
|
|
/* this index to FT_Open_Face() (unless it is negative). */
|
|
|
|
|
|
|
|
if ( face_index > 0 )
|
|
|
|
face_index = 0;
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
error = FT_Open_Face( library, &args, face_index, aface );
|
2000-07-28 04:25:23 +02:00
|
|
|
if ( error == FT_Err_Ok )
|
2000-07-28 03:10:35 +02:00
|
|
|
(*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
|
2002-04-30 16:26:49 +02:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a new FT_Face from a file spec to an LWFN file. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static FT_Error
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_New_Face_From_LWFN( FT_Library library,
|
2006-01-11 10:28:38 +01:00
|
|
|
const UInt8* pathname,
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_Long face_index,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2002-04-30 16:26:49 +02:00
|
|
|
FT_Byte* pfb_data;
|
|
|
|
FT_ULong pfb_size;
|
|
|
|
FT_Error error;
|
2006-01-11 10:28:38 +01:00
|
|
|
short res;
|
2004-02-26 22:56:27 +01:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != FT_FSPathMakeRes( pathname, &res ) )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
pfb_data = NULL;
|
|
|
|
pfb_size = 0;
|
|
|
|
error = read_lwfn( library->memory, res, &pfb_data, &pfb_size );
|
|
|
|
CloseResFile( res ); /* PFB is already loaded, useless anymore */
|
2000-07-28 03:10:35 +02:00
|
|
|
if ( error )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
return open_face_from_buffer( library,
|
|
|
|
pfb_data,
|
|
|
|
pfb_size,
|
|
|
|
face_index,
|
|
|
|
"type1",
|
|
|
|
aface );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a new FT_Face from an SFNT resource, specified by res ID. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static FT_Error
|
|
|
|
FT_New_Face_From_SFNT( FT_Library library,
|
|
|
|
short sfnt_id,
|
|
|
|
FT_Long face_index,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2000-07-29 22:38:19 +02:00
|
|
|
Handle sfnt = NULL;
|
|
|
|
FT_Byte* sfnt_data;
|
|
|
|
size_t sfnt_size;
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2000-07-29 22:38:19 +02:00
|
|
|
FT_Memory memory = library->memory;
|
2003-05-15 08:44:09 +02:00
|
|
|
int is_cff;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
sfnt = GetResource( 'sfnt', sfnt_id );
|
|
|
|
if ( ResError() )
|
|
|
|
return FT_Err_Invalid_Handle;
|
|
|
|
|
|
|
|
sfnt_size = (FT_ULong)GetHandleSize( sfnt );
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
ReleaseResource( sfnt );
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
HLock( sfnt );
|
* README.UNX: updated the Unix-specific quick-compilation guide to
warn about the GNU Make requirement at compile time..
* include/freetype/config/ftstdlib.h,
include/freetype/config/ftconfig.h,
include/freetype/config/ftheader.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h,
src/autohint/ahoptim.c,
src/base/ftdbgmem.c, src/base/ftdebug.c,
src/base/ftmac.c, src/base/ftobjs.c,
src/base/ftsystem.c,
src/cache/ftcimage.c, src/cache/ftcsbits.c,
src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,
src/pcf/pcfdriver.c, src/pcf/pcfread.c,
src/psaux/t1cmap.c, src/psaux/t1decode.c,
src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
src/pshinter/pshrec.c,
src/psnames/psmodule.c,
src/raster/ftraster.c,
src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
src/smooth/ftgrays.c,
src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c,
src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c:
added the new configuration file "ftstdlib.h" used to define
aliases for all ISO C library functions used by the engine
(e.g. strlen, qsort, setjmp, etc...)
this eases the porting of FreeType 2 to exotic environments like
XFree86 modules/extensions..
also removed many #include <string.h>, #include <stdlib.h>, etc...
from the engine's sources where they're not needed..
2002-04-12 11:31:48 +02:00
|
|
|
ft_memcpy( sfnt_data, *sfnt, sfnt_size );
|
2000-07-28 03:10:35 +02:00
|
|
|
HUnlock( sfnt );
|
|
|
|
ReleaseResource( sfnt );
|
|
|
|
|
2003-06-07 07:13:22 +02:00
|
|
|
is_cff = sfnt_size > 4 && sfnt_data[0] == 'O' &&
|
|
|
|
sfnt_data[1] == 'T' &&
|
|
|
|
sfnt_data[2] == 'T' &&
|
|
|
|
sfnt_data[3] == 'O';
|
2003-05-15 08:44:09 +02:00
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
return open_face_from_buffer( library,
|
|
|
|
sfnt_data,
|
|
|
|
sfnt_size,
|
|
|
|
face_index,
|
2003-05-15 08:44:09 +02:00
|
|
|
is_cff ? "cff" : "truetype",
|
2000-07-28 03:10:35 +02:00
|
|
|
aface );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create a new FT_Face from a file spec to a suitcase file. */
|
2001-06-27 18:18:10 +02:00
|
|
|
static FT_Error
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_New_Face_From_Suitcase( FT_Library library,
|
2006-01-11 10:28:38 +01:00
|
|
|
const UInt8* pathname,
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_Long face_index,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2005-12-23 13:22:46 +01:00
|
|
|
FT_Error error = FT_Err_Cannot_Open_Resource;
|
2006-01-11 10:28:38 +01:00
|
|
|
short res_ref, res_index;
|
2000-07-28 03:10:35 +02:00
|
|
|
Handle fond;
|
2005-12-23 13:22:46 +01:00
|
|
|
short num_faces_in_res, num_faces_in_fond;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
UseResFile( res_ref );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( ResError() )
|
|
|
|
return FT_Err_Cannot_Open_Resource;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2005-12-23 13:22:46 +01:00
|
|
|
num_faces_in_res = 0;
|
2004-02-26 22:56:27 +01:00
|
|
|
for ( res_index = 1; ; ++res_index )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2004-02-26 22:56:27 +01:00
|
|
|
fond = Get1IndResource( 'FOND', res_index );
|
|
|
|
if ( ResError() )
|
|
|
|
break;
|
2001-12-07 22:56:32 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
num_faces_in_fond = count_faces( fond, pathname );
|
2005-12-23 13:22:46 +01:00
|
|
|
num_faces_in_res += num_faces_in_fond;
|
2001-12-07 22:56:32 +01:00
|
|
|
|
2005-12-23 13:22:46 +01:00
|
|
|
if ( 0 <= face_index && face_index < num_faces_in_fond && error )
|
|
|
|
error = FT_New_Face_From_FOND( library, fond, face_index, aface );
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2005-12-23 13:22:46 +01:00
|
|
|
face_index -= num_faces_in_fond;
|
2001-12-07 22:56:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CloseResFile( res_ref );
|
2005-12-23 13:22:46 +01:00
|
|
|
if ( FT_Err_Ok == error && NULL != aface )
|
|
|
|
(*aface)->num_faces = num_faces_in_res;
|
2001-12-07 22:56:32 +01:00
|
|
|
return error;
|
2001-12-06 18:52:06 +01:00
|
|
|
}
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2002-04-30 16:26:49 +02:00
|
|
|
/* documentation is in ftmac.h */
|
2000-11-07 18:21:11 +01:00
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_New_Face_From_FOND( FT_Library library,
|
|
|
|
Handle fond,
|
|
|
|
FT_Long face_index,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
2006-01-11 11:57:42 +01:00
|
|
|
short sfnt_id, have_sfnt, have_lwfn = 0;
|
|
|
|
short fond_id;
|
|
|
|
OSType fond_type;
|
|
|
|
Str255 fond_name;
|
2006-01-11 10:28:38 +01:00
|
|
|
Str255 lwfn_file_name;
|
|
|
|
UInt8 path_lwfn[HFS_MAXPATHLEN];
|
|
|
|
OSErr err;
|
|
|
|
FT_Error error;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
GetResInfo( fond, &fond_id, &fond_type, fond_name );
|
2000-07-28 03:10:35 +02:00
|
|
|
if ( ResError() != noErr || fond_type != 'FOND' )
|
|
|
|
return FT_Err_Invalid_File_Format;
|
|
|
|
|
|
|
|
HLock( fond );
|
2001-10-26 15:24:39 +02:00
|
|
|
parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
|
2000-07-28 03:10:35 +02:00
|
|
|
HUnlock( fond );
|
|
|
|
|
|
|
|
if ( lwfn_file_name[0] )
|
|
|
|
{
|
2006-01-11 10:28:38 +01:00
|
|
|
short res;
|
2001-12-07 22:56:32 +01:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
res = HomeResFile( fond );
|
|
|
|
if ( noErr != ResError() )
|
|
|
|
goto found_no_lwfn_file;
|
2001-12-07 22:56:32 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if HAVE_FSREF
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
{
|
2006-01-11 10:28:38 +01:00
|
|
|
UInt8 path_fond[HFS_MAXPATHLEN];
|
|
|
|
FSRef ref;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
err = FSGetForkCBInfo( res, kFSInvalidVolumeRefNum,
|
|
|
|
NULL, NULL, NULL, &ref, NULL );
|
|
|
|
if ( noErr != err )
|
|
|
|
goto found_no_lwfn_file;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
err = FSRefMakePath( &ref, path_fond, sizeof ( path_fond ) );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != err )
|
|
|
|
goto found_no_lwfn_file;
|
|
|
|
|
|
|
|
error = lookup_lwfn_by_fond( path_fond, lwfn_file_name,
|
2006-01-11 11:57:42 +01:00
|
|
|
path_lwfn, sizeof ( path_lwfn ) );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( FT_Err_Ok == error )
|
|
|
|
have_lwfn = 1;
|
|
|
|
}
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#elif HAVE_FSSPEC
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
{
|
2006-01-11 10:28:38 +01:00
|
|
|
UInt8 path_fond[HFS_MAXPATHLEN];
|
|
|
|
FCBPBRec pb;
|
|
|
|
Str255 fond_file_name;
|
|
|
|
FSSpec spec;
|
|
|
|
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_MEM_SET( &spec, 0, sizeof ( FSSpec ) );
|
|
|
|
FT_MEM_SET( &pb, 0, sizeof ( FCBPBRec ) );
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
pb.ioNamePtr = fond_file_name;
|
|
|
|
pb.ioVRefNum = 0;
|
|
|
|
pb.ioRefNum = res;
|
|
|
|
pb.ioFCBIndx = 0;
|
|
|
|
|
|
|
|
err = PBGetFCBInfoSync( &pb );
|
|
|
|
if ( noErr != err )
|
|
|
|
goto found_no_lwfn_file;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
err = FSMakeFSSpec( pb.ioFCBVRefNum, pb.ioFCBParID,
|
|
|
|
fond_file_name, &spec );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != err )
|
|
|
|
goto found_no_lwfn_file;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
err = FT_FSpMakePath( &spec, path_fond, sizeof ( path_fond ) );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( noErr != err )
|
|
|
|
goto found_no_lwfn_file;
|
|
|
|
|
|
|
|
error = lookup_lwfn_by_fond( path_fond, lwfn_file_name,
|
2006-01-11 11:57:42 +01:00
|
|
|
path_lwfn, sizeof ( path_lwfn ) );
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( FT_Err_Ok == error )
|
|
|
|
have_lwfn = 1;
|
2006-01-11 11:57:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* HAVE_FSREF, HAVE_FSSPEC */
|
|
|
|
|
|
|
|
}
|
2001-12-07 22:56:32 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) )
|
|
|
|
return FT_New_Face_From_LWFN( library,
|
|
|
|
path_lwfn,
|
|
|
|
face_index,
|
|
|
|
aface );
|
2001-12-07 22:56:32 +01:00
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
found_no_lwfn_file:
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( have_sfnt )
|
|
|
|
return FT_New_Face_From_SFNT( library,
|
|
|
|
sfnt_id,
|
|
|
|
face_index,
|
|
|
|
aface );
|
2001-12-07 22:56:32 +01:00
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
return FT_Err_Unknown_File_Format;
|
2001-12-07 22:56:32 +01:00
|
|
|
}
|
|
|
|
|
2004-02-28 20:12:01 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
/* Common function to load a new FT_Face from a resource file. */
|
2004-02-28 20:12:01 +01:00
|
|
|
static FT_Error
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_New_Face_From_Resource( FT_Library library,
|
2006-01-11 10:28:38 +01:00
|
|
|
const UInt8* pathname,
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_Long face_index,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2004-02-28 20:12:01 +01:00
|
|
|
{
|
|
|
|
OSType file_type;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
/* LWFN is a (very) specific file format, check for it explicitly */
|
2006-01-11 10:28:38 +01:00
|
|
|
file_type = get_file_type_from_path( pathname );
|
2006-01-11 11:57:42 +01:00
|
|
|
if ( file_type == 'LWFN' )
|
2006-01-11 10:28:38 +01:00
|
|
|
return FT_New_Face_From_LWFN( library, pathname, face_index, aface );
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
/* Otherwise the file type doesn't matter (there are more than */
|
|
|
|
/* `FFIL' and `tfil'). Just try opening it as a font suitcase; */
|
|
|
|
/* if it works, fine. */
|
2004-02-28 20:12:01 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
error = FT_New_Face_From_Suitcase( library, pathname, face_index, aface );
|
2006-01-11 11:57:42 +01:00
|
|
|
if ( error == 0 )
|
|
|
|
return error;
|
2004-02-28 20:12:01 +01:00
|
|
|
|
|
|
|
/* let it fall through to normal loader (.ttf, .otf, etc.); */
|
|
|
|
/* we signal this by returning no error and no FT_Face */
|
|
|
|
*aface = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_New_Face */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* This is the Mac-specific implementation of FT_New_Face. In */
|
2000-07-29 22:38:19 +02:00
|
|
|
/* addition to the standard FT_New_Face() functionality, it also */
|
2000-07-28 03:10:35 +02:00
|
|
|
/* accepts pathnames to Mac suitcase files. For further */
|
2000-11-07 18:21:11 +01:00
|
|
|
/* documentation see the original FT_New_Face() in freetype.h. */
|
2000-07-28 03:10:35 +02:00
|
|
|
/* */
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_New_Face( FT_Library library,
|
|
|
|
const char* pathname,
|
|
|
|
FT_Long face_index,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2000-07-28 03:10:35 +02:00
|
|
|
{
|
|
|
|
FT_Open_Args args;
|
2004-02-28 20:12:01 +01:00
|
|
|
FT_Error error;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* test for valid `library' and `aface' delayed to FT_Open_Face() */
|
|
|
|
if ( !pathname )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
2006-01-11 11:57:42 +01:00
|
|
|
error = FT_Err_Ok;
|
2006-01-11 10:28:38 +01:00
|
|
|
*aface = NULL;
|
2000-07-28 03:10:35 +02:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
/* try resourcefork based font: LWFN, FFIL */
|
2006-01-11 11:57:42 +01:00
|
|
|
error = FT_New_Face_From_Resource( library, (UInt8 *)pathname,
|
|
|
|
face_index, aface );
|
2004-02-28 20:12:01 +01:00
|
|
|
if ( error != 0 || *aface != NULL )
|
|
|
|
return error;
|
2002-04-30 16:26:49 +02:00
|
|
|
|
|
|
|
/* let it fall through to normal loader (.ttf, .otf, etc.) */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
args.flags = FT_OPEN_PATHNAME;
|
2002-04-30 16:26:49 +02:00
|
|
|
args.pathname = (char*)pathname;
|
|
|
|
return FT_Open_Face( library, &args, face_index, aface );
|
2000-07-28 03:10:35 +02:00
|
|
|
}
|
|
|
|
|
2000-07-29 22:38:19 +02:00
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2006-01-11 10:28:38 +01:00
|
|
|
/* FT_New_Face_From_FSRef */
|
2004-02-26 22:56:27 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2006-01-11 10:28:38 +01:00
|
|
|
/* FT_New_Face_From_FSRef is identical to FT_New_Face except it */
|
|
|
|
/* accepts an FSRef instead of a path. */
|
2004-02-26 22:56:27 +01:00
|
|
|
/* */
|
|
|
|
FT_EXPORT_DEF( FT_Error )
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_New_Face_From_FSRef( FT_Library library,
|
|
|
|
const FSRef* ref,
|
2006-01-11 11:57:42 +01:00
|
|
|
FT_Long face_index,
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Face* aface )
|
2004-02-26 22:56:27 +01:00
|
|
|
{
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if !HAVE_FSREF
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
return FT_Err_Unimplemented_Feature;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2004-08-28 10:02:46 +02:00
|
|
|
FT_Error error;
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Open_Args args;
|
|
|
|
OSErr err;
|
|
|
|
UInt8 pathname[HFS_MAXPATHLEN];
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( !ref )
|
2004-02-26 22:56:27 +01:00
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
err = FSRefMakePath( ref, pathname, sizeof ( pathname ) );
|
|
|
|
if ( err )
|
|
|
|
error = FT_Err_Cannot_Open_Resource;
|
2004-02-26 22:56:27 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
error = FT_New_Face_From_Resource( library, pathname, face_index, aface );
|
|
|
|
if ( error != 0 || *aface != NULL )
|
2004-02-26 22:56:27 +01:00
|
|
|
return error;
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
/* fallback to datafork font */
|
|
|
|
args.flags = FT_OPEN_PATHNAME;
|
|
|
|
args.pathname = (char*)pathname;
|
|
|
|
return FT_Open_Face( library, &args, face_index, aface );
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_FSREF */
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
}
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* FT_New_Face_From_FSSpec */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* FT_New_Face_From_FSSpec is identical to FT_New_Face except it */
|
|
|
|
/* accepts an FSSpec instead of a path. */
|
|
|
|
/* */
|
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FT_New_Face_From_FSSpec( FT_Library library,
|
|
|
|
const FSSpec* spec,
|
|
|
|
FT_Long face_index,
|
|
|
|
FT_Face* aface )
|
2006-01-11 11:57:42 +01:00
|
|
|
{
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#if HAVE_FSREF
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
FSRef ref;
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
else
|
|
|
|
return FT_New_Face_From_FSRef( library, &ref, face_index, aface );
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#elif HAVE_FSSPEC
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
FT_Error error;
|
|
|
|
FT_Open_Args args;
|
2006-01-11 11:57:42 +01:00
|
|
|
OSErr err;
|
|
|
|
UInt8 pathname[HFS_MAXPATHLEN];
|
2004-02-26 22:56:27 +01:00
|
|
|
|
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
if ( !spec )
|
|
|
|
return FT_Err_Invalid_Argument;
|
|
|
|
|
|
|
|
err = FT_FSpMakePath( spec, pathname, sizeof ( pathname ) );
|
2006-01-11 11:57:42 +01:00
|
|
|
if ( err )
|
|
|
|
error = FT_Err_Cannot_Open_Resource;
|
2004-02-26 22:56:27 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
error = FT_New_Face_From_Resource( library, pathname, face_index, aface );
|
|
|
|
if ( error != 0 || *aface != NULL )
|
2006-01-11 11:57:42 +01:00
|
|
|
return error;
|
2006-01-11 10:28:38 +01:00
|
|
|
|
|
|
|
/* fallback to datafork font */
|
|
|
|
args.flags = FT_OPEN_PATHNAME;
|
|
|
|
args.pathname = (char*)pathname;
|
|
|
|
return FT_Open_Face( library, &args, face_index, aface );
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
#else
|
2006-01-11 11:57:42 +01:00
|
|
|
|
2006-01-11 10:28:38 +01:00
|
|
|
return FT_Err_Unimplemented_Feature;
|
2006-01-11 11:57:42 +01:00
|
|
|
|
|
|
|
#endif /* HAVE_FSREF, HAVE_FSSPEC */
|
|
|
|
|
2004-02-26 22:56:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-29 22:38:19 +02:00
|
|
|
/* END */
|