2018-06-03 09:01:17 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
|
|
|
* t1decode.c
|
|
|
|
*
|
|
|
|
* PostScript Type 1 decoding routines (body).
|
|
|
|
*
|
2023-01-17 09:18:25 +01:00
|
|
|
* Copyright (C) 2000-2023 by
|
2018-06-03 09:01:17 +02:00
|
|
|
* David Turner, Robert Wilhelm, and Werner Lemberg.
|
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
2000-08-23 19:32:42 +02:00
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2020-06-08 13:31:55 +02:00
|
|
|
#include <freetype/internal/ftcalc.h>
|
|
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
#include <freetype/internal/pshints.h>
|
|
|
|
#include <freetype/internal/fthash.h>
|
|
|
|
#include <freetype/ftoutln.h>
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "t1decode.h"
|
|
|
|
#include "psobjs.h"
|
2000-09-26 15:25:15 +02:00
|
|
|
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
#include "psauxerr.h"
|
|
|
|
|
2021-11-22 19:36:45 +01:00
|
|
|
|
2011-07-14 07:35:51 +02:00
|
|
|
/* ensure proper sign extension */
|
2021-11-22 19:36:45 +01:00
|
|
|
#define Fix2Int( f ) ( (FT_Int) (FT_Short)( (f) >> 16 ) )
|
2021-10-11 05:12:12 +02:00
|
|
|
#define Fix2UInt( f ) ( (FT_UInt)(FT_Short)( (f) >> 16 ) )
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2021-11-22 19:36:45 +01:00
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* The macro FT_COMPONENT is used in trace mode. It is an implicit
|
|
|
|
* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log
|
|
|
|
* messages during execution.
|
|
|
|
*/
|
2000-08-23 00:36:33 +02:00
|
|
|
#undef FT_COMPONENT
|
2018-08-15 18:13:17 +02:00
|
|
|
#define FT_COMPONENT t1decode
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
typedef enum T1_Operator_
|
|
|
|
{
|
|
|
|
op_none = 0,
|
|
|
|
op_endchar,
|
|
|
|
op_hsbw,
|
|
|
|
op_seac,
|
|
|
|
op_sbw,
|
|
|
|
op_closepath,
|
|
|
|
op_hlineto,
|
|
|
|
op_hmoveto,
|
|
|
|
op_hvcurveto,
|
|
|
|
op_rlineto,
|
|
|
|
op_rmoveto,
|
|
|
|
op_rrcurveto,
|
|
|
|
op_vhcurveto,
|
|
|
|
op_vlineto,
|
|
|
|
op_vmoveto,
|
|
|
|
op_dotsection,
|
|
|
|
op_hstem,
|
|
|
|
op_hstem3,
|
|
|
|
op_vstem,
|
|
|
|
op_vstem3,
|
|
|
|
op_div,
|
|
|
|
op_callothersubr,
|
|
|
|
op_callsubr,
|
|
|
|
op_pop,
|
|
|
|
op_return,
|
|
|
|
op_setcurrentpoint,
|
2006-06-26 21:12:51 +02:00
|
|
|
op_unknown15,
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
op_max /* never remove this one */
|
|
|
|
|
|
|
|
} T1_Operator;
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
static
|
|
|
|
const FT_Int t1_args_count[op_max] =
|
|
|
|
{
|
|
|
|
0, /* none */
|
|
|
|
0, /* endchar */
|
|
|
|
2, /* hsbw */
|
|
|
|
5, /* seac */
|
|
|
|
4, /* sbw */
|
|
|
|
0, /* closepath */
|
|
|
|
1, /* hlineto */
|
|
|
|
1, /* hmoveto */
|
|
|
|
4, /* hvcurveto */
|
|
|
|
2, /* rlineto */
|
|
|
|
2, /* rmoveto */
|
|
|
|
6, /* rrcurveto */
|
|
|
|
4, /* vhcurveto */
|
|
|
|
1, /* vlineto */
|
|
|
|
1, /* vmoveto */
|
|
|
|
0, /* dotsection */
|
|
|
|
2, /* hstem */
|
|
|
|
6, /* hstem3 */
|
|
|
|
2, /* vstem */
|
|
|
|
6, /* vstem3 */
|
|
|
|
2, /* div */
|
|
|
|
-1, /* callothersubr */
|
|
|
|
1, /* callsubr */
|
|
|
|
0, /* pop */
|
|
|
|
0, /* return */
|
2006-06-26 21:12:51 +02:00
|
|
|
2, /* setcurrentpoint */
|
|
|
|
2 /* opcode 15 (undocumented and obsolete) */
|
2000-08-23 00:36:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @Function:
|
|
|
|
* t1_lookup_glyph_by_stdcharcode_ps
|
|
|
|
*
|
|
|
|
* @Description:
|
|
|
|
* Looks up a given glyph by its StandardEncoding charcode. Used to
|
|
|
|
* implement the SEAC Type 1 operator in the Adobe engine
|
|
|
|
*
|
|
|
|
* @Input:
|
|
|
|
* face ::
|
|
|
|
* The current face object.
|
|
|
|
*
|
|
|
|
* charcode ::
|
|
|
|
* The character code to look for.
|
|
|
|
*
|
|
|
|
* @Return:
|
|
|
|
* A glyph index in the font face. Returns -1 if the corresponding
|
|
|
|
* glyph wasn't found.
|
|
|
|
*/
|
2017-09-25 08:04:09 +02:00
|
|
|
FT_LOCAL_DEF( FT_Int )
|
|
|
|
t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder,
|
|
|
|
FT_Int charcode )
|
|
|
|
{
|
|
|
|
FT_UInt n;
|
|
|
|
const FT_String* glyph_name;
|
|
|
|
FT_Service_PsCMaps psnames = decoder->psnames;
|
|
|
|
|
|
|
|
|
|
|
|
/* check range of standard char code */
|
|
|
|
if ( charcode < 0 || charcode > 255 )
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
glyph_name = psnames->adobe_std_strings(
|
|
|
|
psnames->adobe_std_encoding[charcode]);
|
|
|
|
|
|
|
|
for ( n = 0; n < decoder->num_glyphs; n++ )
|
|
|
|
{
|
|
|
|
FT_String* name = (FT_String*)decoder->glyph_names[n];
|
|
|
|
|
|
|
|
|
|
|
|
if ( name &&
|
|
|
|
name[0] == glyph_name[0] &&
|
|
|
|
ft_strcmp( name, glyph_name ) == 0 )
|
|
|
|
return (FT_Int)n;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.
This controls whether the old Type 1 engine gets compiled into FreeType.
It is disabled by default.
* devel/ftoption.h, include/freetype/config/ftoption.h
(T1_CONFIG_OPTION_OLD_ENGINE): New macro.
* include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
* include/freetype/internal/psaux.h, src/cid/cidgload.c
(cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
(ps_builder_add_point), src/psaux/t1decode.c
(t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
relevant code with macro.
Minor code changes.
2017-10-12 12:13:21 +02:00
|
|
|
#ifdef T1_CONFIG_OPTION_OLD_ENGINE
|
2018-07-27 09:15:43 +02:00
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @Function:
|
|
|
|
* t1_lookup_glyph_by_stdcharcode
|
|
|
|
*
|
|
|
|
* @Description:
|
|
|
|
* Looks up a given glyph by its StandardEncoding charcode. Used to
|
|
|
|
* implement the SEAC Type 1 operator.
|
|
|
|
*
|
|
|
|
* @Input:
|
|
|
|
* face ::
|
|
|
|
* The current face object.
|
|
|
|
*
|
|
|
|
* charcode ::
|
|
|
|
* The character code to look for.
|
|
|
|
*
|
|
|
|
* @Return:
|
|
|
|
* A glyph index in the font face. Returns -1 if the corresponding
|
|
|
|
* glyph wasn't found.
|
|
|
|
*/
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Int
|
2002-02-28 17:10:29 +01:00
|
|
|
t1_lookup_glyph_by_stdcharcode( T1_Decoder decoder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Int charcode )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2003-09-29 22:33:37 +02:00
|
|
|
FT_UInt n;
|
|
|
|
const FT_String* glyph_name;
|
* include/freetype/internal/bdftypes.h: removed obsolete header
* include/freetype/internal/cfftypes.h, src/cff/cfftypes.h,
src/cff/cffload.h, src/cff/cffobjs.h, src/cff/cffparse.h,
include/freetype/internal/services/svbdf.h: moving "cfftypes.h" from
'include/freetype/internal' to 'src/cff' since no other modules needs
to known about these types
* include/freetype/internal/t42types.h,
include/freetype/internal/internal.h, src/type42/t42objs.h,
src/type42/t42drivr.c, src/type42/t42types.h: moving "t42types.h" from
'include/freetype/internal' to 'src/type42' since no other modules needs
to known about these types
* src/gzip/infblock.c: removing compiler warning
* include/freetype/internal/services/svpsinfo.h,
include/freetype/internal/ftserv.h, src/cff/cffdrivr.c,
src/cid/ciddrivr.c, src/type1/t1driver.c, src/type42/t42drivr.c,
src/base/fttype1.c: migrating to FT_SERVICE_ID_POSTSCRIPT_INFO defined
in "svpsinfo.h", removing some sad hacks.
2003-10-29 22:43:52 +01:00
|
|
|
FT_Service_PsCMaps psnames = decoder->psnames;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* check range of standard char code */
|
|
|
|
if ( charcode < 0 || charcode > 255 )
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
glyph_name = psnames->adobe_std_strings(
|
|
|
|
psnames->adobe_std_encoding[charcode]);
|
|
|
|
|
|
|
|
for ( n = 0; n < decoder->num_glyphs; n++ )
|
|
|
|
{
|
|
|
|
FT_String* name = (FT_String*)decoder->glyph_names[n];
|
|
|
|
|
|
|
|
|
2009-06-25 21:31:53 +02:00
|
|
|
if ( name &&
|
|
|
|
name[0] == glyph_name[0] &&
|
2003-10-07 22:06:35 +02:00
|
|
|
ft_strcmp( name, glyph_name ) == 0 )
|
2015-02-25 11:20:20 +01:00
|
|
|
return (FT_Int)n;
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.
This controls whether the old Type 1 engine gets compiled into FreeType.
It is disabled by default.
* devel/ftoption.h, include/freetype/config/ftoption.h
(T1_CONFIG_OPTION_OLD_ENGINE): New macro.
* include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
* include/freetype/internal/psaux.h, src/cid/cidgload.c
(cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
(ps_builder_add_point), src/psaux/t1decode.c
(t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
relevant code with macro.
Minor code changes.
2017-10-12 12:13:21 +02:00
|
|
|
/* parse a single Type 1 glyph */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
t1_decoder_parse_glyph( T1_Decoder decoder,
|
|
|
|
FT_UInt glyph )
|
|
|
|
{
|
|
|
|
return decoder->parse_callback( decoder, glyph );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @Function:
|
|
|
|
* t1operator_seac
|
|
|
|
*
|
|
|
|
* @Description:
|
|
|
|
* Implements the `seac' Type 1 operator for a Type 1 decoder.
|
|
|
|
*
|
|
|
|
* @Input:
|
|
|
|
* decoder ::
|
|
|
|
* The current CID decoder.
|
|
|
|
*
|
|
|
|
* asb ::
|
|
|
|
* The accent's side bearing.
|
|
|
|
*
|
|
|
|
* adx ::
|
|
|
|
* The horizontal offset of the accent.
|
|
|
|
*
|
|
|
|
* ady ::
|
|
|
|
* The vertical offset of the accent.
|
|
|
|
*
|
|
|
|
* bchar ::
|
|
|
|
* The base character's StandardEncoding charcode.
|
|
|
|
*
|
|
|
|
* achar ::
|
|
|
|
* The accent character's StandardEncoding charcode.
|
|
|
|
*
|
|
|
|
* @Return:
|
|
|
|
* FreeType error code. 0 means success.
|
|
|
|
*/
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Error
|
2002-02-28 17:10:29 +01:00
|
|
|
t1operator_seac( T1_Decoder decoder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Pos asb,
|
|
|
|
FT_Pos adx,
|
|
|
|
FT_Pos ady,
|
|
|
|
FT_Int bchar,
|
|
|
|
FT_Int achar )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
2002-02-19 17:30:15 +01:00
|
|
|
FT_Int bchar_index, achar_index;
|
|
|
|
#if 0
|
|
|
|
FT_Int n_base_points;
|
2000-08-23 00:36:33 +02:00
|
|
|
FT_Outline* base = decoder->builder.base;
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2000-08-23 00:36:33 +02:00
|
|
|
FT_Vector left_bearing, advance;
|
|
|
|
|
2009-06-28 00:43:37 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
|
|
|
T1_Face face = (T1_Face)decoder->builder.face;
|
2012-01-16 18:00:24 +01:00
|
|
|
#endif
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2009-06-28 01:25:55 +02:00
|
|
|
|
|
|
|
if ( decoder->seac )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1operator_seac: invalid nested seac\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Syntax_Error );
|
2009-06-28 01:25:55 +02:00
|
|
|
}
|
|
|
|
|
2012-07-18 10:39:18 +02:00
|
|
|
if ( decoder->builder.metrics_only )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1operator_seac: unexpected seac\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Syntax_Error );
|
2012-07-18 10:39:18 +02:00
|
|
|
}
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* seac weirdness */
|
|
|
|
adx += decoder->builder.left_bearing.x;
|
|
|
|
|
2000-08-24 18:29:15 +02:00
|
|
|
/* `glyph_names' is set to 0 for CID fonts which do not */
|
|
|
|
/* include an encoding. How can we deal with these? */
|
2010-01-05 10:10:15 +01:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2010-01-05 09:43:01 +01:00
|
|
|
if ( decoder->glyph_names == 0 &&
|
|
|
|
!face->root.internal->incremental_interface )
|
2010-01-05 10:10:15 +01:00
|
|
|
#else
|
|
|
|
if ( decoder->glyph_names == 0 )
|
|
|
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
2000-08-24 00:47:44 +02:00
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1operator_seac:"
|
2009-06-26 06:15:41 +02:00
|
|
|
" glyph names table not available in this font\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Syntax_Error );
|
2000-08-24 00:47:44 +02:00
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2009-04-30 20:32:31 +02:00
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2009-06-28 00:43:37 +02:00
|
|
|
if ( face->root.internal->incremental_interface )
|
|
|
|
{
|
|
|
|
/* the caller must handle the font encoding also */
|
|
|
|
bchar_index = bchar;
|
|
|
|
achar_index = achar;
|
|
|
|
}
|
|
|
|
else
|
2009-04-30 20:32:31 +02:00
|
|
|
#endif
|
2009-06-28 00:43:37 +02:00
|
|
|
{
|
|
|
|
bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );
|
|
|
|
achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar );
|
|
|
|
}
|
2009-04-30 20:32:31 +02:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( bchar_index < 0 || achar_index < 0 )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1operator_seac:"
|
|
|
|
" invalid seac character code arguments\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Syntax_Error );
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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 )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
|
|
|
|
FT_GlyphLoader loader = glyph->internal->loader;
|
2002-03-14 13:56:35 +01:00
|
|
|
FT_SubGlyph subg;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* reallocate subglyph array if necessary */
|
2002-03-14 13:56:35 +01:00
|
|
|
error = FT_GlyphLoader_CheckSubGlyphs( loader, 2 );
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
subg = loader->current.subglyphs;
|
|
|
|
|
|
|
|
/* subglyph 0 = base character */
|
|
|
|
subg->index = bchar_index;
|
|
|
|
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
|
|
|
|
FT_SUBGLYPH_FLAG_USE_MY_METRICS;
|
|
|
|
subg->arg1 = 0;
|
|
|
|
subg->arg2 = 0;
|
|
|
|
subg++;
|
|
|
|
|
|
|
|
/* subglyph 1 = accent character */
|
|
|
|
subg->index = achar_index;
|
|
|
|
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
subg->arg1 = (FT_Int)FIXED_TO_INT( adx - asb );
|
|
|
|
subg->arg2 = (FT_Int)FIXED_TO_INT( ady );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
/* set up remaining glyph fields */
|
|
|
|
glyph->num_subglyphs = 2;
|
|
|
|
glyph->subglyphs = loader->base.subglyphs;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
glyph->format = FT_GLYPH_FORMAT_COMPOSITE;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
loader->current.num_subglyphs = 2;
|
2001-10-18 13:49:26 +02:00
|
|
|
goto Exit;
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* First load `bchar' in builder */
|
|
|
|
/* now load the unscaled outline */
|
|
|
|
|
|
|
|
FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */
|
|
|
|
|
2019-07-04 14:28:04 +02:00
|
|
|
/* save the left bearing and width of the SEAC */
|
|
|
|
/* glyph as they will be erased by the next load */
|
|
|
|
|
|
|
|
left_bearing = decoder->builder.left_bearing;
|
|
|
|
advance = decoder->builder.advance;
|
|
|
|
|
2009-06-28 02:11:51 +02:00
|
|
|
/* the seac operator must not be nested */
|
|
|
|
decoder->seac = TRUE;
|
2015-02-25 11:20:20 +01:00
|
|
|
error = t1_decoder_parse_glyph( decoder, (FT_UInt)bchar_index );
|
2009-06-28 02:11:51 +02:00
|
|
|
decoder->seac = FALSE;
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2019-07-04 14:28:04 +02:00
|
|
|
/* If the SEAC glyph doesn't have a (H)SBW of its */
|
|
|
|
/* own use the values from the base glyph. */
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2019-07-04 14:28:04 +02:00
|
|
|
if ( decoder->builder.parse_state != T1_Parse_Have_Width )
|
|
|
|
{
|
|
|
|
left_bearing = decoder->builder.left_bearing;
|
|
|
|
advance = decoder->builder.advance;
|
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
decoder->builder.left_bearing.x = 0;
|
|
|
|
decoder->builder.left_bearing.y = 0;
|
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
decoder->builder.pos_x = adx - asb;
|
|
|
|
decoder->builder.pos_y = ady;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* Now load `achar' on top of */
|
|
|
|
/* the base outline */
|
2009-06-28 02:11:51 +02:00
|
|
|
|
|
|
|
/* the seac operator must not be nested */
|
|
|
|
decoder->seac = TRUE;
|
2015-02-25 11:20:20 +01:00
|
|
|
error = t1_decoder_parse_glyph( decoder, (FT_UInt)achar_index );
|
2009-06-28 02:11:51 +02:00
|
|
|
decoder->seac = FALSE;
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2019-07-04 14:28:04 +02:00
|
|
|
/* restore the left side bearing and advance width */
|
|
|
|
/* of the SEAC glyph or base character (saved above) */
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
decoder->builder.left_bearing = left_bearing;
|
|
|
|
decoder->builder.advance = advance;
|
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
decoder->builder.pos_x = 0;
|
|
|
|
decoder->builder.pos_y = 0;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @Function:
|
|
|
|
* t1_decoder_parse_charstrings
|
|
|
|
*
|
|
|
|
* @Description:
|
|
|
|
* Parses a given Type 1 charstrings program.
|
|
|
|
*
|
|
|
|
* @Input:
|
|
|
|
* decoder ::
|
|
|
|
* The current Type 1 decoder.
|
|
|
|
*
|
|
|
|
* charstring_base ::
|
|
|
|
* The base address of the charstring stream.
|
|
|
|
*
|
|
|
|
* charstring_len ::
|
|
|
|
* The length in bytes of the charstring stream.
|
|
|
|
*
|
|
|
|
* @Return:
|
|
|
|
* FreeType error code. 0 means success.
|
|
|
|
*/
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_decoder_parse_charstrings( T1_Decoder decoder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Byte* charstring_base,
|
|
|
|
FT_UInt charstring_len )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Error error;
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_Decoder_Zone zone;
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Byte* ip;
|
|
|
|
FT_Byte* limit;
|
2002-03-14 11:09:35 +01:00
|
|
|
T1_Builder builder = &decoder->builder;
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Pos x, y, orig_x, orig_y;
|
2006-06-26 21:12:51 +02:00
|
|
|
FT_Int known_othersubr_result_cnt = 0;
|
|
|
|
FT_Int unknown_othersubr_result_cnt = 0;
|
2009-06-20 09:31:19 +02:00
|
|
|
FT_Bool large_int;
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
FT_Fixed seed;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
T1_Hints_Funcs hinter;
|
2000-08-23 19:32:42 +02:00
|
|
|
|
2009-06-19 14:56:26 +02:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
FT_Bool bol = TRUE;
|
|
|
|
#endif
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
/* compute random seed from stack address of parameter */
|
2015-02-25 11:20:20 +01:00
|
|
|
seed = (FT_Fixed)( ( (FT_Offset)(char*)&seed ^
|
|
|
|
(FT_Offset)(char*)&decoder ^
|
|
|
|
(FT_Offset)(char*)&charstring_base ) &
|
|
|
|
FT_ULONG_MAX );
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
|
|
|
|
if ( seed == 0 )
|
|
|
|
seed = 0x7384;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* First of all, initialize the decoder */
|
|
|
|
decoder->top = decoder->stack;
|
|
|
|
decoder->zone = decoder->zones;
|
|
|
|
zone = decoder->zones;
|
|
|
|
|
2004-05-13 14:59:59 +02:00
|
|
|
builder->parse_state = T1_Parse_Start;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
hinter = (T1_Hints_Funcs)builder->hints_funcs;
|
2001-10-18 13:49:26 +02:00
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* a font that reads BuildCharArray without setting */
|
|
|
|
/* its values first is buggy, but ... */
|
2006-07-19 11:54:56 +02:00
|
|
|
FT_ASSERT( ( decoder->len_buildchar == 0 ) ==
|
2009-06-25 21:31:53 +02:00
|
|
|
( decoder->buildchar == NULL ) );
|
2006-07-19 11:54:56 +02:00
|
|
|
|
2011-07-22 05:24:11 +02:00
|
|
|
if ( decoder->buildchar && decoder->len_buildchar > 0 )
|
2016-09-28 19:10:52 +02:00
|
|
|
FT_ARRAY_ZERO( decoder->buildchar, decoder->len_buildchar );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
zone->base = charstring_base;
|
|
|
|
limit = zone->limit = charstring_base + charstring_len;
|
|
|
|
ip = zone->cursor = zone->base;
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
error = FT_Err_Ok;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
x = orig_x = builder->pos_x;
|
|
|
|
y = orig_y = builder->pos_y;
|
|
|
|
|
|
|
|
/* begin hints recording session, if any */
|
|
|
|
if ( hinter )
|
|
|
|
hinter->open( hinter->hints );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2009-06-20 09:31:19 +02:00
|
|
|
large_int = FALSE;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* now, execute loop */
|
|
|
|
while ( ip < limit )
|
|
|
|
{
|
|
|
|
FT_Long* top = decoder->top;
|
|
|
|
T1_Operator op = op_none;
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
FT_Int32 value = 0;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
FT_ASSERT( known_othersubr_result_cnt == 0 ||
|
|
|
|
unknown_othersubr_result_cnt == 0 );
|
|
|
|
|
2009-06-19 14:56:26 +02:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
if ( bol )
|
|
|
|
{
|
2020-08-28 06:26:38 +02:00
|
|
|
FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
|
2009-06-19 14:56:26 +02:00
|
|
|
bol = FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
2006-06-26 21:12:51 +02:00
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**********************************************************************
|
|
|
|
*
|
|
|
|
* Decode operator or operand
|
|
|
|
*
|
|
|
|
*/
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
/* first of all, decompress operator or value */
|
|
|
|
switch ( *ip++ )
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
op = op_hstem;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
op = op_vstem;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
op = op_vmoveto;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
op = op_rlineto;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
op = op_hlineto;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
op = op_vlineto;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
op = op_rrcurveto;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
op = op_closepath;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
op = op_callsubr;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
op = op_return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 13:
|
|
|
|
op = op_hsbw;
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
op = op_endchar;
|
|
|
|
break;
|
|
|
|
|
2002-05-22 06:53:25 +02:00
|
|
|
case 15: /* undocumented, obsolete operator */
|
2006-06-26 21:12:51 +02:00
|
|
|
op = op_unknown15;
|
2002-05-22 06:53:25 +02:00
|
|
|
break;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
case 21:
|
|
|
|
op = op_rmoveto;
|
|
|
|
break;
|
|
|
|
case 22:
|
|
|
|
op = op_hmoveto;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 30:
|
|
|
|
op = op_vhcurveto;
|
|
|
|
break;
|
|
|
|
case 31:
|
|
|
|
op = op_hvcurveto;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 12:
|
2015-10-17 08:11:16 +02:00
|
|
|
if ( ip >= limit )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" invalid escape (12+EOF)\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ( *ip++ )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
op = op_dotsection;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
op = op_vstem3;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
op = op_hstem3;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
op = op_seac;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
op = op_sbw;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
op = op_div;
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
op = op_callothersubr;
|
|
|
|
break;
|
|
|
|
case 17:
|
|
|
|
op = op_pop;
|
|
|
|
break;
|
|
|
|
case 33:
|
|
|
|
op = op_setcurrentpoint;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" invalid escape (12+%d)\n",
|
2000-08-23 00:36:33 +02:00
|
|
|
ip[-1] ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 255: /* four bytes integer */
|
|
|
|
if ( ip + 4 > limit )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" unexpected EOF in integer\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2013-05-04 18:57:56 +02:00
|
|
|
value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
|
|
|
|
( (FT_UInt32)ip[1] << 16 ) |
|
|
|
|
( (FT_UInt32)ip[2] << 8 ) |
|
|
|
|
(FT_UInt32)ip[3] );
|
2000-08-23 00:36:33 +02:00
|
|
|
ip += 4;
|
2009-06-20 09:31:19 +02:00
|
|
|
|
|
|
|
/* According to the specification, values > 32000 or < -32000 must */
|
|
|
|
/* be followed by a `div' operator to make the result be in the */
|
|
|
|
/* range [-32000;32000]. We expect that the second argument of */
|
|
|
|
/* `div' is not a large number. Additionally, we don't handle */
|
|
|
|
/* stuff like `<large1> <large2> <num> div <num> div' or */
|
2009-06-23 15:48:52 +02:00
|
|
|
/* <large1> <large2> <num> div div'. This is probably not allowed */
|
|
|
|
/* anyway. */
|
2009-06-20 09:31:19 +02:00
|
|
|
if ( value > 32000 || value < -32000 )
|
|
|
|
{
|
|
|
|
if ( large_int )
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" no `div' after large integer\n" ));
|
2009-06-20 09:31:19 +02:00
|
|
|
else
|
|
|
|
large_int = TRUE;
|
|
|
|
}
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( !large_int )
|
2013-05-04 16:40:12 +02:00
|
|
|
value = (FT_Int32)( (FT_UInt32)value << 16 );
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
}
|
2009-06-20 09:31:19 +02:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ( ip[-1] >= 32 )
|
|
|
|
{
|
|
|
|
if ( ip[-1] < 247 )
|
2009-07-31 17:37:58 +02:00
|
|
|
value = (FT_Int32)ip[-1] - 139;
|
2000-08-23 00:36:33 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( ++ip > limit )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" unexpected EOF in integer\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2001-03-12 02:42:38 +01:00
|
|
|
if ( ip[-2] < 251 )
|
2013-05-04 16:40:12 +02:00
|
|
|
value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108;
|
2001-03-12 02:42:38 +01:00
|
|
|
else
|
2013-05-04 16:40:12 +02:00
|
|
|
value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 );
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
|
|
|
|
if ( !large_int )
|
2013-05-04 16:40:12 +02:00
|
|
|
value = (FT_Int32)( (FT_UInt32)value << 16 );
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" invalid byte (%d)\n", ip[-1] ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
if ( unknown_othersubr_result_cnt > 0 )
|
|
|
|
{
|
|
|
|
switch ( op )
|
|
|
|
{
|
|
|
|
case op_callsubr:
|
|
|
|
case op_return:
|
|
|
|
case op_none:
|
|
|
|
case op_pop:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* all operands have been transferred by previous pops */
|
|
|
|
unknown_othersubr_result_cnt = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-20 09:31:19 +02:00
|
|
|
if ( large_int && !( op == op_none || op == op_div ) )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" no `div' after large integer\n" ));
|
2009-06-20 09:31:19 +02:00
|
|
|
|
|
|
|
large_int = FALSE;
|
|
|
|
}
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**********************************************************************
|
|
|
|
*
|
|
|
|
* Push value on stack, or process operator
|
|
|
|
*
|
|
|
|
*/
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( op == op_none )
|
|
|
|
{
|
|
|
|
if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
|
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings: stack overflow\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
if ( large_int )
|
2017-01-03 00:27:07 +01:00
|
|
|
FT_TRACE4(( " %d", value ));
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
else
|
2017-01-03 00:27:07 +01:00
|
|
|
FT_TRACE4(( " %d", value / 65536 ));
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
#endif
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
*top++ = value;
|
|
|
|
decoder->top = top;
|
|
|
|
}
|
|
|
|
else if ( op == op_callothersubr ) /* callothersubr */
|
|
|
|
{
|
2006-06-26 21:12:51 +02:00
|
|
|
FT_Int subr_no;
|
|
|
|
FT_Int arg_cnt;
|
|
|
|
|
|
|
|
|
2009-06-19 14:56:26 +02:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
FT_TRACE4(( " callothersubr\n" ));
|
|
|
|
bol = TRUE;
|
|
|
|
#endif
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
if ( top - decoder->stack < 2 )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
top -= 2;
|
2006-06-26 21:12:51 +02:00
|
|
|
|
2011-07-14 07:35:51 +02:00
|
|
|
subr_no = Fix2Int( top[1] );
|
|
|
|
arg_cnt = Fix2Int( top[0] );
|
2006-06-26 21:12:51 +02:00
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/************************************************************
|
|
|
|
*
|
|
|
|
* remove all operands to callothersubr from the stack
|
|
|
|
*
|
|
|
|
* for handled othersubrs, where we know the number of
|
|
|
|
* arguments, we increase the stack by the value of
|
|
|
|
* known_othersubr_result_cnt
|
|
|
|
*
|
|
|
|
* for unhandled othersubrs the following pops adjust the
|
2018-06-04 15:12:29 +02:00
|
|
|
* stack pointer as necessary
|
2018-06-03 09:01:17 +02:00
|
|
|
*/
|
2006-06-26 21:12:51 +02:00
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
if ( arg_cnt > top - decoder->stack )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
top -= arg_cnt;
|
|
|
|
|
|
|
|
known_othersubr_result_cnt = 0;
|
|
|
|
unknown_othersubr_result_cnt = 0;
|
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* XXX TODO: The checks to `arg_count == <whatever>' */
|
|
|
|
/* might not be correct; an othersubr expects a certain */
|
|
|
|
/* number of operands on the PostScript stack (as opposed */
|
|
|
|
/* to the T1 stack) but it doesn't have to put them there */
|
|
|
|
/* by itself; previous othersubrs might have left the */
|
|
|
|
/* operands there if they were not followed by an */
|
|
|
|
/* appropriate number of pops */
|
|
|
|
/* */
|
|
|
|
/* On the other hand, Adobe Reader 7.0.8 for Linux doesn't */
|
|
|
|
/* accept a font that contains charstrings like */
|
|
|
|
/* */
|
|
|
|
/* 100 200 2 20 callothersubr */
|
|
|
|
/* 300 1 20 callothersubr pop */
|
|
|
|
/* */
|
|
|
|
/* Perhaps this is the reason why BuildCharArray exists. */
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
switch ( subr_no )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2011-07-14 07:21:11 +02:00
|
|
|
case 0: /* end flex feature */
|
|
|
|
if ( arg_cnt != 3 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2016-10-11 08:57:55 +02:00
|
|
|
if ( !decoder->flex_state ||
|
2011-07-14 07:21:11 +02:00
|
|
|
decoder->num_flex_vectors != 7 )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" unexpected flex end\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the two `results' are popped by the following setcurrentpoint */
|
|
|
|
top[0] = x;
|
|
|
|
top[1] = y;
|
|
|
|
known_othersubr_result_cnt = 2;
|
|
|
|
break;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
case 1: /* start flex feature */
|
2006-06-26 21:12:51 +02:00
|
|
|
if ( arg_cnt != 0 )
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
|
|
|
FT_SET_ERROR( t1_builder_check_points( builder, 6 ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2016-10-11 08:57:55 +02:00
|
|
|
|
|
|
|
decoder->flex_state = 1;
|
|
|
|
decoder->num_flex_vectors = 0;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* add flex vectors */
|
|
|
|
{
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
FT_Int idx;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
if ( arg_cnt != 0 )
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2016-10-11 08:57:55 +02:00
|
|
|
if ( !decoder->flex_state )
|
2011-10-01 09:25:55 +02:00
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" missing flex start\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* note that we should not add a point for index 0; */
|
|
|
|
/* this will move our current position to the flex */
|
|
|
|
/* point without adding any point to the outline */
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
idx = decoder->num_flex_vectors++;
|
|
|
|
if ( idx > 0 && idx < 7 )
|
2017-03-24 09:15:10 +01:00
|
|
|
{
|
|
|
|
/* in malformed fonts it is possible to have other */
|
|
|
|
/* opcodes in the middle of a flex (which don't */
|
|
|
|
/* increase `num_flex_vectors'); we thus have to */
|
|
|
|
/* check whether we can add a point */
|
|
|
|
if ( FT_SET_ERROR( t1_builder_check_points( builder, 1 ) ) )
|
|
|
|
goto Syntax_Error;
|
|
|
|
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
(FT_Byte)( idx == 3 || idx == 6 ) );
|
2017-03-24 09:15:10 +01:00
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* change hints */
|
2006-06-26 21:12:51 +02:00
|
|
|
if ( arg_cnt != 1 )
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
known_othersubr_result_cnt = 1;
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
if ( hinter )
|
2015-02-25 11:20:20 +01:00
|
|
|
hinter->reset( hinter->hints,
|
|
|
|
(FT_UInt)builder->current->n_points );
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
/* counter control hints, clear stack */
|
|
|
|
top = decoder->stack;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
case 16:
|
|
|
|
case 17:
|
|
|
|
case 18: /* multiple masters */
|
|
|
|
{
|
2002-02-28 19:59:37 +01:00
|
|
|
PS_Blend blend = decoder->blend;
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_UInt num_points, nn, mm;
|
|
|
|
FT_Long* delta;
|
|
|
|
FT_Long* values;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( !blend )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
2009-06-26 06:15:41 +02:00
|
|
|
" unexpected multiple masters operator\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
num_points = (FT_UInt)subr_no - 13 + ( subr_no == 18 );
|
|
|
|
if ( arg_cnt != (FT_Int)( num_points * blend->num_designs ) )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" incorrect number of multiple masters arguments\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2011-07-14 07:21:11 +02:00
|
|
|
/* We want to compute */
|
|
|
|
/* */
|
|
|
|
/* a0*w0 + a1*w1 + ... + ak*wk */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
2011-07-14 07:21:11 +02:00
|
|
|
/* but we only have a0, a1-a0, a2-a0, ..., ak-a0. */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
2011-07-14 07:21:11 +02:00
|
|
|
/* However, given that w0 + w1 + ... + wk == 1, we can */
|
|
|
|
/* rewrite it easily as */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
2011-07-14 07:21:11 +02:00
|
|
|
/* a0 + (a1-a0)*w1 + (a2-a0)*w2 + ... + (ak-a0)*wk */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
2011-07-14 07:21:11 +02:00
|
|
|
/* where k == num_designs-1. */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
|
|
|
/* I guess that's why it's written in this `compact' */
|
|
|
|
/* form. */
|
|
|
|
/* */
|
|
|
|
delta = top + num_points;
|
|
|
|
values = top;
|
|
|
|
for ( nn = 0; nn < num_points; nn++ )
|
|
|
|
{
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
include/freetype/internal/psaux.h, src/cid/cidgload.c,
src/psaux/psobjs.c, src/psaux/t1decode.c, src/psaux/psobjs.h,
src/pshinter/pshrec.c, src/pshinter/pshalgo.c,
src/psnames/psmodule.c, src/raster/ftraster.c, src/sfnt/sfobjs.c,
src/smooth/ftgrays.c, src/smooth/ftsmooth.c, src/truetype/ttobjs.c,
src/truetype/ttdriver.c, src/truetype/ttgload.c, src/type1/t1afm.c,
src/type1/t1gload.c, src/type1/t1gload.h, src/type1/t1load.c,
src/type1/t1objs.c, src/type42/t42parse.c, src/type42/t42parse.h:
Many casts and slight argument type changes to make it work with
a 16bit compiler.
2003-06-05 06:31:05 +02:00
|
|
|
FT_Long tmp = values[0];
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
for ( mm = 1; mm < blend->num_designs; mm++ )
|
2017-06-09 11:21:58 +02:00
|
|
|
tmp = ADD_LONG( tmp,
|
|
|
|
FT_MulFix( *delta++,
|
|
|
|
blend->weight_vector[mm] ) );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
*values++ = tmp;
|
|
|
|
}
|
2006-06-26 21:12:51 +02:00
|
|
|
|
2015-02-25 11:20:20 +01:00
|
|
|
known_othersubr_result_cnt = (FT_Int)num_points;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
case 19:
|
|
|
|
/* <idx> 1 19 callothersubr */
|
|
|
|
/* => replace elements starting from index cvi( <idx> ) */
|
|
|
|
/* of BuildCharArray with WeightVector */
|
|
|
|
{
|
|
|
|
FT_Int idx;
|
|
|
|
PS_Blend blend = decoder->blend;
|
|
|
|
|
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( arg_cnt != 1 || !blend )
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2011-07-14 07:35:51 +02:00
|
|
|
idx = Fix2Int( top[0] );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
2015-02-25 11:20:20 +01:00
|
|
|
if ( idx < 0 ||
|
|
|
|
(FT_UInt)idx + blend->num_designs > decoder->len_buildchar )
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2009-01-12 21:01:10 +01:00
|
|
|
ft_memcpy( &decoder->buildchar[idx],
|
|
|
|
blend->weight_vector,
|
|
|
|
blend->num_designs *
|
2011-11-30 10:46:53 +01:00
|
|
|
sizeof ( blend->weight_vector[0] ) );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 20:
|
|
|
|
/* <arg1> <arg2> 2 20 callothersubr pop */
|
|
|
|
/* ==> push <arg1> + <arg2> onto T1 stack */
|
|
|
|
if ( arg_cnt != 2 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
top[0] = ADD_LONG( top[0], top[1] );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
|
|
|
known_othersubr_result_cnt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 21:
|
|
|
|
/* <arg1> <arg2> 2 21 callothersubr pop */
|
|
|
|
/* ==> push <arg1> - <arg2> onto T1 stack */
|
|
|
|
if ( arg_cnt != 2 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
top[0] = SUB_LONG( top[0], top[1] );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
|
|
|
known_othersubr_result_cnt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 22:
|
|
|
|
/* <arg1> <arg2> 2 22 callothersubr pop */
|
|
|
|
/* ==> push <arg1> * <arg2> onto T1 stack */
|
|
|
|
if ( arg_cnt != 2 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
top[0] = FT_MulFix( top[0], top[1] );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
|
|
|
known_othersubr_result_cnt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 23:
|
|
|
|
/* <arg1> <arg2> 2 23 callothersubr pop */
|
|
|
|
/* ==> push <arg1> / <arg2> onto T1 stack */
|
|
|
|
if ( arg_cnt != 2 || top[1] == 0 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
top[0] = FT_DivFix( top[0], top[1] );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
|
|
|
known_othersubr_result_cnt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 24:
|
2009-06-25 21:31:53 +02:00
|
|
|
/* <val> <idx> 2 24 callothersubr */
|
|
|
|
/* ==> set BuildCharArray[cvi( <idx> )] = <val> */
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
{
|
2021-10-11 05:12:12 +02:00
|
|
|
FT_UInt idx;
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
PS_Blend blend = decoder->blend;
|
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( arg_cnt != 2 || !blend )
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2021-10-11 05:12:12 +02:00
|
|
|
idx = Fix2UInt( top[1] );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
2021-10-11 05:12:12 +02:00
|
|
|
if ( idx >= decoder->len_buildchar )
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
decoder->buildchar[idx] = top[0];
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 25:
|
2009-06-25 21:31:53 +02:00
|
|
|
/* <idx> 1 25 callothersubr pop */
|
|
|
|
/* ==> push BuildCharArray[cvi( idx )] */
|
|
|
|
/* onto T1 stack */
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
{
|
2021-10-11 05:12:12 +02:00
|
|
|
FT_UInt idx;
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
PS_Blend blend = decoder->blend;
|
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( arg_cnt != 1 || !blend )
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
2021-10-11 05:12:12 +02:00
|
|
|
idx = Fix2UInt( top[0] );
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
2021-10-11 05:12:12 +02:00
|
|
|
if ( idx >= decoder->len_buildchar )
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
top[0] = decoder->buildchar[idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
known_othersubr_result_cnt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
case 26:
|
|
|
|
/* <val> mark <idx> ==> set BuildCharArray[cvi( <idx> )] = <val>, */
|
|
|
|
/* leave mark on T1 stack */
|
|
|
|
/* <val> <idx> ==> set BuildCharArray[cvi( <idx> )] = <val> */
|
2009-06-25 21:31:53 +02:00
|
|
|
XXX which routine has left its mark on the (PostScript) stack?;
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
case 27:
|
|
|
|
/* <res1> <res2> <val1> <val2> 4 27 callothersubr pop */
|
2009-06-25 21:31:53 +02:00
|
|
|
/* ==> push <res1> onto T1 stack if <val1> <= <val2>, */
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* otherwise push <res2> */
|
|
|
|
if ( arg_cnt != 4 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
if ( top[2] > top[3] )
|
|
|
|
top[0] = top[1];
|
|
|
|
|
|
|
|
known_othersubr_result_cnt = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 28:
|
|
|
|
/* 0 28 callothersubr pop */
|
|
|
|
/* => push random value from interval [0, 1) onto stack */
|
|
|
|
if ( arg_cnt != 0 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
{
|
|
|
|
FT_Fixed Rand;
|
|
|
|
|
|
|
|
|
|
|
|
Rand = seed;
|
|
|
|
if ( Rand >= 0x8000L )
|
|
|
|
Rand++;
|
|
|
|
|
|
|
|
top[0] = Rand;
|
|
|
|
|
|
|
|
seed = FT_MulFix( seed, 0x10000L - seed );
|
|
|
|
if ( seed == 0 )
|
|
|
|
seed += 0x2873;
|
|
|
|
}
|
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
known_othersubr_result_cnt = 1;
|
|
|
|
break;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
default:
|
2011-07-14 07:34:12 +02:00
|
|
|
if ( arg_cnt >= 0 && subr_no >= 0 )
|
2011-07-10 07:08:51 +02:00
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" unknown othersubr [%d %d], wish me luck\n",
|
|
|
|
arg_cnt, subr_no ));
|
|
|
|
unknown_othersubr_result_cnt = arg_cnt;
|
|
|
|
break;
|
|
|
|
}
|
2011-07-14 07:35:51 +02:00
|
|
|
/* fall through */
|
2006-06-26 21:12:51 +02:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
Unexpected_OtherSubr:
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
2009-06-26 06:15:41 +02:00
|
|
|
" invalid othersubr [%d %d]\n", arg_cnt, subr_no ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
2006-06-26 21:12:51 +02:00
|
|
|
|
|
|
|
top += known_othersubr_result_cnt;
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
decoder->top = top;
|
|
|
|
}
|
|
|
|
else /* general operator */
|
|
|
|
{
|
|
|
|
FT_Int num_args = t1_args_count[op];
|
|
|
|
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
FT_ASSERT( num_args >= 0 );
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( top - decoder->stack < num_args )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
/* XXX Operators usually take their operands from the */
|
|
|
|
/* bottom of the stack, i.e., the operands are */
|
|
|
|
/* decoder->stack[0], ..., decoder->stack[num_args - 1]; */
|
|
|
|
/* only div, callsubr, and callothersubr are different. */
|
|
|
|
/* In practice it doesn't matter (?). */
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
|
|
|
|
switch ( op )
|
|
|
|
{
|
|
|
|
case op_callsubr:
|
|
|
|
case op_div:
|
|
|
|
case op_callothersubr:
|
|
|
|
case op_pop:
|
|
|
|
case op_return:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ( top - decoder->stack != num_args )
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_TRACE0(( "t1_decoder_parse_charstrings:"
|
|
|
|
" too much operands on the stack"
|
2020-08-28 06:26:38 +02:00
|
|
|
" (seen %ld, expected %d)\n",
|
2006-06-26 21:12:51 +02:00
|
|
|
top - decoder->stack, num_args ));
|
2021-06-02 06:59:01 +02:00
|
|
|
break;
|
2006-06-26 21:12:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* FT_DEBUG_LEVEL_TRACE */
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
top -= num_args;
|
|
|
|
|
|
|
|
switch ( op )
|
|
|
|
{
|
|
|
|
case op_endchar:
|
2009-06-19 14:56:26 +02:00
|
|
|
FT_TRACE4(( " endchar\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_close_contour( builder );
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
/* close hints recording session */
|
|
|
|
if ( hinter )
|
|
|
|
{
|
2015-02-25 11:20:20 +01:00
|
|
|
if ( hinter->close( hinter->hints,
|
|
|
|
(FT_UInt)builder->current->n_points ) )
|
2001-10-18 13:49:26 +02:00
|
|
|
goto Syntax_Error;
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
/* apply hints to the loaded glyph outline now */
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
error = hinter->apply( hinter->hints,
|
|
|
|
builder->current,
|
|
|
|
(PSH_Globals)builder->hints_globals,
|
|
|
|
decoder->hint_mode );
|
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
2001-10-18 13:49:26 +02:00
|
|
|
}
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* add current outline to the glyph slot */
|
|
|
|
FT_GlyphLoader_Add( builder->loader );
|
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* the compiler should optimize away this empty loop but ... */
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
|
2006-07-19 11:54:56 +02:00
|
|
|
if ( decoder->len_buildchar > 0 )
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
{
|
|
|
|
FT_UInt i;
|
|
|
|
|
|
|
|
|
|
|
|
FT_TRACE4(( "BuildCharArray = [ " ));
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( i = 0; i < decoder->len_buildchar; i++ )
|
2020-08-28 06:26:38 +02:00
|
|
|
FT_TRACE4(( "%ld ", decoder->buildchar[i] ));
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
|
|
|
FT_TRACE4(( "]\n" ));
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* FT_DEBUG_LEVEL_TRACE */
|
|
|
|
|
|
|
|
FT_TRACE4(( "\n" ));
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* return now! */
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
case op_hsbw:
|
|
|
|
FT_TRACE4(( " hsbw" ));
|
|
|
|
|
2004-05-13 14:59:59 +02:00
|
|
|
builder->parse_state = T1_Parse_Have_Width;
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
|
|
|
|
top[0] );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-01 13:15:54 +02:00
|
|
|
builder->advance.x = top[1];
|
|
|
|
builder->advance.y = 0;
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
orig_x = x = ADD_LONG( builder->pos_x, top[0] );
|
2009-06-20 13:24:08 +02:00
|
|
|
orig_y = y = builder->pos_y;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2002-02-19 17:30:15 +01:00
|
|
|
FT_UNUSED( orig_y );
|
|
|
|
|
2020-07-06 09:21:03 +02:00
|
|
|
/* `metrics_only' indicates that we only want to compute the */
|
|
|
|
/* glyph's metrics (lsb + advance width) without loading the */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* rest of it; so exit immediately */
|
|
|
|
if ( builder->metrics_only )
|
[psaux, type1] Trace PostScript dictionaries and other things.
The tracing of /Encoding, /Subrs, and /Charstrings is rudimentary
right now.
* src/psaux/psobjs.c (ps_parser_load_field,
ps_parser_load_field_table): Add tracing calls.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Make tracing
output more compact.
* src/type1/t1gload.c (T1_Compute_Max_Advance, T1_Get_Advances): Add
tracing messages.
* src/type1/t1load.c (parse_blend_axis_types,
parse_blend_design_positions, parse_blend_design_map,
parse_weight_vector, t1_load_keyword, t1_parse_font_matrix,
parse_encoding, parse_subrs, parse_charstrings, T1_Open_Face): Add
tracing calls.
* src/type1/t1objs.c (T1_Face_Init): Add tracing call.
* src/sfnt/sfobjs.c (sfnt_init_face): Make tracing message more
verbose.
2018-07-25 22:07:22 +02:00
|
|
|
{
|
|
|
|
FT_TRACE4(( "\n" ));
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
[psaux, type1] Trace PostScript dictionaries and other things.
The tracing of /Encoding, /Subrs, and /Charstrings is rudimentary
right now.
* src/psaux/psobjs.c (ps_parser_load_field,
ps_parser_load_field_table): Add tracing calls.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Make tracing
output more compact.
* src/type1/t1gload.c (T1_Compute_Max_Advance, T1_Get_Advances): Add
tracing messages.
* src/type1/t1load.c (parse_blend_axis_types,
parse_blend_design_positions, parse_blend_design_map,
parse_weight_vector, t1_load_keyword, t1_parse_font_matrix,
parse_encoding, parse_subrs, parse_charstrings, T1_Open_Face): Add
tracing calls.
* src/type1/t1objs.c (T1_Face_Init): Add tracing call.
* src/sfnt/sfobjs.c (sfnt_init_face): Make tracing message more
verbose.
2018-07-25 22:07:22 +02:00
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_seac:
|
2009-06-28 02:11:51 +02:00
|
|
|
return t1operator_seac( decoder,
|
|
|
|
top[0],
|
|
|
|
top[1],
|
|
|
|
top[2],
|
2011-07-14 07:35:51 +02:00
|
|
|
Fix2Int( top[3] ),
|
|
|
|
Fix2Int( top[4] ) );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
case op_sbw:
|
|
|
|
FT_TRACE4(( " sbw" ));
|
|
|
|
|
2004-05-13 14:59:59 +02:00
|
|
|
builder->parse_state = T1_Parse_Have_Width;
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
|
|
|
|
top[0] );
|
|
|
|
builder->left_bearing.y = ADD_LONG( builder->left_bearing.y,
|
|
|
|
top[1] );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
|
|
|
builder->advance.x = top[2];
|
|
|
|
builder->advance.y = top[3];
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( builder->pos_x, top[0] );
|
|
|
|
y = ADD_LONG( builder->pos_y, top[1] );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2020-07-06 09:21:03 +02:00
|
|
|
/* `metrics_only' indicates that we only want to compute the */
|
|
|
|
/* glyph's metrics (lsb + advance width) without loading the */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* rest of it; so exit immediately */
|
|
|
|
if ( builder->metrics_only )
|
2018-07-27 09:15:43 +02:00
|
|
|
{
|
|
|
|
FT_TRACE4(( "\n" ));
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2018-07-27 09:15:43 +02:00
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_closepath:
|
|
|
|
FT_TRACE4(( " closepath" ));
|
|
|
|
|
2008-05-16 06:50:00 +02:00
|
|
|
/* if there is no path, `closepath' is a no-op */
|
|
|
|
if ( builder->parse_state == T1_Parse_Have_Path ||
|
|
|
|
builder->parse_state == T1_Parse_Have_Moveto )
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_close_contour( builder );
|
2008-05-16 06:50:00 +02:00
|
|
|
|
2004-05-13 14:59:59 +02:00
|
|
|
builder->parse_state = T1_Parse_Have_Width;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_hlineto:
|
|
|
|
FT_TRACE4(( " hlineto" ));
|
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[0] );
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Add_Line;
|
|
|
|
|
|
|
|
case op_hmoveto:
|
|
|
|
FT_TRACE4(( " hmoveto" ));
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[0] );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
2000-10-09 03:44:40 +02:00
|
|
|
if ( !decoder->flex_state )
|
2004-05-13 14:59:59 +02:00
|
|
|
{
|
|
|
|
if ( builder->parse_state == T1_Parse_Start )
|
|
|
|
goto Syntax_Error;
|
|
|
|
builder->parse_state = T1_Parse_Have_Moveto;
|
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_hvcurveto:
|
|
|
|
FT_TRACE4(( " hvcurveto" ));
|
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
|
|
|
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[0] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 0 );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[1] );
|
|
|
|
y = ADD_LONG( y, top[2] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 0 );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
y = ADD_LONG( y, top[3] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 1 );
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_rlineto:
|
|
|
|
FT_TRACE4(( " rlineto" ));
|
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[0] );
|
|
|
|
y = ADD_LONG( y, top[1] );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
Add_Line:
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_add_point1( builder, x, y ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_rmoveto:
|
|
|
|
FT_TRACE4(( " rmoveto" ));
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[0] );
|
|
|
|
y = ADD_LONG( y, top[1] );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
2000-10-09 03:44:40 +02:00
|
|
|
if ( !decoder->flex_state )
|
2004-05-13 14:59:59 +02:00
|
|
|
{
|
|
|
|
if ( builder->parse_state == T1_Parse_Start )
|
|
|
|
goto Syntax_Error;
|
|
|
|
builder->parse_state = T1_Parse_Have_Moveto;
|
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_rrcurveto:
|
2009-06-19 14:56:26 +02:00
|
|
|
FT_TRACE4(( " rrcurveto" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
|
|
|
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[0] );
|
|
|
|
y = ADD_LONG( y, top[1] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 0 );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[2] );
|
|
|
|
y = ADD_LONG( y, top[3] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 0 );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[4] );
|
|
|
|
y = ADD_LONG( y, top[5] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 1 );
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vhcurveto:
|
|
|
|
FT_TRACE4(( " vhcurveto" ));
|
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) ||
|
|
|
|
FT_SET_ERROR( t1_builder_check_points( builder, 3 ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
y = ADD_LONG( y, top[0] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 0 );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[1] );
|
|
|
|
y = ADD_LONG( y, top[2] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 0 );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
x = ADD_LONG( x, top[3] );
|
2010-11-23 19:30:38 +01:00
|
|
|
t1_builder_add_point( builder, x, y, 1 );
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vlineto:
|
|
|
|
FT_TRACE4(( " vlineto" ));
|
|
|
|
|
2016-12-17 20:47:42 +01:00
|
|
|
if ( FT_SET_ERROR( t1_builder_start_point( builder, x, y ) ) )
|
2004-05-13 14:59:59 +02:00
|
|
|
goto Fail;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
y = ADD_LONG( y, top[0] );
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Add_Line;
|
|
|
|
|
|
|
|
case op_vmoveto:
|
|
|
|
FT_TRACE4(( " vmoveto" ));
|
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
y = ADD_LONG( y, top[0] );
|
2017-06-01 13:15:54 +02:00
|
|
|
|
2000-10-09 03:44:40 +02:00
|
|
|
if ( !decoder->flex_state )
|
2004-05-13 14:59:59 +02:00
|
|
|
{
|
|
|
|
if ( builder->parse_state == T1_Parse_Start )
|
|
|
|
goto Syntax_Error;
|
|
|
|
builder->parse_state = T1_Parse_Have_Moveto;
|
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_div:
|
|
|
|
FT_TRACE4(( " div" ));
|
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
/* if `large_int' is set, we divide unscaled numbers; */
|
|
|
|
/* otherwise, we divide numbers in 16.16 format -- */
|
|
|
|
/* in both cases, it is the same operation */
|
|
|
|
*top = FT_DivFix( top[0], top[1] );
|
2016-12-26 23:57:45 +01:00
|
|
|
top++;
|
2009-06-20 09:31:19 +02:00
|
|
|
|
|
|
|
large_int = FALSE;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_callsubr:
|
|
|
|
{
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
FT_Int idx;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
FT_TRACE4(( " callsubr" ));
|
|
|
|
|
2011-07-14 07:35:51 +02:00
|
|
|
idx = Fix2Int( top[0] );
|
2015-12-20 19:36:04 +01:00
|
|
|
|
|
|
|
if ( decoder->subrs_hash )
|
|
|
|
{
|
|
|
|
size_t* val = ft_hash_num_lookup( idx,
|
|
|
|
decoder->subrs_hash );
|
|
|
|
|
|
|
|
|
|
|
|
if ( val )
|
|
|
|
idx = *val;
|
|
|
|
else
|
|
|
|
idx = -1;
|
|
|
|
}
|
|
|
|
|
2015-02-18 11:45:22 +01:00
|
|
|
if ( idx < 0 || idx >= decoder->num_subrs )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" invalid subrs index\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" too many nested subrs\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
zone->cursor = ip; /* save current instruction pointer */
|
|
|
|
|
|
|
|
zone++;
|
2001-03-12 02:42:38 +01:00
|
|
|
|
2001-03-12 23:33:52 +01:00
|
|
|
/* The Type 1 driver stores subroutines without the seed bytes. */
|
|
|
|
/* The CID driver stores subroutines with seed bytes. This */
|
|
|
|
/* case is taken care of when decoder->subrs_len == 0. */
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
zone->base = decoder->subrs[idx];
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2001-03-12 23:33:52 +01:00
|
|
|
if ( decoder->subrs_len )
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
zone->limit = zone->base + decoder->subrs_len[idx];
|
2000-08-23 00:36:33 +02:00
|
|
|
else
|
2001-03-12 02:42:38 +01:00
|
|
|
{
|
|
|
|
/* We are using subroutines from a CID font. We must adjust */
|
|
|
|
/* for the seed bytes. */
|
2001-06-27 21:46:12 +02:00
|
|
|
zone->base += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
zone->limit = decoder->subrs[idx + 1];
|
2001-03-12 02:42:38 +01:00
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
zone->cursor = zone->base;
|
|
|
|
|
|
|
|
if ( !zone->base )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
2009-06-26 06:15:41 +02:00
|
|
|
" invoking empty subrs\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
decoder->zone = zone;
|
|
|
|
ip = zone->base;
|
|
|
|
limit = zone->limit;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case op_pop:
|
|
|
|
FT_TRACE4(( " pop" ));
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
if ( known_othersubr_result_cnt > 0 )
|
|
|
|
{
|
|
|
|
known_othersubr_result_cnt--;
|
|
|
|
/* ignore, we pushed the operands ourselves */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( unknown_othersubr_result_cnt == 0 )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
2009-06-26 06:15:41 +02:00
|
|
|
" no more operands for othersubr\n" ));
|
2006-06-26 21:12:51 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
unknown_othersubr_result_cnt--;
|
|
|
|
top++; /* `push' the operand to callothersubr onto the stack */
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_return:
|
|
|
|
FT_TRACE4(( " return" ));
|
|
|
|
|
|
|
|
if ( zone <= decoder->zones )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" unexpected return\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
zone--;
|
|
|
|
ip = zone->cursor;
|
|
|
|
limit = zone->limit;
|
|
|
|
decoder->zone = zone;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_dotsection:
|
|
|
|
FT_TRACE4(( " dotsection" ));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_hstem:
|
|
|
|
FT_TRACE4(( " hstem" ));
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
/* record horizontal hint */
|
|
|
|
if ( hinter )
|
|
|
|
{
|
|
|
|
/* top[0] += builder->left_bearing.y; */
|
2001-12-21 16:59:43 +01:00
|
|
|
hinter->stem( hinter->hints, 1, top );
|
2001-10-18 13:49:26 +02:00
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_hstem3:
|
|
|
|
FT_TRACE4(( " hstem3" ));
|
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
/* record horizontal counter-controlled hints */
|
|
|
|
if ( hinter )
|
2001-12-21 16:59:43 +01:00
|
|
|
hinter->stem3( hinter->hints, 1, top );
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vstem:
|
|
|
|
FT_TRACE4(( " vstem" ));
|
|
|
|
|
2009-06-25 21:31:53 +02:00
|
|
|
/* record vertical hint */
|
2001-10-18 13:49:26 +02:00
|
|
|
if ( hinter )
|
|
|
|
{
|
2017-06-09 11:21:58 +02:00
|
|
|
top[0] = ADD_LONG( top[0], orig_x );
|
2001-12-21 16:59:43 +01:00
|
|
|
hinter->stem( hinter->hints, 0, top );
|
2001-10-18 13:49:26 +02:00
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vstem3:
|
|
|
|
FT_TRACE4(( " vstem3" ));
|
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
/* record vertical counter-controlled hints */
|
|
|
|
if ( hinter )
|
|
|
|
{
|
|
|
|
FT_Pos dx = orig_x;
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
|
2017-06-09 11:21:58 +02:00
|
|
|
top[0] = ADD_LONG( top[0], dx );
|
|
|
|
top[2] = ADD_LONG( top[2], dx );
|
|
|
|
top[4] = ADD_LONG( top[4], dx );
|
2001-12-21 16:59:43 +01:00
|
|
|
hinter->stem3( hinter->hints, 0, top );
|
2001-10-18 13:49:26 +02:00
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_setcurrentpoint:
|
|
|
|
FT_TRACE4(( " setcurrentpoint" ));
|
|
|
|
|
2009-12-14 22:32:32 +01:00
|
|
|
/* From the T1 specification, section 6.4: */
|
2006-06-26 21:12:51 +02:00
|
|
|
/* */
|
|
|
|
/* The setcurrentpoint command is used only in */
|
|
|
|
/* conjunction with results from OtherSubrs procedures. */
|
|
|
|
|
2009-12-14 22:32:32 +01:00
|
|
|
/* known_othersubr_result_cnt != 0 is already handled */
|
|
|
|
/* above. */
|
|
|
|
|
|
|
|
/* Note, however, that both Ghostscript and Adobe */
|
|
|
|
/* Distiller handle this situation by silently ignoring */
|
|
|
|
/* the inappropriate `setcurrentpoint' instruction. So */
|
|
|
|
/* we do the same. */
|
2010-01-08 18:13:02 +01:00
|
|
|
#if 0
|
2009-12-14 22:32:32 +01:00
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
if ( decoder->flex_state != 1 )
|
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" unexpected `setcurrentpoint'\n" ));
|
2006-06-26 21:12:51 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
else
|
2010-05-11 00:06:02 +02:00
|
|
|
...
|
2009-12-14 22:32:32 +01:00
|
|
|
#endif
|
2010-05-11 00:06:02 +02:00
|
|
|
|
2010-05-11 00:03:33 +02:00
|
|
|
x = top[0];
|
|
|
|
y = top[1];
|
2010-05-11 00:06:02 +02:00
|
|
|
decoder->flex_state = 0;
|
2006-06-26 21:12:51 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_unknown15:
|
|
|
|
FT_TRACE4(( " opcode_15" ));
|
|
|
|
/* nothing to do except to pop the two arguments */
|
|
|
|
break;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
default:
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_parse_charstrings:"
|
|
|
|
" unhandled opcode %d\n", op ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2006-06-26 21:12:51 +02:00
|
|
|
/* XXX Operators usually clear the operand stack; */
|
|
|
|
/* only div, callsubr, callothersubr, pop, and */
|
|
|
|
/* return are different. */
|
|
|
|
/* In practice it doesn't matter (?). */
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
decoder->top = top;
|
|
|
|
|
2009-06-19 14:56:26 +02:00
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
FT_TRACE4(( "\n" ));
|
|
|
|
bol = TRUE;
|
|
|
|
#endif
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
} /* general operator processing */
|
|
|
|
|
|
|
|
} /* while ip < limit */
|
|
|
|
|
2020-12-02 14:15:07 +01:00
|
|
|
FT_TRACE4(( "..end..\n" ));
|
|
|
|
FT_TRACE4(( "\n" ));
|
2001-10-18 13:49:26 +02:00
|
|
|
|
2004-05-13 14:59:59 +02:00
|
|
|
Fail:
|
2000-08-23 00:36:33 +02:00
|
|
|
return error;
|
|
|
|
|
|
|
|
Syntax_Error:
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Syntax_Error );
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
Stack_Underflow:
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Stack_Underflow );
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2018-07-27 09:15:43 +02:00
|
|
|
|
|
|
|
#else /* !T1_CONFIG_OPTION_OLD_ENGINE */
|
|
|
|
|
Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.
This controls whether the old Type 1 engine gets compiled into FreeType.
It is disabled by default.
* devel/ftoption.h, include/freetype/config/ftoption.h
(T1_CONFIG_OPTION_OLD_ENGINE): New macro.
* include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
* include/freetype/internal/psaux.h, src/cid/cidgload.c
(cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
(ps_builder_add_point), src/psaux/t1decode.c
(t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
relevant code with macro.
Minor code changes.
2017-10-12 12:13:21 +02:00
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @Function:
|
|
|
|
* t1_decoder_parse_metrics
|
|
|
|
*
|
|
|
|
* @Description:
|
|
|
|
* Parses a given Type 1 charstrings program to extract width
|
|
|
|
*
|
|
|
|
* @Input:
|
|
|
|
* decoder ::
|
|
|
|
* The current Type 1 decoder.
|
|
|
|
*
|
|
|
|
* charstring_base ::
|
|
|
|
* The base address of the charstring stream.
|
|
|
|
*
|
|
|
|
* charstring_len ::
|
|
|
|
* The length in bytes of the charstring stream.
|
|
|
|
*
|
|
|
|
* @Return:
|
|
|
|
* FreeType error code. 0 means success.
|
|
|
|
*/
|
2017-10-12 12:13:08 +02:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
t1_decoder_parse_metrics( T1_Decoder decoder,
|
|
|
|
FT_Byte* charstring_base,
|
|
|
|
FT_UInt charstring_len )
|
|
|
|
{
|
|
|
|
T1_Decoder_Zone zone;
|
|
|
|
FT_Byte* ip;
|
|
|
|
FT_Byte* limit;
|
|
|
|
T1_Builder builder = &decoder->builder;
|
2020-02-21 20:57:52 +01:00
|
|
|
FT_Bool large_int;
|
2017-10-12 12:13:08 +02:00
|
|
|
|
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
FT_Bool bol = TRUE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* First of all, initialize the decoder */
|
|
|
|
decoder->top = decoder->stack;
|
|
|
|
decoder->zone = decoder->zones;
|
|
|
|
zone = decoder->zones;
|
|
|
|
|
|
|
|
builder->parse_state = T1_Parse_Start;
|
|
|
|
|
|
|
|
zone->base = charstring_base;
|
|
|
|
limit = zone->limit = charstring_base + charstring_len;
|
|
|
|
ip = zone->cursor = zone->base;
|
|
|
|
|
2020-02-21 20:57:52 +01:00
|
|
|
large_int = FALSE;
|
|
|
|
|
2017-10-12 12:13:08 +02:00
|
|
|
/* now, execute loop */
|
|
|
|
while ( ip < limit )
|
|
|
|
{
|
|
|
|
FT_Long* top = decoder->top;
|
|
|
|
T1_Operator op = op_none;
|
|
|
|
FT_Int32 value = 0;
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
if ( bol )
|
|
|
|
{
|
2020-07-28 07:33:40 +02:00
|
|
|
FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
|
2017-10-12 12:13:08 +02:00
|
|
|
bol = FALSE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**********************************************************************
|
|
|
|
*
|
|
|
|
* Decode operator or operand
|
|
|
|
*
|
|
|
|
*/
|
2017-10-12 12:13:08 +02:00
|
|
|
|
|
|
|
/* first of all, decompress operator or value */
|
|
|
|
switch ( *ip++ )
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
case 21:
|
|
|
|
case 22:
|
|
|
|
case 30:
|
|
|
|
case 31:
|
|
|
|
goto No_Width;
|
|
|
|
|
2020-07-06 09:21:03 +02:00
|
|
|
case 10:
|
|
|
|
op = op_callsubr;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
op = op_return;
|
|
|
|
break;
|
|
|
|
|
2017-10-12 12:13:08 +02:00
|
|
|
case 13:
|
|
|
|
op = op_hsbw;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 12:
|
|
|
|
if ( ip >= limit )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" invalid escape (12+EOF)\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ( *ip++ )
|
|
|
|
{
|
|
|
|
case 7:
|
|
|
|
op = op_sbw;
|
|
|
|
break;
|
2020-02-21 20:57:52 +01:00
|
|
|
case 12:
|
|
|
|
op = op_div;
|
|
|
|
break;
|
2017-10-12 12:13:08 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
goto No_Width;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 255: /* four bytes integer */
|
|
|
|
if ( ip + 4 > limit )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" unexpected EOF in integer\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
|
|
|
|
( (FT_UInt32)ip[1] << 16 ) |
|
|
|
|
( (FT_UInt32)ip[2] << 8 ) |
|
|
|
|
(FT_UInt32)ip[3] );
|
|
|
|
ip += 4;
|
|
|
|
|
|
|
|
/* According to the specification, values > 32000 or < -32000 must */
|
|
|
|
/* be followed by a `div' operator to make the result be in the */
|
|
|
|
/* range [-32000;32000]. We expect that the second argument of */
|
|
|
|
/* `div' is not a large number. Additionally, we don't handle */
|
|
|
|
/* stuff like `<large1> <large2> <num> div <num> div' or */
|
|
|
|
/* <large1> <large2> <num> div div'. This is probably not allowed */
|
|
|
|
/* anyway. */
|
|
|
|
if ( value > 32000 || value < -32000 )
|
|
|
|
{
|
2020-02-21 20:57:52 +01:00
|
|
|
if ( large_int )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" no `div' after large integer\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
large_int = TRUE;
|
2017-10-12 12:13:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-02-21 20:57:52 +01:00
|
|
|
if ( !large_int )
|
|
|
|
value = (FT_Int32)( (FT_UInt32)value << 16 );
|
2017-10-12 12:13:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ( ip[-1] >= 32 )
|
|
|
|
{
|
|
|
|
if ( ip[-1] < 247 )
|
|
|
|
value = (FT_Int32)ip[-1] - 139;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( ++ip > limit )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" unexpected EOF in integer\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ip[-2] < 251 )
|
|
|
|
value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108;
|
|
|
|
else
|
|
|
|
value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 );
|
|
|
|
}
|
|
|
|
|
2020-02-21 20:57:52 +01:00
|
|
|
if ( !large_int )
|
|
|
|
value = (FT_Int32)( (FT_UInt32)value << 16 );
|
2017-10-12 12:13:08 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" invalid byte (%d)\n", ip[-1] ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-21 20:57:52 +01:00
|
|
|
if ( large_int && !( op == op_none || op == op_div ) )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" no `div' after large integer\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2018-06-03 09:01:17 +02:00
|
|
|
/**********************************************************************
|
|
|
|
*
|
|
|
|
* Push value on stack, or process operator
|
|
|
|
*
|
|
|
|
*/
|
2017-10-12 12:13:08 +02:00
|
|
|
if ( op == op_none )
|
|
|
|
{
|
|
|
|
if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics: stack overflow\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
2020-02-21 20:57:52 +01:00
|
|
|
if ( large_int )
|
|
|
|
FT_TRACE4(( " %d", value ));
|
|
|
|
else
|
2017-10-12 12:13:08 +02:00
|
|
|
FT_TRACE4(( " %d", value / 65536 ));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
*top++ = value;
|
|
|
|
decoder->top = top;
|
|
|
|
}
|
|
|
|
else /* general operator */
|
|
|
|
{
|
|
|
|
FT_Int num_args = t1_args_count[op];
|
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( num_args >= 0 );
|
|
|
|
|
|
|
|
if ( top - decoder->stack < num_args )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_LEVEL_TRACE
|
|
|
|
|
2020-07-06 09:21:03 +02:00
|
|
|
switch ( op )
|
2020-02-21 20:57:52 +01:00
|
|
|
{
|
2020-07-06 09:21:03 +02:00
|
|
|
case op_callsubr:
|
|
|
|
case op_div:
|
|
|
|
case op_return:
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2020-02-21 20:57:52 +01:00
|
|
|
if ( top - decoder->stack != num_args )
|
|
|
|
FT_TRACE0(( "t1_decoder_parse_metrics:"
|
|
|
|
" too much operands on the stack"
|
2020-07-28 07:33:40 +02:00
|
|
|
" (seen %ld, expected %d)\n",
|
2020-02-21 20:57:52 +01:00
|
|
|
top - decoder->stack, num_args ));
|
2020-07-06 09:21:03 +02:00
|
|
|
break;
|
2020-02-21 20:57:52 +01:00
|
|
|
}
|
2017-10-12 12:13:08 +02:00
|
|
|
|
|
|
|
#endif /* FT_DEBUG_LEVEL_TRACE */
|
|
|
|
|
|
|
|
top -= num_args;
|
|
|
|
|
|
|
|
switch ( op )
|
|
|
|
{
|
|
|
|
case op_hsbw:
|
|
|
|
FT_TRACE4(( " hsbw" ));
|
|
|
|
|
|
|
|
builder->parse_state = T1_Parse_Have_Width;
|
|
|
|
|
|
|
|
builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
|
|
|
|
top[0] );
|
|
|
|
|
|
|
|
builder->advance.x = top[1];
|
|
|
|
builder->advance.y = 0;
|
|
|
|
|
|
|
|
/* we only want to compute the glyph's metrics */
|
2020-07-06 09:21:03 +02:00
|
|
|
/* (lsb + advance width) without loading the */
|
|
|
|
/* rest of it; so exit immediately */
|
2018-07-27 09:15:43 +02:00
|
|
|
FT_TRACE4(( "\n" ));
|
2017-10-12 12:13:08 +02:00
|
|
|
return FT_Err_Ok;
|
|
|
|
|
|
|
|
case op_sbw:
|
|
|
|
FT_TRACE4(( " sbw" ));
|
|
|
|
|
|
|
|
builder->parse_state = T1_Parse_Have_Width;
|
|
|
|
|
|
|
|
builder->left_bearing.x = ADD_LONG( builder->left_bearing.x,
|
|
|
|
top[0] );
|
|
|
|
builder->left_bearing.y = ADD_LONG( builder->left_bearing.y,
|
|
|
|
top[1] );
|
|
|
|
|
|
|
|
builder->advance.x = top[2];
|
|
|
|
builder->advance.y = top[3];
|
|
|
|
|
|
|
|
/* we only want to compute the glyph's metrics */
|
2020-07-06 09:21:03 +02:00
|
|
|
/* (lsb + advance width), without loading the */
|
|
|
|
/* rest of it; so exit immediately */
|
2018-07-27 09:15:43 +02:00
|
|
|
FT_TRACE4(( "\n" ));
|
2017-10-12 12:13:08 +02:00
|
|
|
return FT_Err_Ok;
|
|
|
|
|
2020-02-21 20:57:52 +01:00
|
|
|
case op_div:
|
|
|
|
FT_TRACE4(( " div" ));
|
|
|
|
|
|
|
|
/* if `large_int' is set, we divide unscaled numbers; */
|
|
|
|
/* otherwise, we divide numbers in 16.16 format -- */
|
|
|
|
/* in both cases, it is the same operation */
|
|
|
|
*top = FT_DivFix( top[0], top[1] );
|
|
|
|
top++;
|
|
|
|
|
|
|
|
large_int = FALSE;
|
|
|
|
break;
|
|
|
|
|
2020-07-06 09:21:03 +02:00
|
|
|
case op_callsubr:
|
|
|
|
{
|
|
|
|
FT_Int idx;
|
|
|
|
|
|
|
|
|
|
|
|
FT_TRACE4(( " callsubr" ));
|
|
|
|
|
|
|
|
idx = Fix2Int( top[0] );
|
|
|
|
|
|
|
|
if ( decoder->subrs_hash )
|
|
|
|
{
|
|
|
|
size_t* val = ft_hash_num_lookup( idx,
|
|
|
|
decoder->subrs_hash );
|
|
|
|
|
|
|
|
|
|
|
|
if ( val )
|
|
|
|
idx = *val;
|
|
|
|
else
|
|
|
|
idx = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( idx < 0 || idx >= decoder->num_subrs )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" invalid subrs index\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" too many nested subrs\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
zone->cursor = ip; /* save current instruction pointer */
|
|
|
|
|
|
|
|
zone++;
|
|
|
|
|
|
|
|
/* The Type 1 driver stores subroutines without the seed bytes. */
|
|
|
|
/* The CID driver stores subroutines with seed bytes. This */
|
|
|
|
/* case is taken care of when decoder->subrs_len == 0. */
|
|
|
|
zone->base = decoder->subrs[idx];
|
|
|
|
|
|
|
|
if ( decoder->subrs_len )
|
|
|
|
zone->limit = zone->base + decoder->subrs_len[idx];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* We are using subroutines from a CID font. We must adjust */
|
|
|
|
/* for the seed bytes. */
|
|
|
|
zone->base += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
|
|
|
|
zone->limit = decoder->subrs[idx + 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
zone->cursor = zone->base;
|
|
|
|
|
|
|
|
if ( !zone->base )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" invoking empty subrs\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
decoder->zone = zone;
|
|
|
|
ip = zone->base;
|
|
|
|
limit = zone->limit;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case op_return:
|
|
|
|
FT_TRACE4(( " return" ));
|
|
|
|
|
|
|
|
if ( zone <= decoder->zones )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" unexpected return\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
zone--;
|
|
|
|
ip = zone->cursor;
|
|
|
|
limit = zone->limit;
|
|
|
|
decoder->zone = zone;
|
|
|
|
break;
|
|
|
|
|
2017-10-12 12:13:08 +02:00
|
|
|
default:
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" unhandled opcode %d\n", op ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2020-02-21 20:57:52 +01:00
|
|
|
decoder->top = top;
|
|
|
|
|
2017-10-12 12:13:08 +02:00
|
|
|
} /* general operator processing */
|
|
|
|
|
|
|
|
} /* while ip < limit */
|
|
|
|
|
2020-12-02 14:15:07 +01:00
|
|
|
FT_TRACE4(( "..end..\n" ));
|
|
|
|
FT_TRACE4(( "\n" ));
|
2017-10-12 12:13:08 +02:00
|
|
|
|
|
|
|
No_Width:
|
|
|
|
FT_ERROR(( "t1_decoder_parse_metrics:"
|
|
|
|
" no width, found op %d instead\n",
|
|
|
|
ip[-1] ));
|
|
|
|
Syntax_Error:
|
|
|
|
return FT_THROW( Syntax_Error );
|
|
|
|
|
|
|
|
Stack_Underflow:
|
|
|
|
return FT_THROW( Stack_Underflow );
|
|
|
|
}
|
2018-07-27 09:15:43 +02:00
|
|
|
|
|
|
|
#endif /* !T1_CONFIG_OPTION_OLD_ENGINE */
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
/* initialize T1 decoder */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_decoder_init( T1_Decoder decoder,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Face face,
|
|
|
|
FT_Size size,
|
|
|
|
FT_GlyphSlot slot,
|
|
|
|
FT_Byte** glyph_names,
|
2002-03-31 13:18:15 +02:00
|
|
|
PS_Blend blend,
|
2001-10-18 13:49:26 +02:00
|
|
|
FT_Bool hinting,
|
2002-08-28 00:34:20 +02:00
|
|
|
FT_Render_Mode hint_mode,
|
2001-06-27 21:46:12 +02:00
|
|
|
T1_Decoder_Callback parse_callback )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2016-09-28 19:06:21 +02:00
|
|
|
FT_ZERO( decoder );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2018-09-03 09:08:47 +02:00
|
|
|
/* retrieve `psnames' interface from list of current modules */
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2015-04-13 05:16:48 +02:00
|
|
|
FT_Service_PsCMaps psnames;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
* include/freetype/internal/bdftypes.h: removed obsolete header
* include/freetype/internal/cfftypes.h, src/cff/cfftypes.h,
src/cff/cffload.h, src/cff/cffobjs.h, src/cff/cffparse.h,
include/freetype/internal/services/svbdf.h: moving "cfftypes.h" from
'include/freetype/internal' to 'src/cff' since no other modules needs
to known about these types
* include/freetype/internal/t42types.h,
include/freetype/internal/internal.h, src/type42/t42objs.h,
src/type42/t42drivr.c, src/type42/t42types.h: moving "t42types.h" from
'include/freetype/internal' to 'src/type42' since no other modules needs
to known about these types
* src/gzip/infblock.c: removing compiler warning
* include/freetype/internal/services/svpsinfo.h,
include/freetype/internal/ftserv.h, src/cff/cffdrivr.c,
src/cid/ciddrivr.c, src/type1/t1driver.c, src/type42/t42drivr.c,
src/base/fttype1.c: migrating to FT_SERVICE_ID_POSTSCRIPT_INFO defined
in "svpsinfo.h", removing some sad hacks.
2003-10-29 22:43:52 +01:00
|
|
|
FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
|
2000-08-23 19:32:42 +02:00
|
|
|
if ( !psnames )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2009-06-25 21:31:53 +02:00
|
|
|
FT_ERROR(( "t1_decoder_init:"
|
|
|
|
" the `psnames' module is not available\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Unimplemented_Feature );
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
decoder->psnames = psnames;
|
|
|
|
}
|
2002-03-31 13:18:15 +02:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_init( &decoder->builder, face, size, slot, hinting );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2006-07-19 11:54:56 +02:00
|
|
|
/* decoder->buildchar and decoder->len_buildchar have to be */
|
|
|
|
/* initialized by the caller since we cannot know the length */
|
|
|
|
/* of the BuildCharArray */
|
|
|
|
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
decoder->num_glyphs = (FT_UInt)face->num_glyphs;
|
2000-08-23 04:47:57 +02:00
|
|
|
decoder->glyph_names = glyph_names;
|
2002-08-28 00:34:20 +02:00
|
|
|
decoder->hint_mode = hint_mode;
|
2000-08-23 04:47:57 +02:00
|
|
|
decoder->blend = blend;
|
|
|
|
decoder->parse_callback = parse_callback;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
decoder->funcs = t1_decoder_funcs;
|
2000-08-23 19:32:42 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
/* finalize T1 decoder */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_decoder_done( T1_Decoder decoder )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2017-09-25 06:44:51 +02:00
|
|
|
FT_Memory memory = decoder->builder.memory;
|
|
|
|
|
2017-10-01 01:39:27 +02:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_done( &decoder->builder );
|
2017-09-25 06:44:51 +02:00
|
|
|
|
|
|
|
if ( decoder->cf2_instance.finalizer )
|
|
|
|
{
|
|
|
|
decoder->cf2_instance.finalizer( decoder->cf2_instance.data );
|
|
|
|
FT_FREE( decoder->cf2_instance.data );
|
|
|
|
}
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
|
|
|
/* END */
|