* src/cff/cffgload.c (cff_operator_seac): Fix magnitude of accent offset. Update code similarly to the seac support for Type 1 fonts. (cff_decoder_parse_charstrings) <cff_op_endchar>: Fix magnitude of accent offset. Don't hint glyphs twice if seac is emulated. <cff_op_flex>: Assign correct point tags. * docs/CHANGES: Updated. * src/type1/t1parse.c (T1_Get_Private_Dict): Use FT_MEM_MOVE, not FT_MEM_COPY, for copying the private dict. * src/type1/t1load.c (parse_subrs): Assign number of subrs only in first run. (parse_charstrings): Parse /CharStrings in second run without assigning values. (parse_dict): Skip all /CharStrings arrays but the first. We need this for non-standard fonts like `Optima' which have different outlines depending on the resolution. Note that there is no guarantee that we get fitting /Subrs and /CharStrings arrays; this can only be done by a real PS interpreter.
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 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442
diff --git a/ChangeLog b/ChangeLog
index fd77628..42fd661 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,34 @@
+2004-01-31 Werner Lemberg <wl@gnu.org>
+
+ * src/cff/cffgload.c (cff_operator_seac): Fix magnitude of
+ accent offset.
+ Update code similarly to the seac support for Type 1 fonts.
+ (cff_decoder_parse_charstrings) <cff_op_endchar>: Fix magnitude
+ of accent offset.
+ Don't hint glyphs twice if seac is emulated.
+ <cff_op_flex>: Assign correct point tags.
+ * docs/CHANGES: Updated.
+
+2004-01-30 Werner Lemberg <wl@gnu.org>
+
+ * src/type1/t1parse.c (T1_Get_Private_Dict): Use FT_MEM_MOVE, not
+ FT_MEM_COPY, for copying the private dict.
+
+ * src/type1/t1load.c (parse_subrs): Assign number of subrs only
+ in first run.
+ (parse_charstrings): Parse /CharStrings in second run without
+ assigning values.
+ (parse_dict): Skip all /CharStrings arrays but the first. We need
+ this for non-standard fonts like `Optima' which have different
+ outlines depending on the resolution. Note that there is no
+ guarantee that we get fitting /Subrs and /CharStrings arrays; this
+ can only be done by a real PS interpreter.
+
2004-01-29 Antoine Leca <Antoine-Freetype@Leca-Marti.org>
- * builds/win32/visualc/index.html: detailled explanations
- about forcing CR+LF line endings for the VC++ project files.
+ * builds/win32/visualc/index.html: New file, giving detailed
+ explanations about forcing CR+LF line endings for the VC++ project
+ files.
2004-01-22 Garrick Meeker <garrick@digitalanarchy.com>
diff --git a/docs/CHANGES b/docs/CHANGES
index 00f64bd..ddcc31e 100644
--- a/docs/CHANGES
+++ b/docs/CHANGES
@@ -27,6 +27,10 @@ LATEST CHANGES BETWEEN 2.1.8 and 2.1.7
- The descender metrics (face->size->metrics.descender) for WinFNT
bitmap fonts had the wrong sign.
+ - The (emulated) seac support for CFF fonts was broken.
+
+ - The flex operator didn't work for CFF fonts.
+
II. IMPORTANT CHANGES
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index a44f4e1..af2b206 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -4,7 +4,7 @@
/* */
/* OpenType Glyph Loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -644,13 +644,13 @@
FT_Int bchar,
FT_Int achar )
{
- FT_Error error;
- FT_Int bchar_index, achar_index, n_base_points;
- FT_Outline* base = decoder->builder.base;
- TT_Face face = decoder->builder.face;
- FT_Vector left_bearing, advance;
- FT_Byte* charstring;
- FT_ULong charstring_len;
+ FT_Error error;
+ CFF_Builder* builder = &decoder->builder;
+ FT_Int bchar_index, achar_index;
+ TT_Face face = decoder->builder.face;
+ FT_Vector left_bearing, advance;
+ FT_Byte* charstring;
+ FT_ULong charstring_len;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
@@ -680,9 +680,9 @@
/* If we are trying to load a composite glyph, do not load the */
/* accent character and return the array of subglyphs. */
- if ( decoder->builder.no_recurse )
+ if ( builder->no_recurse )
{
- FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
+ FT_GlyphSlot glyph = (FT_GlyphSlot)builder->glyph;
FT_GlyphLoader loader = glyph->internal->loader;
FT_SubGlyph subg;
@@ -705,8 +705,8 @@
/* subglyph 1 = accent character */
subg->index = achar_index;
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
- subg->arg1 = (FT_Int)adx;
- subg->arg2 = (FT_Int)ady;
+ subg->arg1 = (FT_Int)( adx >> 16 );
+ subg->arg2 = (FT_Int)( ady >> 16 );
/* set up remaining glyph fields */
glyph->num_subglyphs = 2;
@@ -716,6 +716,8 @@
loader->current.num_subglyphs = 2;
}
+ FT_GlyphLoader_Prepare( builder->loader );
+
/* First load `bchar' in builder */
error = cff_get_glyph_data( face, bchar_index,
&charstring, &charstring_len );
@@ -730,16 +732,17 @@
cff_free_glyph_data( face, &charstring, charstring_len );
}
- n_base_points = base->n_points;
-
/* Save the left bearing and width of the base character */
/* as they will be erased by the next load. */
- left_bearing = decoder->builder.left_bearing;
- advance = decoder->builder.advance;
+ left_bearing = builder->left_bearing;
+ advance = builder->advance;
+
+ builder->left_bearing.x = 0;
+ builder->left_bearing.y = 0;
- decoder->builder.left_bearing.x = 0;
- decoder->builder.left_bearing.y = 0;
+ builder->pos_x = adx;
+ builder->pos_y = ady;
/* Now load `achar' on top of the base outline. */
error = cff_get_glyph_data( face, achar_index,
@@ -757,20 +760,11 @@
/* Restore the left side bearing and advance width */
/* of the base character. */
- decoder->builder.left_bearing = left_bearing;
- decoder->builder.advance = advance;
+ builder->left_bearing = left_bearing;
+ builder->advance = advance;
- /* Finally, move the accent. */
- if ( decoder->builder.load_points )
- {
- FT_Outline dummy;
-
-
- dummy.n_points = (short)( base->n_points - n_base_points );
- dummy.points = base->points + n_base_points;
-
- FT_Outline_Translate( &dummy, adx, ady );
- }
+ builder->pos_x = 0;
+ builder->pos_y = 0;
Exit:
return error;
@@ -1736,7 +1730,7 @@
x += args[0];
y += args[1];
cff_builder_add_point( builder, x, y,
- (FT_Bool)( count == 3 || count == 0 ) );
+ (FT_Bool)( count == 4 || count == 1 ) );
args += 2;
}
@@ -1751,34 +1745,36 @@
if ( num_args == 4 )
{
error = cff_operator_seac( decoder,
- args[0] >> 16,
- args[1] >> 16,
+ args[0],
+ args[1],
(FT_Int)( args[2] >> 16 ),
(FT_Int)( args[3] >> 16 ) );
args += 4;
}
+ else
+ {
+ if ( !error )
+ error = CFF_Err_Ok;
- if ( !error )
- error = CFF_Err_Ok;
-
- cff_builder_close_contour( builder );
+ cff_builder_close_contour( builder );
- /* close hints recording session */
- if ( hinter )
- {
- if (hinter->close( hinter->hints, builder->current->n_points ) )
- goto Syntax_Error;
+ /* close hints recording session */
+ if ( hinter )
+ {
+ if (hinter->close( hinter->hints, builder->current->n_points ) )
+ goto Syntax_Error;
+
+ /* apply hints to the loaded glyph outline now */
+ hinter->apply( hinter->hints,
+ builder->current,
+ (PSH_Globals)builder->hints_globals,
+ decoder->hint_mode );
+ }
- /* apply hints to the loaded glyph outline now */
- hinter->apply( hinter->hints,
- builder->current,
- (PSH_Globals)builder->hints_globals,
- decoder->hint_mode );
+ /* add current outline to the glyph slot */
+ FT_GlyphLoader_Add( builder->loader );
}
- /* add current outline to the glyph slot */
- FT_GlyphLoader_Add( builder->loader );
-
/* return now! */
FT_TRACE4(( "\n\n" ));
return error;
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index a982d6f..db1911e 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
/* */
/* PostScript Type 1 decoding routines (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003 by */
+/* Copyright 2000-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -262,10 +262,6 @@
if ( error )
goto Exit;
-#if 0
- n_base_points = base->n_points;
-#endif
-
/* save the left bearing and width of the base character */
/* as they will be erased by the next load. */
@@ -290,23 +286,8 @@
decoder->builder.left_bearing = left_bearing;
decoder->builder.advance = advance;
- /* XXX: old code doesn't work with PostScript hinter */
-#if 0
- /* Finally, move the accent */
- if ( decoder->builder.load_points )
- {
- FT_Outline dummy;
-
-
- dummy.n_points = (short)( base->n_points - n_base_points );
- dummy.points = base->points + n_base_points;
-
- FT_Outline_Translate( &dummy, adx - asb, ady );
- }
-#else
decoder->builder.pos_x = 0;
decoder->builder.pos_y = 0;
-#endif
Exit:
return error;
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index 6d0799e..0b571c7 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 font loader (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -1155,7 +1155,8 @@
goto Fail;
}
- loader->num_subrs = num_subrs;
+ if ( !loader->num_subrs )
+ loader->num_subrs = num_subrs;
return;
@@ -1182,12 +1183,12 @@
FT_Byte* cur;
FT_Byte* limit = parser->root.limit;
- FT_Int n;
+ FT_Int n, num_glyphs;
FT_UInt notdef_index = 0;
FT_Byte notdef_found = 0;
- loader->num_glyphs = (FT_Int)T1_ToInt( parser );
+ num_glyphs = (FT_Int)T1_ToInt( parser );
if ( parser->root.error )
return;
@@ -1195,22 +1196,28 @@
/* if necessary, and a few other glyphs to handle buggy */
/* fonts which have more glyphs than specified. */
- error = psaux->ps_table_funcs->init(
- code_table, loader->num_glyphs + 1 + TABLE_EXTEND, memory );
- if ( error )
- goto Fail;
+ /* for some non-standard fonts like `Optima' which provides */
+ /* different outlines depending on the resolution it is */
+ /* possible to get here twice */
+ if ( !loader->num_glyphs )
+ {
+ error = psaux->ps_table_funcs->init(
+ code_table, num_glyphs + 1 + TABLE_EXTEND, memory );
+ if ( error )
+ goto Fail;
- error = psaux->ps_table_funcs->init(
- name_table, loader->num_glyphs + 1 + TABLE_EXTEND, memory );
- if ( error )
- goto Fail;
+ error = psaux->ps_table_funcs->init(
+ name_table, num_glyphs + 1 + TABLE_EXTEND, memory );
+ if ( error )
+ goto Fail;
- /* Initialize table for swapping index notdef_index and */
- /* index 0 names and codes (if necessary). */
+ /* Initialize table for swapping index notdef_index and */
+ /* index 0 names and codes (if necessary). */
- error = psaux->ps_table_funcs->init( swap_table, 4, memory );
- if ( error )
- goto Fail;
+ error = psaux->ps_table_funcs->init( swap_table, 4, memory );
+ if ( error )
+ goto Fail;
+ }
n = 0;
@@ -1259,6 +1266,15 @@
cur++; /* skip `/' */
len = parser->root.cursor - cur;
+ if ( !read_binary_data( parser, &size, &base ) )
+ return;
+
+ /* for some non-standard fonts like `Optima' which provides */
+ /* different outlines depending on the resolution it is */
+ /* possible to get here twice */
+ if ( loader->num_glyphs )
+ continue;
+
error = T1_Add_Table( name_table, n, cur, len + 1 );
if ( error )
goto Fail;
@@ -1275,11 +1291,8 @@
notdef_found = 1;
}
- if ( !read_binary_data( parser, &size, &base ) )
- return;
-
if ( face->type1.private_dict.lenIV >= 0 &&
- n < loader->num_glyphs + TABLE_EXTEND )
+ n < num_glyphs + TABLE_EXTEND )
{
FT_Byte* temp;
@@ -1303,7 +1316,10 @@
}
}
- loader->num_glyphs = n;
+ if ( loader->num_glyphs )
+ return;
+ else
+ loader->num_glyphs = n;
/* if /.notdef is found but does not occupy index 0, do our magic. */
if ( ft_strcmp( (const char*)".notdef",
@@ -1576,9 +1592,11 @@
/* We found it -- run the parsing callback! */
/* We only record the first instance of any */
/* field to deal adequately with synthetic */
- /* fonts; /Subrs is handled specially. */
- if ( keyword_flag[0] == 0 ||
- ft_strcmp( (const char*)name, "Subrs" ) == 0 )
+ /* fonts; /Subrs and /CharStrings are */
+ /* handled specially. */
+ if ( keyword_flag[0] == 0 ||
+ ft_strcmp( (const char*)name, "Subrs" ) == 0 ||
+ ft_strcmp( (const char*)name, "CharStrings") == 0 )
{
parser->root.error = t1_load_keyword( face,
loader,
diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c
index 885d60a..544aa09 100644
--- a/src/type1/t1parse.c
+++ b/src/type1/t1parse.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 parser (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003 by */
+/* Copyright 1996-2001, 2002, 2003, 2004 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -418,7 +418,7 @@
}
else
/* binary encoding -- copy the private dict */
- FT_MEM_COPY( parser->private_dict, cur, size );
+ FT_MEM_MOVE( parser->private_dict, cur, size );
}
/* we now decrypt the encoded binary private dictionary */