* src/cid/cidload.c (cid_parse_dict): Skip token if no keyword is found. * src/type1/t1parse.c (IS_T1_WHITESPACE, IS_T1_LINESPACE, IS_T1_SPACE): Removed. (PFB_Tag): Removed. (read_pfb_tag): Don't use PFB_Tag. * src/type42/t42parse.c (t42_is_space): Handle `\f' also. (t42_parse_encoding): Handle synthetic fonts.
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196
diff --git a/ChangeLog b/ChangeLog
index b1cd95e..c5286de 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2003-09-30 Werner Lemberg <wl@gnu.org>
+
+ * src/cid/cidload.c (cid_parse_dict): Skip token if no keyword is
+ found.
+
+ * src/type1/t1parse.c (IS_T1_WHITESPACE, IS_T1_LINESPACE,
+ IS_T1_SPACE): Removed.
+ (PFB_Tag): Removed.
+ (read_pfb_tag): Don't use PFB_Tag.
+
+ * src/type42/t42parse.c (t42_is_space): Handle `\f' also.
+ (t42_parse_encoding): Handle synthetic fonts.
+
2003-09-29 Werner Lemberg <wl@gnu.org>
* include/freetype/internal/t1types.h: Don't include
diff --git a/src/cid/cidload.c b/src/cid/cidload.c
index 7b0aba6..32c4a0d 100644
--- a/src/cid/cidload.c
+++ b/src/cid/cidload.c
@@ -191,7 +191,7 @@
offset->y = temp[5] >> 16;
}
- return CID_Err_Ok; /* this is a callback function; */
+ return CID_Err_Ok; /* this is a callback function; */
/* we must return an error code */
}
@@ -265,7 +265,7 @@
FT_Byte* limit = cur + size;
- for ( ;cur < limit; cur++ )
+ for ( ; cur < limit; cur++ )
{
/* look for `%ADOBeginFontDict' */
if ( *cur == '%' && cur + 20 < limit &&
@@ -281,7 +281,7 @@
/* look for immediates */
else if ( *cur == '/' && cur + 2 < limit )
{
- FT_Int len;
+ FT_PtrDist len;
cur++;
@@ -289,11 +289,11 @@
parser->root.cursor = cur;
cid_parser_skip_alpha( parser );
- len = (FT_Int)( parser->root.cursor - cur );
+ len = parser->root.cursor - cur;
if ( len > 0 && len < 22 )
{
/* now compare the immediate name to the keyword table */
- T1_Field keyword = (T1_Field) cid_field_records;
+ T1_Field keyword = (T1_Field)cid_field_records;
for (;;)
@@ -303,12 +303,15 @@
name = (FT_Byte*)keyword->ident;
if ( !name )
+ {
+ cid_parser_skip_alpha( parser );
break;
+ }
- if ( cur[0] == name[0] &&
- len == (FT_Int)ft_strlen( (const char*)name ) )
+ if ( cur[0] == name[0] &&
+ len == ft_strlen( (const char*)name ) )
{
- FT_Int n;
+ FT_PtrDist n;
for ( n = 1; n < len; n++ )
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index cf12c5a..d785aec 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -65,41 +65,28 @@
/*************************************************************************/
-#define IS_T1_WHITESPACE( c ) ( (c) == ' ' || (c) == '\t' )
-#define IS_T1_LINESPACE( c ) ( (c) == '\r' || (c) == '\n' )
-
-#define IS_T1_SPACE( c ) ( IS_T1_WHITESPACE( c ) || IS_T1_LINESPACE( c ) )
-
-
- typedef struct PFB_Tag_
- {
- FT_UShort tag;
- FT_Long size;
-
- } PFB_Tag;
-
-
static FT_Error
read_pfb_tag( FT_Stream stream,
- FT_UShort* tag,
- FT_Long* size )
+ FT_UShort *atag,
+ FT_Long *asize )
{
- FT_Error error;
- PFB_Tag head;
+ FT_Error error;
+ FT_UShort tag;
+ FT_Long size;
- *tag = 0;
- *size = 0;
+ *atag = 0;
+ *asize = 0;
- if ( !FT_READ_USHORT( head.tag ) )
+ if ( !FT_READ_USHORT( tag ) )
{
- if ( head.tag == 0x8001U || head.tag == 0x8002U )
+ if ( tag == 0x8001U || tag == 0x8002U )
{
- if ( !FT_READ_LONG_LE( head.size ) )
- *size = head.size;
+ if ( !FT_READ_LONG_LE( size ) )
+ *asize = size;
}
- *tag = head.tag;
+ *atag = tag;
}
return error;
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index ae4b7fc..071c6ec 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -158,8 +158,8 @@
/* When creating a new Type 42 parser, we try to locate and load */
/* the base dictionary, loading the whole font into memory. */
/* */
- /* When `loading' the base dictionary, we only setup pointers in */
- /* the case of a memory-based stream. Otherwise, we allocate */
+ /* When `loading' the base dictionary, we only set up pointers */
+ /* in the case of a memory-based stream. Otherwise, we allocate */
/* and load the base dictionary in it. */
/* */
/* parser->in_memory is set if we have a memory stream. */
@@ -245,7 +245,7 @@
static int
t42_is_space( FT_Byte c )
{
- return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' );
+ return ( c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f' );
}
@@ -327,6 +327,10 @@
FT_Error error;
+ if ( encode->char_index )
+ /* with synthetic fonts, it's possible we get here twice */
+ return;
+
/* read the number of entries in the encoding, should be 256 */
count = (FT_Int)T1_ToInt( parser );
if ( parser->root.error )
@@ -407,14 +411,14 @@
{
/* bingo, we have an immediate name -- it must be a */
/* character name */
- FT_Byte* cur2 = cur + 1;
- FT_Int len;
+ FT_Byte* cur2 = cur + 1;
+ FT_PtrDist len;
while ( cur2 < limit && t42_is_alpha( *cur2 ) )
cur2++;
- len = (FT_Int)( cur2 - cur - 1 );
+ len = cur2 - cur - 1;
parser->root.error = T1_Add_Table( char_table, charcode,
cur + 1, len + 1 );