2000-07-05 06:32:02 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
2000-10-28 19:10:06 +02:00
|
|
|
/* t1afm.c */
|
2000-07-05 06:32:02 +02:00
|
|
|
/* */
|
|
|
|
/* AFM support for Type 1 fonts (body). */
|
|
|
|
/* */
|
2013-03-14 10:27:35 +01:00
|
|
|
/* Copyright 1996-2011, 2013 by */
|
2000-07-05 06:32:02 +02:00
|
|
|
/* 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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "t1afm.h"
|
2013-03-14 10:27:35 +01:00
|
|
|
#include FT_INTERNAL_DEBUG_H
|
2000-12-08 03:42:29 +01:00
|
|
|
#include FT_INTERNAL_STREAM_H
|
2006-01-27 13:11:22 +01:00
|
|
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
2013-03-14 10:27:35 +01:00
|
|
|
#include "t1errors.h"
|
2000-07-05 06:32:02 +02:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
|
|
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
|
|
/* messages during execution. */
|
|
|
|
/* */
|
|
|
|
#undef FT_COMPONENT
|
2000-10-28 19:10:06 +02:00
|
|
|
#define FT_COMPONENT trace_t1afm
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
T1_Done_Metrics( FT_Memory memory,
|
|
|
|
AFM_FontInfo fi )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
FT_FREE( fi->KernPairs );
|
|
|
|
fi->NumKernPair = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
FT_FREE( fi->TrackKerns );
|
|
|
|
fi->NumTrackKern = 0;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
FT_FREE( fi );
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
/* read a glyph name and return the equivalent glyph index */
|
|
|
|
static FT_Int
|
|
|
|
t1_get_index( const char* name,
|
2009-07-31 17:30:16 +02:00
|
|
|
FT_Offset len,
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
void* user_data )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
T1_Font type1 = (T1_Font)user_data;
|
|
|
|
FT_Int n;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2009-07-31 17:30:12 +02:00
|
|
|
/* PS string/name length must be < 16-bit */
|
2009-11-20 06:26:22 +01:00
|
|
|
if ( len > 0xFFFFU )
|
2009-07-31 17:30:12 +02:00
|
|
|
return 0;
|
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
for ( n = 0; n < type1->num_glyphs; n++ )
|
2000-02-28 12:32:54 +01:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
char* gname = (char*)type1->glyph_names[n];
|
2000-05-17 01:44:38 +02:00
|
|
|
|
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( gname && gname[0] == name[0] &&
|
|
|
|
ft_strlen( gname ) == len &&
|
|
|
|
ft_strncmp( gname, name, len ) == 0 )
|
|
|
|
return n;
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
return 0;
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#undef KERN_INDEX
|
2006-06-07 07:11:50 +02:00
|
|
|
#define KERN_INDEX( g1, g2 ) ( ( (FT_ULong)(g1) << 16 ) | (g2) )
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* compare two kerning pairs */
|
2001-06-28 09:17:51 +02:00
|
|
|
FT_CALLBACK_DEF( int )
|
2001-06-27 11:26:46 +02:00
|
|
|
compare_kern_pairs( const void* a,
|
|
|
|
const void* b )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
AFM_KernPair pair1 = (AFM_KernPair)a;
|
|
|
|
AFM_KernPair pair2 = (AFM_KernPair)b;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
FT_ULong index1 = KERN_INDEX( pair1->index1, pair1->index2 );
|
|
|
|
FT_ULong index2 = KERN_INDEX( pair2->index1, pair2->index2 );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2008-08-23 21:54:06 +02:00
|
|
|
if ( index1 > index2 )
|
|
|
|
return 1;
|
|
|
|
else if ( index1 < index2 )
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
return 0;
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-02 07:38:33 +02:00
|
|
|
/* parse a PFM file -- for now, only read the kerning pairs */
|
|
|
|
static FT_Error
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
T1_Read_PFM( FT_Face t1_face,
|
|
|
|
FT_Stream stream,
|
|
|
|
AFM_FontInfo fi )
|
2004-08-02 07:38:33 +02:00
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2006-01-16 23:35:33 +01:00
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
FT_Byte* start;
|
|
|
|
FT_Byte* limit;
|
|
|
|
FT_Byte* p;
|
|
|
|
AFM_KernPair kp;
|
|
|
|
FT_Int width_table_length;
|
|
|
|
FT_CharMap oldcharmap;
|
|
|
|
FT_CharMap charmap;
|
|
|
|
FT_Int n;
|
2004-08-02 07:38:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
start = (FT_Byte*)stream->cursor;
|
|
|
|
limit = (FT_Byte*)stream->limit;
|
|
|
|
p = start;
|
|
|
|
|
|
|
|
/* Figure out how long the width table is. */
|
|
|
|
/* This info is a little-endian short at offset 99. */
|
|
|
|
p = start + 99;
|
|
|
|
if ( p + 2 > limit )
|
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Unknown_File_Format );
|
2004-08-02 07:38:33 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
width_table_length = FT_PEEK_USHORT_LE( p );
|
2004-08-02 07:38:33 +02:00
|
|
|
|
|
|
|
p += 18 + width_table_length;
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( p + 0x12 > limit || FT_PEEK_USHORT_LE( p ) < 0x12 )
|
2004-08-02 07:38:33 +02:00
|
|
|
/* extension table is probably optional */
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* Kerning offset is 14 bytes from start of extensions table. */
|
|
|
|
p += 14;
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
p = start + FT_PEEK_ULONG_LE( p );
|
2005-11-08 10:10:16 +01:00
|
|
|
|
|
|
|
if ( p == start )
|
|
|
|
/* zero offset means no table */
|
|
|
|
goto Exit;
|
|
|
|
|
2004-08-02 07:38:33 +02:00
|
|
|
if ( p + 2 > limit )
|
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Unknown_File_Format );
|
2004-08-02 07:38:33 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
fi->NumKernPair = FT_PEEK_USHORT_LE( p );
|
2004-08-02 07:38:33 +02:00
|
|
|
p += 2;
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( p + 4 * fi->NumKernPair > limit )
|
2004-08-02 07:38:33 +02:00
|
|
|
{
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Unknown_File_Format );
|
2004-08-02 07:38:33 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Actually, kerning pairs are simply optional! */
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( fi->NumKernPair == 0 )
|
2004-08-02 07:38:33 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* allocate the pairs */
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( FT_QNEW_ARRAY( fi->KernPairs, fi->NumKernPair ) )
|
2004-08-02 07:38:33 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* now, read each kern pair */
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
kp = fi->KernPairs;
|
|
|
|
limit = p + 4 * fi->NumKernPair;
|
2004-08-02 07:38:33 +02:00
|
|
|
|
|
|
|
/* PFM kerning data are stored by encoding rather than glyph index, */
|
|
|
|
/* so find the PostScript charmap of this font and install it */
|
|
|
|
/* temporarily. If we find no PostScript charmap, then just use */
|
|
|
|
/* the default and hope it is the right one. */
|
|
|
|
oldcharmap = t1_face->charmap;
|
|
|
|
charmap = NULL;
|
|
|
|
|
|
|
|
for ( n = 0; n < t1_face->num_charmaps; n++ )
|
|
|
|
{
|
|
|
|
charmap = t1_face->charmaps[n];
|
|
|
|
/* check against PostScript pseudo platform */
|
|
|
|
if ( charmap->platform_id == 7 )
|
|
|
|
{
|
|
|
|
error = FT_Set_Charmap( t1_face, charmap );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Kerning info is stored as: */
|
|
|
|
/* */
|
|
|
|
/* encoding of first glyph (1 byte) */
|
|
|
|
/* encoding of second glyph (1 byte) */
|
|
|
|
/* offset (little-endian short) */
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
for ( ; p < limit ; p += 4 )
|
2004-08-02 07:38:33 +02:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
kp->index1 = FT_Get_Char_Index( t1_face, p[0] );
|
|
|
|
kp->index2 = FT_Get_Char_Index( t1_face, p[1] );
|
2004-08-02 07:38:33 +02:00
|
|
|
|
2007-03-05 18:40:03 +01:00
|
|
|
kp->x = (FT_Int)FT_PEEK_SHORT_LE(p + 2);
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
kp->y = 0;
|
2004-08-02 07:38:33 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
kp++;
|
2004-08-02 07:38:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( oldcharmap != NULL )
|
|
|
|
error = FT_Set_Charmap( t1_face, oldcharmap );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* now, sort the kern pairs according to their glyph indices */
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
ft_qsort( fi->KernPairs, fi->NumKernPair, sizeof ( AFM_KernPairRec ),
|
2004-08-02 07:38:33 +02:00
|
|
|
compare_kern_pairs );
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
if ( error )
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
{
|
|
|
|
FT_FREE( fi->KernPairs );
|
|
|
|
fi->NumKernPair = 0;
|
|
|
|
}
|
2004-08-02 07:38:33 +02:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* parse a metrics file -- either AFM or PFM depending on what */
|
|
|
|
/* it turns out to be */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
T1_Read_Metrics( FT_Face t1_face,
|
|
|
|
FT_Stream stream )
|
|
|
|
{
|
2006-01-16 23:35:33 +01:00
|
|
|
PSAux_Service psaux;
|
2010-07-12 21:13:22 +02:00
|
|
|
FT_Memory memory = stream->memory;
|
2006-01-16 23:35:33 +01:00
|
|
|
AFM_ParserRec parser;
|
2010-07-12 21:13:22 +02:00
|
|
|
AFM_FontInfo fi = NULL;
|
2013-03-14 17:50:49 +01:00
|
|
|
FT_Error error = FT_ERR( Unknown_File_Format );
|
2006-01-31 08:01:24 +01:00
|
|
|
T1_Font t1_font = &( (T1_Face)t1_face )->type1;
|
2004-08-02 07:38:33 +02:00
|
|
|
|
|
|
|
|
2006-06-07 07:11:50 +02:00
|
|
|
if ( FT_NEW( fi ) ||
|
|
|
|
FT_FRAME_ENTER( stream->size ) )
|
|
|
|
goto Exit;
|
2004-08-02 07:38:33 +02:00
|
|
|
|
2006-01-31 08:01:24 +01:00
|
|
|
fi->FontBBox = t1_font->font_bbox;
|
|
|
|
fi->Ascender = t1_font->font_bbox.yMax;
|
|
|
|
fi->Descender = t1_font->font_bbox.yMin;
|
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
psaux = (PSAux_Service)( (T1_Face)t1_face )->psaux;
|
2011-11-26 13:38:26 +01:00
|
|
|
if ( psaux->afm_parser_funcs )
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
{
|
|
|
|
error = psaux->afm_parser_funcs->init( &parser,
|
|
|
|
stream->memory,
|
|
|
|
stream->cursor,
|
|
|
|
stream->limit );
|
2004-08-02 07:38:33 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
parser.FontInfo = fi;
|
|
|
|
parser.get_index = t1_get_index;
|
2006-01-31 08:01:24 +01:00
|
|
|
parser.user_data = t1_font;
|
2004-08-02 07:38:33 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
error = psaux->afm_parser_funcs->parse( &parser );
|
|
|
|
psaux->afm_parser_funcs->done( &parser );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-14 17:50:49 +01:00
|
|
|
if ( FT_ERR_EQ( error, Unknown_File_Format ) )
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
{
|
|
|
|
FT_Byte* start = stream->cursor;
|
|
|
|
|
|
|
|
|
2007-01-13 23:50:51 +01:00
|
|
|
/* MS Windows allows versions up to 0x3FF without complaining */
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( stream->size > 6 &&
|
2007-01-13 23:50:51 +01:00
|
|
|
start[1] < 4 &&
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
FT_PEEK_ULONG_LE( start + 2 ) == stream->size )
|
|
|
|
error = T1_Read_PFM( t1_face, stream, fi );
|
|
|
|
}
|
|
|
|
|
2006-01-31 08:01:24 +01:00
|
|
|
if ( !error )
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
{
|
2006-01-31 08:01:24 +01:00
|
|
|
t1_font->font_bbox = fi->FontBBox;
|
|
|
|
|
2009-11-04 10:06:04 +01:00
|
|
|
t1_face->bbox.xMin = fi->FontBBox.xMin >> 16;
|
|
|
|
t1_face->bbox.yMin = fi->FontBBox.yMin >> 16;
|
|
|
|
/* no `U' suffix here to 0xFFFF! */
|
|
|
|
t1_face->bbox.xMax = ( fi->FontBBox.xMax + 0xFFFF ) >> 16;
|
|
|
|
t1_face->bbox.yMax = ( fi->FontBBox.yMax + 0xFFFF ) >> 16;
|
2006-01-31 08:01:24 +01:00
|
|
|
|
2009-11-04 10:06:04 +01:00
|
|
|
/* no `U' suffix here to 0x8000! */
|
|
|
|
t1_face->ascender = (FT_Short)( ( fi->Ascender + 0x8000 ) >> 16 );
|
|
|
|
t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 );
|
2006-01-31 08:01:24 +01:00
|
|
|
|
|
|
|
if ( fi->NumKernPair )
|
|
|
|
{
|
|
|
|
t1_face->face_flags |= FT_FACE_FLAG_KERNING;
|
|
|
|
( (T1_Face)t1_face )->afm_data = fi;
|
2006-06-07 07:11:50 +02:00
|
|
|
fi = NULL;
|
2006-01-31 08:01:24 +01:00
|
|
|
}
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
}
|
2004-08-02 07:38:33 +02:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2006-06-07 07:11:50 +02:00
|
|
|
Exit:
|
|
|
|
if ( fi != NULL )
|
|
|
|
T1_Done_Metrics( memory, fi );
|
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* find the kerning for a given glyph pair */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
T1_Get_Kerning( AFM_FontInfo fi,
|
|
|
|
FT_UInt glyph1,
|
|
|
|
FT_UInt glyph2,
|
|
|
|
FT_Vector* kerning )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
AFM_KernPair min, mid, max;
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
FT_ULong idx = KERN_INDEX( glyph1, glyph2 );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* simple binary search */
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
min = fi->KernPairs;
|
|
|
|
max = min + fi->NumKernPair - 1;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
while ( min <= max )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_ULong midi;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
|
|
|
mid = min + ( max - min ) / 2;
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
midi = KERN_INDEX( mid->index1, mid->index2 );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
if ( midi == idx )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
kerning->x = mid->x;
|
|
|
|
kerning->y = mid->y;
|
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
return;
|
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
if ( midi < idx )
|
2000-07-05 06:32:02 +02:00
|
|
|
min = mid + 1;
|
|
|
|
else
|
|
|
|
max = mid - 1;
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
kerning->x = 0;
|
|
|
|
kerning->y = 0;
|
|
|
|
}
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
T1_Get_Track_Kerning( FT_Face face,
|
|
|
|
FT_Fixed ptsize,
|
|
|
|
FT_Int degree,
|
|
|
|
FT_Fixed* kerning )
|
|
|
|
{
|
|
|
|
AFM_FontInfo fi = (AFM_FontInfo)( (T1_Face)face )->afm_data;
|
|
|
|
FT_Int i;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !fi )
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
|
|
|
|
for ( i = 0; i < fi->NumTrackKern; i++ )
|
|
|
|
{
|
|
|
|
AFM_TrackKern tk = fi->TrackKerns + i;
|
|
|
|
|
|
|
|
|
|
|
|
if ( tk->degree != degree )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ( ptsize < tk->min_ptsize )
|
|
|
|
*kerning = tk->min_kern;
|
|
|
|
else if ( ptsize > tk->max_ptsize )
|
|
|
|
*kerning = tk->max_kern;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*kerning = FT_MulDiv( ptsize - tk->min_ptsize,
|
|
|
|
tk->max_kern - tk->min_kern,
|
|
|
|
tk->max_ptsize - tk->min_ptsize ) +
|
|
|
|
tk->min_kern;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* END */
|