* 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.
This commit is contained in:
parent
4187e61bfe
commit
5972e9abf8
31
ChangeLog
31
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>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
decoder->builder.left_bearing.x = 0;
|
||||
decoder->builder.left_bearing.y = 0;
|
||||
builder->left_bearing.x = 0;
|
||||
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;
|
||||
}
|
||||
|
||||
if ( !error )
|
||||
error = CFF_Err_Ok;
|
||||
|
||||
cff_builder_close_contour( builder );
|
||||
|
||||
/* close hints recording session */
|
||||
if ( hinter )
|
||||
else
|
||||
{
|
||||
if (hinter->close( hinter->hints, builder->current->n_points ) )
|
||||
goto Syntax_Error;
|
||||
if ( !error )
|
||||
error = CFF_Err_Ok;
|
||||
|
||||
/* apply hints to the loaded glyph outline now */
|
||||
hinter->apply( hinter->hints,
|
||||
builder->current,
|
||||
(PSH_Globals)builder->hints_globals,
|
||||
decoder->hint_mode );
|
||||
cff_builder_close_contour( builder );
|
||||
|
||||
/* 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 );
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue