2000-08-23 19:32:42 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* t1decode.c */
|
|
|
|
/* */
|
|
|
|
/* PostScript Type 1 decoding routines (body). */
|
|
|
|
/* */
|
2002-03-31 13:18:15 +02:00
|
|
|
/* Copyright 2000-2001, 2002 by */
|
2000-08-23 19:32:42 +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-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
2001-10-18 13:49:26 +02:00
|
|
|
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
2000-12-08 03:42:29 +01:00
|
|
|
#include FT_OUTLINE_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"
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-08-23 00:36:33 +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. */
|
|
|
|
/* */
|
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_t1decode
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
|
|
|
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 */
|
|
|
|
2 /* setcurrentpoint */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2000-08-23 19:32:42 +02:00
|
|
|
/* t1_lookup_glyph_by_stdcharcode */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-08-23 19:32:42 +02:00
|
|
|
/* Looks up a given glyph by its StandardEncoding charcode. Used to */
|
|
|
|
/* implement the SEAC Type 1 operator. */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
|
|
|
/* <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
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_UInt n;
|
|
|
|
const FT_String* glyph_name;
|
|
|
|
PSNames_Service 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];
|
|
|
|
|
|
|
|
|
2002-04-14 02:54:32 +02:00
|
|
|
if ( name && name[0] == glyph_name[0] &&
|
* README.UNX: updated the Unix-specific quick-compilation guide to
warn about the GNU Make requirement at compile time..
* include/freetype/config/ftstdlib.h,
include/freetype/config/ftconfig.h,
include/freetype/config/ftheader.h,
include/freetype/internal/ftmemory.h,
include/freetype/internal/ftobjs.h,
src/autohint/ahoptim.c,
src/base/ftdbgmem.c, src/base/ftdebug.c,
src/base/ftmac.c, src/base/ftobjs.c,
src/base/ftsystem.c,
src/cache/ftcimage.c, src/cache/ftcsbits.c,
src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c,
src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c,
src/pcf/pcfdriver.c, src/pcf/pcfread.c,
src/psaux/t1cmap.c, src/psaux/t1decode.c,
src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c,
src/pshinter/pshrec.c,
src/psnames/psmodule.c,
src/raster/ftraster.c,
src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c,
src/smooth/ftgrays.c,
src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c,
src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c:
added the new configuration file "ftstdlib.h" used to define
aliases for all ISO C library functions used by the engine
(e.g. strlen, qsort, setjmp, etc...)
this eases the porting of FreeType 2 to exotic environments like
XFree86 modules/extensions..
also removed many #include <string.h>, #include <stdlib.h>, etc...
from the engine's sources where they're not needed..
2002-04-12 11:31:48 +02:00
|
|
|
ft_strcmp( name,glyph_name ) == 0 )
|
2000-08-23 00:36:33 +02:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <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;
|
|
|
|
|
|
|
|
|
|
|
|
/* 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? */
|
|
|
|
if ( decoder->glyph_names == 0 )
|
2000-08-24 00:47:44 +02:00
|
|
|
{
|
|
|
|
FT_ERROR(( "t1operator_seac:" ));
|
2000-08-24 18:29:15 +02:00
|
|
|
FT_ERROR(( " glyph names table not available in this font!\n" ));
|
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
|
|
|
return PSaux_Err_Syntax_Error;
|
2000-08-24 00:47:44 +02:00
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );
|
|
|
|
achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar );
|
|
|
|
|
|
|
|
if ( bchar_index < 0 || achar_index < 0 )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1operator_seac:" ));
|
|
|
|
FT_ERROR(( " invalid seac character code arguments\n" ));
|
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
|
|
|
return PSaux_Err_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;
|
|
|
|
subg->arg1 = adx - asb;
|
|
|
|
subg->arg2 = ady;
|
|
|
|
|
|
|
|
/* set up remaining glyph fields */
|
|
|
|
glyph->num_subglyphs = 2;
|
|
|
|
glyph->subglyphs = loader->base.subglyphs;
|
|
|
|
glyph->format = ft_glyph_format_composite;
|
|
|
|
|
|
|
|
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 */
|
|
|
|
|
|
|
|
error = T1_Decoder_Parse_Glyph( decoder, bchar_index );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
2002-02-19 17:30:15 +01:00
|
|
|
#if 0
|
2000-08-23 00:36:33 +02:00
|
|
|
n_base_points = base->n_points;
|
2002-02-19 17:30:15 +01:00
|
|
|
#endif
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
/* save the left bearing and width of the base character */
|
|
|
|
/* as they will be erased by the next load. */
|
|
|
|
|
|
|
|
left_bearing = decoder->builder.left_bearing;
|
|
|
|
advance = decoder->builder.advance;
|
|
|
|
|
|
|
|
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 */
|
|
|
|
error = T1_Decoder_Parse_Glyph( decoder, achar_index );
|
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* restore the left side bearing and */
|
|
|
|
/* advance width of the base character */
|
|
|
|
|
|
|
|
decoder->builder.left_bearing = left_bearing;
|
|
|
|
decoder->builder.advance = advance;
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
/* XXX: old code doesn't work with PostScript hinter */
|
2002-02-24 03:59:24 +01:00
|
|
|
#if 0
|
2000-08-23 00:36:33 +02:00
|
|
|
/* Finally, move the accent */
|
|
|
|
if ( decoder->builder.load_points )
|
|
|
|
{
|
|
|
|
FT_Outline dummy;
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2001-06-20 01:03:41 +02:00
|
|
|
dummy.n_points = (short)( base->n_points - n_base_points );
|
|
|
|
dummy.points = base->points + n_base_points;
|
2000-08-23 19:32:42 +02:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
FT_Outline_Translate( &dummy, adx - asb, ady );
|
|
|
|
}
|
2002-02-24 03:59:24 +01:00
|
|
|
#else
|
2001-10-18 13:49:26 +02:00
|
|
|
decoder->builder.pos_x = 0;
|
|
|
|
decoder->builder.pos_y = 0;
|
|
|
|
#endif
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <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> */
|
2000-08-23 19:32:42 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-08-23 00:36:33 +02:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2002-02-28 17:10:29 +01: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;
|
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
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* we don't want to touch the source code -- use macro trick */
|
2000-08-23 19:32:42 +02:00
|
|
|
#define start_point T1_Builder_Start_Point
|
|
|
|
#define check_points T1_Builder_Check_Points
|
|
|
|
#define add_point T1_Builder_Add_Point
|
|
|
|
#define add_point1 T1_Builder_Add_Point1
|
|
|
|
#define add_contour T1_Builder_Add_Contour
|
|
|
|
#define close_contour T1_Builder_Close_Contour
|
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;
|
|
|
|
|
|
|
|
builder->path_begun = 0;
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
hinter = (T1_Hints_Funcs)builder->hints_funcs;
|
2001-10-18 13:49:26 +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;
|
|
|
|
|
2001-06-18 16:23:45 +02:00
|
|
|
error = PSaux_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
|
|
|
|
|
|
|
/* now, execute loop */
|
|
|
|
while ( ip < limit )
|
|
|
|
{
|
|
|
|
FT_Long* top = decoder->top;
|
|
|
|
T1_Operator op = op_none;
|
|
|
|
FT_Long value = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Decode operator or operand */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* 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 */
|
|
|
|
op = op_none;
|
|
|
|
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:
|
|
|
|
if ( ip > limit )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"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:
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"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 )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"unexpected EOF in integer\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2000-10-12 01:39:03 +02:00
|
|
|
value = (FT_Int32)( ((FT_Long)ip[0] << 24) |
|
|
|
|
((FT_Long)ip[1] << 16) |
|
|
|
|
((FT_Long)ip[2] << 8 ) |
|
|
|
|
ip[3] );
|
2000-08-23 00:36:33 +02:00
|
|
|
ip += 4;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if ( ip[-1] >= 32 )
|
|
|
|
{
|
|
|
|
if ( ip[-1] < 247 )
|
|
|
|
value = (FT_Long)ip[-1] - 139;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( ++ip > limit )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
|
2001-03-12 23:33:52 +01:00
|
|
|
FT_ERROR(( "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 )
|
|
|
|
value = ( ( (FT_Long)ip[-2] - 247 ) << 8 ) + ip[-1] + 108;
|
|
|
|
else
|
|
|
|
value = -( ( ( (FT_Long)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 );
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"invalid byte (%d)\n", ip[-1] ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Push value on stack, or process operator */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
if ( op == op_none )
|
|
|
|
{
|
|
|
|
if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: stack overflow!\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
FT_TRACE4(( " %ld", value ));
|
|
|
|
|
|
|
|
*top++ = value;
|
|
|
|
decoder->top = top;
|
|
|
|
}
|
|
|
|
else if ( op == op_callothersubr ) /* callothersubr */
|
|
|
|
{
|
|
|
|
FT_TRACE4(( " callothersubr" ));
|
|
|
|
|
|
|
|
if ( top - decoder->stack < 2 )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
top -= 2;
|
|
|
|
switch ( top[1] )
|
|
|
|
{
|
|
|
|
case 1: /* start flex feature */
|
|
|
|
if ( top[0] != 0 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
decoder->flex_state = 1;
|
|
|
|
decoder->num_flex_vectors = 0;
|
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 6 ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
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
|
|
|
|
|
|
|
if ( top[0] != 0 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
/* 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 )
|
2000-08-23 00:36:33 +02:00
|
|
|
add_point( builder,
|
|
|
|
x,
|
|
|
|
y,
|
* 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_Byte)( idx == 3 || idx == 6 ) );
|
2000-08-23 00:36:33 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0: /* end flex feature */
|
|
|
|
if ( top[0] != 3 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
if ( decoder->flex_state == 0 ||
|
|
|
|
decoder->num_flex_vectors != 7 )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"unexpected flex end\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now consume the remaining `pop pop setcurpoint' */
|
|
|
|
if ( ip + 6 > limit ||
|
|
|
|
ip[0] != 12 || ip[1] != 17 || /* pop */
|
|
|
|
ip[2] != 12 || ip[3] != 17 || /* pop */
|
|
|
|
ip[4] != 12 || ip[5] != 33 ) /* setcurpoint */
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"invalid flex charstring\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
ip += 6;
|
|
|
|
decoder->flex_state = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* change hints */
|
|
|
|
if ( top[0] != 1 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
/* eat the following `pop' */
|
|
|
|
if ( ip + 2 > limit )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"invalid escape (12+%d)\n", ip[-1] ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ip[0] != 12 || ip[1] != 17 )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
|
2001-03-12 23:33:52 +01:00
|
|
|
FT_ERROR(( "`pop' expected, found (%d %d)\n", ip[0], ip[1] ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
ip += 2;
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
if ( hinter )
|
|
|
|
hinter->reset( hinter->hints, builder->current->n_points );
|
2002-02-24 03:59:24 +01:00
|
|
|
|
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 )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
|
2001-03-12 23:33:52 +01:00
|
|
|
FT_ERROR(( "unexpected multiple masters operator!\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
num_points = top[1] - 13 + ( top[1] == 18 );
|
|
|
|
if ( top[0] != (FT_Int)( num_points * blend->num_designs ) )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
|
2001-03-12 23:33:52 +01:00
|
|
|
FT_ERROR(( "incorrect number of mm arguments\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
top -= blend->num_designs * num_points;
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( top < decoder->stack )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
/* we want to compute: */
|
|
|
|
/* */
|
|
|
|
/* a0*w0 + a1*w1 + ... + ak*wk */
|
|
|
|
/* */
|
|
|
|
/* but we only have the a0, a1-a0, a2-a0, .. ak-a0 */
|
|
|
|
/* however, given that w0 + w1 + ... + wk == 1, we can */
|
|
|
|
/* rewrite it easily as: */
|
|
|
|
/* */
|
|
|
|
/* a0 + (a1-a0)*w1 + (a2-a0)*w2 + .. + (ak-a0)*wk */
|
|
|
|
/* */
|
|
|
|
/* where k == num_designs-1 */
|
|
|
|
/* */
|
|
|
|
/* 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++ )
|
|
|
|
{
|
|
|
|
FT_Int tmp = values[0];
|
|
|
|
|
|
|
|
|
|
|
|
for ( mm = 1; mm < blend->num_designs; mm++ )
|
|
|
|
tmp += FT_MulFix( *delta++, blend->weight_vector[mm] );
|
|
|
|
|
|
|
|
*values++ = tmp;
|
|
|
|
}
|
|
|
|
/* note that `top' will be incremented later by calls to `pop' */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
Unexpected_OtherSubr:
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"invalid othersubr [%d %d]!\n", top[0], top[1] ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
decoder->top = top;
|
|
|
|
}
|
|
|
|
else /* general operator */
|
|
|
|
{
|
|
|
|
FT_Int num_args = t1_args_count[op];
|
|
|
|
|
|
|
|
|
|
|
|
if ( top - decoder->stack < num_args )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
top -= num_args;
|
|
|
|
|
|
|
|
switch ( op )
|
|
|
|
{
|
|
|
|
case op_endchar:
|
|
|
|
FT_TRACE4(( " endchar" ));
|
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
if (hinter->close( hinter->hints, builder->current->n_points ))
|
|
|
|
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 */
|
|
|
|
hinter->apply( hinter->hints,
|
|
|
|
builder->current,
|
* include/freetype/freetype.h, src/base/ftobjs.h,
freetype/internal/ftobjs.h, freetype/internal/psaux.h,
freetype/internal/pshints.h, src/psaux/t1decode.c, src/cff/cffgload.h,
src/cff/cffgload.c, src/pshinter/pshalgo1.h, src/pshinter/pshalgo1.c,
src/pshinter/pshalgo2.h, src/pshinter/pshalgo2.c, src/pshinter/pshalgo3.h,
src/pshinter/pshalgo3.c: Adding support for hinter-specific bit flags,
and the new FT_Set_Hint_Flags high-level API
2002-07-09 00:26:11 +02:00
|
|
|
(PSH_Globals)builder->hints_globals,
|
|
|
|
decoder->hint_flags );
|
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 );
|
|
|
|
|
|
|
|
/* return now! */
|
|
|
|
FT_TRACE4(( "\n\n" ));
|
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
|
|
|
return PSaux_Err_Ok;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
case op_hsbw:
|
|
|
|
FT_TRACE4(( " hsbw" ));
|
|
|
|
|
|
|
|
builder->left_bearing.x += top[0];
|
|
|
|
builder->advance.x = top[1];
|
|
|
|
builder->advance.y = 0;
|
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
orig_x = builder->last.x = x = builder->pos_x + top[0];
|
|
|
|
orig_y = builder->last.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 );
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* the `metrics_only' indicates that we only want to compute */
|
|
|
|
/* the glyph's metrics (lsb + advance width), not load the */
|
|
|
|
/* rest of it; so exit immediately */
|
|
|
|
if ( builder->metrics_only )
|
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
|
|
|
return PSaux_Err_Ok;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_seac:
|
|
|
|
/* return immediately after the processing */
|
|
|
|
return t1operator_seac( decoder, top[0], top[1],
|
|
|
|
top[2], top[3], top[4] );
|
|
|
|
|
|
|
|
case op_sbw:
|
|
|
|
FT_TRACE4(( " sbw" ));
|
|
|
|
|
|
|
|
builder->left_bearing.x += top[0];
|
|
|
|
builder->left_bearing.y += top[1];
|
|
|
|
builder->advance.x = top[2];
|
|
|
|
builder->advance.y = top[3];
|
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
builder->last.x = x = builder->pos_x + top[0];
|
|
|
|
builder->last.y = y = builder->pos_y + top[1];
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
/* the `metrics_only' indicates that we only want to compute */
|
|
|
|
/* the glyph's metrics (lsb + advance width), not load the */
|
|
|
|
/* rest of it; so exit immediately */
|
|
|
|
if ( builder->metrics_only )
|
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
|
|
|
return PSaux_Err_Ok;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_closepath:
|
|
|
|
FT_TRACE4(( " closepath" ));
|
|
|
|
|
|
|
|
close_contour( builder );
|
|
|
|
builder->path_begun = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_hlineto:
|
|
|
|
FT_TRACE4(( " hlineto" ));
|
|
|
|
|
|
|
|
if ( start_point( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
x += top[0];
|
|
|
|
goto Add_Line;
|
|
|
|
|
|
|
|
case op_hmoveto:
|
|
|
|
FT_TRACE4(( " hmoveto" ));
|
|
|
|
|
|
|
|
x += top[0];
|
2000-10-09 03:44:40 +02:00
|
|
|
if ( !decoder->flex_state )
|
|
|
|
builder->path_begun = 0;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_hvcurveto:
|
|
|
|
FT_TRACE4(( " hvcurveto" ));
|
|
|
|
|
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 3 ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
x += top[0];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
x += top[1];
|
|
|
|
y += top[2];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
y += top[3];
|
|
|
|
add_point( builder, x, y, 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_rlineto:
|
|
|
|
FT_TRACE4(( " rlineto" ));
|
|
|
|
|
|
|
|
if ( start_point( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
x += top[0];
|
|
|
|
y += top[1];
|
|
|
|
|
|
|
|
Add_Line:
|
|
|
|
if ( add_point1( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_rmoveto:
|
|
|
|
FT_TRACE4(( " rmoveto" ));
|
|
|
|
|
|
|
|
x += top[0];
|
|
|
|
y += top[1];
|
2000-10-09 03:44:40 +02:00
|
|
|
if ( !decoder->flex_state )
|
|
|
|
builder->path_begun = 0;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_rrcurveto:
|
|
|
|
FT_TRACE4(( " rcurveto" ));
|
|
|
|
|
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 3 ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
x += top[0];
|
|
|
|
y += top[1];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
|
|
|
|
x += top[2];
|
|
|
|
y += top[3];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
|
|
|
|
x += top[4];
|
|
|
|
y += top[5];
|
|
|
|
add_point( builder, x, y, 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vhcurveto:
|
|
|
|
FT_TRACE4(( " vhcurveto" ));
|
|
|
|
|
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 3 ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
y += top[0];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
x += top[1];
|
|
|
|
y += top[2];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
x += top[3];
|
|
|
|
add_point( builder, x, y, 1 );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vlineto:
|
|
|
|
FT_TRACE4(( " vlineto" ));
|
|
|
|
|
|
|
|
if ( start_point( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
y += top[0];
|
|
|
|
goto Add_Line;
|
|
|
|
|
|
|
|
case op_vmoveto:
|
|
|
|
FT_TRACE4(( " vmoveto" ));
|
|
|
|
|
|
|
|
y += top[0];
|
2000-10-09 03:44:40 +02:00
|
|
|
if ( !decoder->flex_state )
|
|
|
|
builder->path_begun = 0;
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_div:
|
|
|
|
FT_TRACE4(( " div" ));
|
|
|
|
|
|
|
|
if ( top[1] )
|
|
|
|
{
|
|
|
|
*top = top[0] / top[1];
|
|
|
|
++top;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: division by 0\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
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" ));
|
|
|
|
|
* 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 = top[0];
|
|
|
|
if ( idx < 0 || idx >= (FT_Int)decoder->num_subrs )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"invalid subrs index\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"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 )
|
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01: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" ));
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
/* theoretically, the arguments are already on the stack */
|
2000-08-23 00:36:33 +02:00
|
|
|
top++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_return:
|
|
|
|
FT_TRACE4(( " return" ));
|
|
|
|
|
|
|
|
if ( zone <= decoder->zones )
|
|
|
|
{
|
2002-03-31 13:18:15 +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 );
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vstem:
|
|
|
|
FT_TRACE4(( " vstem" ));
|
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
/* record vertical hint */
|
|
|
|
if ( hinter )
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
top[0] += dx;
|
|
|
|
top[2] += dx;
|
|
|
|
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" ));
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: " ));
|
2001-03-12 23:33:52 +01:00
|
|
|
FT_ERROR(( "unexpected `setcurrentpoint'\n" ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
|
|
|
|
default:
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Parse_Charstrings: "
|
2001-03-12 23:33:52 +01:00
|
|
|
"unhandled opcode %d\n", op ));
|
2000-08-23 00:36:33 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
decoder->top = top;
|
|
|
|
|
|
|
|
} /* general operator processing */
|
|
|
|
|
|
|
|
} /* while ip < limit */
|
|
|
|
|
|
|
|
FT_TRACE4(( "..end..\n\n" ));
|
2001-10-18 13:49:26 +02:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
return error;
|
|
|
|
|
|
|
|
Syntax_Error:
|
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
|
|
|
return PSaux_Err_Syntax_Error;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
Stack_Underflow:
|
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
|
|
|
return PSaux_Err_Stack_Underflow;
|
2000-08-23 00:36:33 +02:00
|
|
|
|
|
|
|
Memory_Error:
|
|
|
|
return builder->error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
/* parse a single Type 1 glyph */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_Decoder_Parse_Glyph( T1_Decoder decoder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_UInt glyph )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2000-08-23 04:47:57 +02:00
|
|
|
return decoder->parse_callback( decoder, glyph );
|
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 )
|
2002-03-31 13:18:15 +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,
|
2001-06-27 21:46:12 +02:00
|
|
|
T1_Decoder_Callback parse_callback )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2002-07-28 07:05:24 +02:00
|
|
|
FT_MEM_ZERO( decoder, sizeof ( *decoder ) );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
/* retrieve PSNames interface from list of current modules */
|
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
PSNames_Service psnames = 0;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
psnames = (PSNames_Service)FT_Get_Module_Interface(
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_FACE_LIBRARY(face), "psnames" );
|
2000-08-23 19:32:42 +02:00
|
|
|
if ( !psnames )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
2000-08-23 19:32:42 +02:00
|
|
|
FT_ERROR(( "T1_Decoder_Init: " ));
|
|
|
|
FT_ERROR(( "the `psnames' module is not available\n" ));
|
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
|
|
|
return PSaux_Err_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
|
|
|
|
2001-10-18 13:49:26 +02:00
|
|
|
T1_Builder_Init( &decoder->builder, face, size, slot, hinting );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 04:47:57 +02:00
|
|
|
decoder->num_glyphs = face->num_glyphs;
|
|
|
|
decoder->glyph_names = glyph_names;
|
* include/freetype/freetype.h, src/base/ftobjs.h,
freetype/internal/ftobjs.h, freetype/internal/psaux.h,
freetype/internal/pshints.h, src/psaux/t1decode.c, src/cff/cffgload.h,
src/cff/cffgload.c, src/pshinter/pshalgo1.h, src/pshinter/pshalgo1.c,
src/pshinter/pshalgo2.h, src/pshinter/pshalgo2.c, src/pshinter/pshalgo3.h,
src/pshinter/pshalgo3.c: Adding support for hinter-specific bit flags,
and the new FT_Set_Hint_Flags high-level API
2002-07-09 00:26:11 +02:00
|
|
|
decoder->hint_flags = face->internal->hint_flags;
|
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
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
/* finalize T1 decoder */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_Decoder_Done( T1_Decoder decoder )
|
2000-08-23 00:36:33 +02:00
|
|
|
{
|
|
|
|
T1_Builder_Done( &decoder->builder );
|
|
|
|
}
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
|
|
|
/* END */
|