From 9c84887db3974b6ab9080cb8b0e492b3c6f866f0 Mon Sep 17 00:00:00 2001 From: David Turner Date: Mon, 28 Feb 2000 11:32:54 +0000 Subject: [PATCH] remaining fixes from Just --- src/type1/t1afm.c | 19 +++++++++++++------ src/type1z/t1afm.c | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index 21a766137..80f65362f 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -47,13 +47,13 @@ FT_Int n; /* copy glyph name to intermediate array */ - MEM_Copy( temp, start, len ); + MEM_Copy( temp, *start, len ); temp[len] = 0; /* lookup glyph name in face array */ for ( n = 0; n < type1->num_glyphs; n++ ) { - char* gname = (char*)type1->glyph_names; + char* gname = (char*)type1->glyph_names[n]; if ( gname && gname[0] == temp[0] && strcmp(gname,temp) == 0 ) { @@ -71,20 +71,27 @@ static int afm_atoi( FT_Byte** start, FT_Byte* limit ) { - FT_Byte* p = *start; - int sum = 0; + FT_Byte* p = *start; + int sum = 0; + int sign; /* skip everything that is not a number */ while ( p < limit && (*p < '0' || *p > '9') ) + { + sign = 1; + if (*p == '-') + sign = -1; + p++; + } - while ( p < limit && (*p >= '0' || *p < '9') ) + while ( p < limit && (*p >= '0' && *p < '9') ) { sum = sum*10 + (*p - '0'); p++; } *start = p; - return sum; + return sum*sign; } diff --git a/src/type1z/t1afm.c b/src/type1z/t1afm.c index 21a766137..80f65362f 100644 --- a/src/type1z/t1afm.c +++ b/src/type1z/t1afm.c @@ -47,13 +47,13 @@ FT_Int n; /* copy glyph name to intermediate array */ - MEM_Copy( temp, start, len ); + MEM_Copy( temp, *start, len ); temp[len] = 0; /* lookup glyph name in face array */ for ( n = 0; n < type1->num_glyphs; n++ ) { - char* gname = (char*)type1->glyph_names; + char* gname = (char*)type1->glyph_names[n]; if ( gname && gname[0] == temp[0] && strcmp(gname,temp) == 0 ) { @@ -71,20 +71,27 @@ static int afm_atoi( FT_Byte** start, FT_Byte* limit ) { - FT_Byte* p = *start; - int sum = 0; + FT_Byte* p = *start; + int sum = 0; + int sign; /* skip everything that is not a number */ while ( p < limit && (*p < '0' || *p > '9') ) + { + sign = 1; + if (*p == '-') + sign = -1; + p++; + } - while ( p < limit && (*p >= '0' || *p < '9') ) + while ( p < limit && (*p >= '0' && *p < '9') ) { sum = sum*10 + (*p - '0'); p++; } *start = p; - return sum; + return sum*sign; }