remaining fixes from Just
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
index 21a7661..80f6536 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 21a7661..80f6536 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;
}