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). */
|
|
|
|
/* */
|
2002-04-02 00:01:46 +02:00
|
|
|
/* Copyright 1996-2001, 2002 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"
|
2000-12-08 03:42:29 +01:00
|
|
|
#include FT_INTERNAL_STREAM_H
|
|
|
|
#include FT_INTERNAL_TYPE1_TYPES_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 )
|
2001-06-28 09:17:51 +02:00
|
|
|
T1_Done_AFM( FT_Memory memory,
|
|
|
|
T1_AFM* afm )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( afm->kern_pairs );
|
2000-02-15 13:55:57 +01:00
|
|
|
afm->num_pairs = 0;
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( afm );
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
#undef IS_KERN_PAIR
|
2000-07-05 06:32:02 +02:00
|
|
|
#define IS_KERN_PAIR( p ) ( p[0] == 'K' && p[1] == 'P' )
|
|
|
|
|
* 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
|
|
|
#define IS_ALPHANUM( c ) ( ft_isalnum( c ) || \
|
2002-04-14 02:54:32 +02:00
|
|
|
c == '_' || \
|
|
|
|
c == '.' )
|
2000-02-15 13:55:57 +01:00
|
|
|
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* read a glyph name and return the equivalent glyph index */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_UInt
|
|
|
|
afm_atoindex( FT_Byte** start,
|
|
|
|
FT_Byte* limit,
|
2002-02-28 19:59:37 +01:00
|
|
|
T1_Font type1 )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-07-05 06:32:02 +02:00
|
|
|
FT_Byte* p = *start;
|
|
|
|
FT_Int len;
|
|
|
|
FT_UInt result = 0;
|
|
|
|
char temp[64];
|
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
|
2000-05-17 01:44:38 +02:00
|
|
|
/* skip whitespace */
|
2000-07-05 06:32:02 +02:00
|
|
|
while ( ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' ) &&
|
|
|
|
p < limit )
|
2000-02-15 13:55:57 +01:00
|
|
|
p++;
|
|
|
|
*start = p;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* now, read glyph name */
|
2000-07-05 06:32:02 +02:00
|
|
|
while ( IS_ALPHANUM( *p ) && p < limit )
|
|
|
|
p++;
|
|
|
|
|
2001-03-10 18:07:42 +01:00
|
|
|
len = (FT_Int)( p - *start );
|
2000-07-05 06:32:02 +02:00
|
|
|
|
|
|
|
if ( len > 0 && len < 64 )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
|
|
|
FT_Int n;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* copy glyph name to intermediate array */
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_MEM_COPY( temp, *start, len );
|
2000-02-15 13:55:57 +01:00
|
|
|
temp[len] = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* lookup glyph name in face array */
|
|
|
|
for ( n = 0; n < type1->num_glyphs; n++ )
|
|
|
|
{
|
2000-02-28 12:32:54 +01:00
|
|
|
char* gname = (char*)type1->glyph_names[n];
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
* 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 ( gname && gname[0] == temp[0] && ft_strcmp( gname, temp ) == 0 )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
|
|
|
result = n;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*start = p;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* read an integer */
|
2001-06-28 09:17:51 +02:00
|
|
|
static int
|
|
|
|
afm_atoi( FT_Byte** start,
|
|
|
|
FT_Byte* limit )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-02-28 12:32:54 +01:00
|
|
|
FT_Byte* p = *start;
|
|
|
|
int sum = 0;
|
2000-02-29 18:14:02 +01:00
|
|
|
int sign = 1;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* skip everything that is not a number */
|
2000-07-05 06:32:02 +02:00
|
|
|
while ( p < limit && !isdigit( *p ) )
|
2000-02-28 12:32:54 +01:00
|
|
|
{
|
|
|
|
sign = 1;
|
2000-07-05 06:32:02 +02:00
|
|
|
if ( *p == '-' )
|
2000-02-28 12:32:54 +01:00
|
|
|
sign = -1;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
p++;
|
2000-02-28 12:32:54 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
while ( p < limit && isdigit( *p ) )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-07-05 06:32:02 +02:00
|
|
|
sum = sum * 10 + ( *p - '0' );
|
2000-02-15 13:55:57 +01:00
|
|
|
p++;
|
|
|
|
}
|
|
|
|
*start = p;
|
2000-07-05 06:32:02 +02:00
|
|
|
|
|
|
|
return sum * sign;
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#undef KERN_INDEX
|
2000-07-05 06:32:02 +02:00
|
|
|
#define KERN_INDEX( g1, g2 ) ( ( (FT_ULong)g1 << 16 ) | g2 )
|
|
|
|
|
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
|
|
|
{
|
2000-10-28 19:10:06 +02:00
|
|
|
T1_Kern_Pair* pair1 = (T1_Kern_Pair*)a;
|
|
|
|
T1_Kern_Pair* pair2 = (T1_Kern_Pair*)b;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
FT_ULong index1 = KERN_INDEX( pair1->glyph1, pair1->glyph2 );
|
|
|
|
FT_ULong index2 = KERN_INDEX( pair2->glyph1, pair2->glyph2 );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
|
|
|
return ( index1 - index2 );
|
2000-02-15 13:55:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* parse an AFM file -- for now, only read the kerning pairs */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-06-28 09:17:51 +02:00
|
|
|
T1_Read_AFM( FT_Face t1_face,
|
|
|
|
FT_Stream stream )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
2000-02-15 13:55:57 +01:00
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
FT_Byte* start;
|
|
|
|
FT_Byte* limit;
|
|
|
|
FT_Byte* p;
|
|
|
|
FT_Int count = 0;
|
2000-10-28 19:10:06 +02:00
|
|
|
T1_Kern_Pair* pair;
|
2002-04-02 00:01:46 +02:00
|
|
|
T1_Font type1 = &((T1_Face)t1_face)->type1;
|
2000-10-28 19:10:06 +02:00
|
|
|
T1_AFM* afm = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_FRAME_ENTER( stream->size ) )
|
2000-02-15 13:55:57 +01:00
|
|
|
return error;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
start = (FT_Byte*)stream->cursor;
|
|
|
|
limit = (FT_Byte*)stream->limit;
|
|
|
|
p = start;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* we are now going to count the occurences of `KP' or `KPX' in */
|
|
|
|
/* the AFM file */
|
2000-02-15 13:55:57 +01:00
|
|
|
count = 0;
|
2000-07-05 06:32:02 +02:00
|
|
|
for ( p = start; p < limit - 3; p++ )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-07-05 06:32:02 +02:00
|
|
|
if ( IS_KERN_PAIR( p ) )
|
2000-02-15 13:55:57 +01:00
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
/* Actually, kerning pairs are simply optional! */
|
|
|
|
if ( count == 0 )
|
2000-02-15 13:55:57 +01:00
|
|
|
goto Exit;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* allocate the pairs */
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_NEW( afm ) || FT_NEW_ARRAY( afm->kern_pairs, count ) )
|
2000-02-15 13:55:57 +01:00
|
|
|
goto Exit;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* now, read each kern pair */
|
|
|
|
pair = afm->kern_pairs;
|
|
|
|
afm->num_pairs = count;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* save in face object */
|
|
|
|
((T1_Face)t1_face)->afm_data = afm;
|
|
|
|
|
2001-08-30 08:56:03 +02:00
|
|
|
t1_face->face_flags |= FT_FACE_FLAG_KERNING;
|
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
for ( p = start; p < limit - 3; p++ )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-07-05 06:32:02 +02:00
|
|
|
if ( IS_KERN_PAIR( p ) )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
|
|
|
FT_Byte* q;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-05 06:32:02 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* skip keyword (KP or KPX) */
|
2000-07-05 06:32:02 +02:00
|
|
|
q = p + 2;
|
|
|
|
if ( *q == 'X' )
|
|
|
|
q++;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
pair->glyph1 = afm_atoindex( &q, limit, type1 );
|
|
|
|
pair->glyph2 = afm_atoindex( &q, limit, type1 );
|
|
|
|
pair->kerning.x = afm_atoi( &q, limit );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
pair->kerning.y = 0;
|
|
|
|
if ( p[2] != 'X' )
|
|
|
|
pair->kerning.y = afm_atoi( &q, limit );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
pair++;
|
|
|
|
}
|
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
/* now, sort the kern pairs according to their glyph indices */
|
* 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_qsort( afm->kern_pairs, count, sizeof ( T1_Kern_Pair ),
|
2002-04-14 02:54:32 +02:00
|
|
|
compare_kern_pairs );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-02-15 13:55:57 +01:00
|
|
|
Exit:
|
2000-07-05 06:32:02 +02:00
|
|
|
if ( error )
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( afm );
|
2000-02-15 13:55:57 +01:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
2000-07-05 06:32:02 +02:00
|
|
|
|
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 )
|
2001-06-28 09:17:51 +02:00
|
|
|
T1_Get_Kerning( T1_AFM* afm,
|
|
|
|
FT_UInt glyph1,
|
|
|
|
FT_UInt glyph2,
|
|
|
|
FT_Vector* kerning )
|
2000-02-15 13:55:57 +01:00
|
|
|
{
|
2000-10-28 19:10:06 +02:00
|
|
|
T1_Kern_Pair *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 */
|
|
|
|
min = afm->kern_pairs;
|
2000-07-05 06:32:02 +02:00
|
|
|
max = min + afm->num_pairs - 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;
|
|
|
|
midi = KERN_INDEX( mid->glyph1, mid->glyph2 );
|
|
|
|
|
* 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
|
|
|
{
|
|
|
|
*kerning = mid->kerning;
|
|
|
|
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
|
|
|
|
|
|
|
/* END */
|