2000-06-16 08:49:56 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* cidload.c */
|
|
|
|
/* */
|
|
|
|
/* CID-keyed Type1 font loader (body). */
|
|
|
|
/* */
|
2002-03-30 18:08:04 +01:00
|
|
|
/* Copyright 1996-2001, 2002 by */
|
2000-06-16 08:49:56 +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
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_CONFIG_CONFIG_H
|
|
|
|
#include FT_MULTIPLE_MASTERS_H
|
|
|
|
#include FT_INTERNAL_TYPE1_TYPES_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 "cidload.h"
|
2000-12-08 17:17:16 +01: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 "ciderrs.h"
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +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-06-01 05:27:48 +02:00
|
|
|
#undef FT_COMPONENT
|
2000-06-16 08:49:56 +02:00
|
|
|
#define FT_COMPONENT trace_cidload
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-07-01 00:24:36 +02:00
|
|
|
/* read a single offset */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Long )
|
2001-06-27 21:46:12 +02:00
|
|
|
cid_get_offset( FT_Byte** start,
|
|
|
|
FT_Byte offsize )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Long result;
|
|
|
|
FT_Byte* p = *start;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
for ( result = 0; offsize > 0; offsize-- )
|
2000-07-01 00:24:36 +02:00
|
|
|
{
|
|
|
|
result <<= 8;
|
|
|
|
result |= *p++;
|
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
*start = p;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
2001-06-27 21:46:12 +02:00
|
|
|
cid_decrypt( FT_Byte* buffer,
|
|
|
|
FT_Offset length,
|
|
|
|
FT_UShort seed )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
while ( length > 0 )
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Byte plain;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2001-06-19 10:28:24 +02:00
|
|
|
plain = (FT_Byte)( *buffer ^ ( seed >> 8 ) );
|
2001-07-03 14:45:24 +02:00
|
|
|
seed = (FT_UShort)( ( *buffer + seed ) * 52845U + 22719 );
|
2000-06-01 05:27:48 +02:00
|
|
|
*buffer++ = plain;
|
|
|
|
length--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** TYPE 1 SYMBOL PARSING *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Error
|
2002-03-30 18:08:04 +01:00
|
|
|
cid_load_keyword( CID_Face face,
|
|
|
|
CID_Loader* loader,
|
2002-02-28 17:10:29 +01:00
|
|
|
const T1_Field keyword )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2002-03-30 18:08:04 +01:00
|
|
|
FT_Error error;
|
|
|
|
CID_Parser* parser = &loader->parser;
|
|
|
|
FT_Byte* object;
|
|
|
|
void* dummy_object;
|
|
|
|
CID_FaceInfo cid = &face->cid;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* if the keyword has a dedicated callback, call it */
|
2002-02-28 17:10:29 +01:00
|
|
|
if ( keyword->type == T1_FIELD_TYPE_CALLBACK )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-08-24 00:47:44 +02:00
|
|
|
keyword->reader( (FT_Face)face, parser );
|
|
|
|
error = parser->root.error;
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we must now compute the address of our target object */
|
2000-06-16 08:49:56 +02:00
|
|
|
switch ( keyword->location )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2002-03-14 11:09:35 +01:00
|
|
|
case T1_FIELD_LOCATION_CID_INFO:
|
2000-06-16 21:34:52 +02:00
|
|
|
object = (FT_Byte*)cid;
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
|
|
|
|
2002-03-14 11:09:35 +01:00
|
|
|
case T1_FIELD_LOCATION_FONT_INFO:
|
2000-06-16 21:34:52 +02:00
|
|
|
object = (FT_Byte*)&cid->font_info;
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
{
|
2002-02-28 19:59:37 +01:00
|
|
|
CID_FaceDict dict;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( parser->num_dict < 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "cid_load_keyword: invalid use of `%s'!\n",
|
|
|
|
keyword->ident ));
|
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
|
|
|
error = CID_Err_Syntax_Error;
|
2000-06-16 08:49:56 +02:00
|
|
|
goto Exit;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
dict = cid->font_dicts + parser->num_dict;
|
|
|
|
switch ( keyword->location )
|
|
|
|
{
|
2002-03-14 11:09:35 +01:00
|
|
|
case T1_FIELD_LOCATION_PRIVATE:
|
2000-06-16 21:34:52 +02:00
|
|
|
object = (FT_Byte*)&dict->private_dict;
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2000-06-16 21:34:52 +02:00
|
|
|
object = (FT_Byte*)dict;
|
2000-06-16 08:49:56 +02:00
|
|
|
}
|
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-08-24 00:47:44 +02:00
|
|
|
dummy_object = object;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* now, load the keyword data in the object's field(s) */
|
2002-02-28 17:10:29 +01:00
|
|
|
if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
|
|
|
|
keyword->type == T1_FIELD_TYPE_FIXED_ARRAY )
|
2000-08-24 00:47:44 +02:00
|
|
|
error = CID_Load_Field_Table( &loader->parser, keyword,
|
|
|
|
&dummy_object );
|
2000-06-01 05:27:48 +02:00
|
|
|
else
|
2000-08-24 00:47:44 +02:00
|
|
|
error = CID_Load_Field( &loader->parser, keyword, &dummy_object );
|
2000-06-01 05:27:48 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
2000-06-16 08:49:56 +02:00
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2001-06-27 11:26:46 +02:00
|
|
|
parse_font_bbox( CID_Face face,
|
|
|
|
CID_Parser* parser )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2001-03-10 20:04:41 +01:00
|
|
|
FT_Fixed temp[4];
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_BBox* bbox = &face->cid.font_bbox;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2001-03-10 20:04:41 +01:00
|
|
|
(void)CID_ToFixedArray( parser, 4, temp, 0 );
|
|
|
|
bbox->xMin = FT_RoundFix( temp[0] );
|
|
|
|
bbox->yMin = FT_RoundFix( temp[1] );
|
|
|
|
bbox->xMax = FT_RoundFix( temp[2] );
|
|
|
|
bbox->yMax = FT_RoundFix( temp[3] );
|
2000-06-16 08:49:56 +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
|
|
|
return CID_Err_Ok; /* this is a callback function; */
|
2000-06-16 08:49:56 +02:00
|
|
|
/* we must return an error code */
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2001-06-27 11:26:46 +02:00
|
|
|
parse_font_matrix( CID_Face face,
|
|
|
|
CID_Parser* parser )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2002-03-30 18:08:04 +01:00
|
|
|
FT_Matrix* matrix;
|
|
|
|
FT_Vector* offset;
|
2002-02-28 19:59:37 +01:00
|
|
|
CID_FaceDict dict;
|
2002-03-30 18:08:04 +01:00
|
|
|
FT_Face root = (FT_Face)&face->root;
|
|
|
|
FT_Fixed temp[6];
|
|
|
|
FT_Fixed temp_scale;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2001-03-11 12:28:39 +01:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( parser->num_dict >= 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
dict = face->cid.font_dicts + parser->num_dict;
|
|
|
|
matrix = &dict->font_matrix;
|
2000-08-24 00:47:44 +02:00
|
|
|
offset = &dict->font_offset;
|
|
|
|
|
|
|
|
(void)CID_ToFixedArray( parser, 6, temp, 3 );
|
|
|
|
|
2001-03-10 20:04:41 +01:00
|
|
|
temp_scale = ABS( temp[3] );
|
|
|
|
|
2001-03-11 12:28:39 +01:00
|
|
|
/* Set Units per EM based on FontMatrix values. We set the value to */
|
|
|
|
/* `1000/temp_scale', because temp_scale was already multiplied by */
|
|
|
|
/* 1000 (in t1_tofixed(), from psobjs.c). */
|
2001-03-19 12:34:49 +01:00
|
|
|
root->units_per_EM = (FT_UShort)( FT_DivFix( 0x10000L,
|
2001-05-11 20:08:58 +02:00
|
|
|
FT_DivFix( temp_scale, 1000 ) ) );
|
2001-03-10 20:04:41 +01:00
|
|
|
|
2000-08-24 00:47:44 +02:00
|
|
|
/* we need to scale the values by 1.0/temp[3] */
|
2001-03-10 20:04:41 +01:00
|
|
|
if ( temp_scale != 0x10000L )
|
2000-08-24 00:47:44 +02:00
|
|
|
{
|
2001-03-10 20:04:41 +01:00
|
|
|
temp[0] = FT_DivFix( temp[0], temp_scale );
|
|
|
|
temp[1] = FT_DivFix( temp[1], temp_scale );
|
|
|
|
temp[2] = FT_DivFix( temp[2], temp_scale );
|
|
|
|
temp[4] = FT_DivFix( temp[4], temp_scale );
|
|
|
|
temp[5] = FT_DivFix( temp[5], temp_scale );
|
2000-08-24 00:47:44 +02:00
|
|
|
temp[3] = 0x10000L;
|
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
matrix->xx = temp[0];
|
|
|
|
matrix->yx = temp[1];
|
|
|
|
matrix->xy = temp[2];
|
|
|
|
matrix->yy = temp[3];
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-05 06:53:31 +02:00
|
|
|
/* note that the font offsets are expressed in integer font units */
|
2000-10-04 00:03:09 +02:00
|
|
|
offset->x = temp[4] >> 16;
|
|
|
|
offset->y = temp[5] >> 16;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +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
|
|
|
return CID_Err_Ok; /* this is a callback function; */
|
2000-06-16 08:49:56 +02:00
|
|
|
/* we must return an error code */
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2001-06-27 11:26:46 +02:00
|
|
|
parse_fd_array( CID_Face face,
|
|
|
|
CID_Parser* parser )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2002-02-28 19:59:37 +01:00
|
|
|
CID_FaceInfo cid = &face->cid;
|
2002-03-30 18:08:04 +01:00
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
FT_Error error = CID_Err_Ok;
|
|
|
|
FT_Long num_dicts;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
num_dicts = CID_ToInt( parser );
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
if ( !cid->font_dicts )
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int n;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_NEW_ARRAY( cid->font_dicts, num_dicts ) )
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Exit;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
cid->num_dicts = (FT_UInt)num_dicts;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
/* don't forget to set a few defaults */
|
2000-06-01 05:27:48 +02:00
|
|
|
for ( n = 0; n < cid->num_dicts; n++ )
|
|
|
|
{
|
2002-02-28 19:59:37 +01:00
|
|
|
CID_FaceDict dict = cid->font_dicts + n;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* default value for lenIV */
|
2000-06-01 05:27:48 +02:00
|
|
|
dict->private_dict.lenIV = 4;
|
|
|
|
}
|
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
2002-02-28 17:10:29 +01:00
|
|
|
const T1_FieldRec cid_field_records[] =
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-07-08 21:51:42 +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 "cidtoken.h"
|
2000-07-08 21:51:42 +02:00
|
|
|
|
2000-08-24 00:47:44 +02:00
|
|
|
T1_FIELD_CALLBACK( "FontBBox", parse_font_bbox )
|
|
|
|
T1_FIELD_CALLBACK( "FDArray", parse_fd_array )
|
|
|
|
T1_FIELD_CALLBACK( "FontMatrix", parse_font_matrix )
|
2002-03-14 11:09:35 +01:00
|
|
|
{ 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0 }
|
2000-06-01 05:27:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static int
|
|
|
|
is_alpha( char c )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
* 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
|
|
|
return ( ft_isalnum( (int)c ) ||
|
2000-07-31 14:14:27 +02:00
|
|
|
c == '.' ||
|
|
|
|
c == '_' );
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Error
|
|
|
|
cid_parse_dict( CID_Face face,
|
|
|
|
CID_Loader* loader,
|
|
|
|
FT_Byte* base,
|
|
|
|
FT_Long size )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
CID_Parser* parser = &loader->parser;
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-08-24 00:47:44 +02:00
|
|
|
parser->root.cursor = base;
|
|
|
|
parser->root.limit = base + size;
|
|
|
|
parser->root.error = 0;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Byte* cur = base;
|
|
|
|
FT_Byte* limit = cur + size;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
for ( ;cur < limit; cur++ )
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
/* look for `%ADOBeginFontDict' */
|
2000-06-01 05:27:48 +02:00
|
|
|
if ( *cur == '%' && cur + 20 < limit &&
|
* 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_strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
cur += 17;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* if /FDArray was found, then cid->num_dicts is > 0, and */
|
|
|
|
/* we can start increasing parser->num_dict */
|
|
|
|
if ( face->cid.num_dicts > 0 )
|
|
|
|
parser->num_dict++;
|
|
|
|
}
|
|
|
|
/* look for immediates */
|
2000-06-16 08:49:56 +02:00
|
|
|
else if ( *cur == '/' && cur + 2 < limit )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Byte* cur2;
|
|
|
|
FT_Int len;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
cur++;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
cur2 = cur;
|
2000-06-16 08:49:56 +02:00
|
|
|
while ( cur2 < limit && is_alpha( *cur2 ) )
|
|
|
|
cur2++;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2001-03-10 18:07:42 +01:00
|
|
|
len = (FT_Int)( cur2 - cur );
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( len > 0 && len < 22 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-07-01 00:24:36 +02:00
|
|
|
/* now compare the immediate name to the keyword table */
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_Field keyword = (T1_Field) cid_field_records;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
for (;;)
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Byte* name;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
name = (FT_Byte*)keyword->ident;
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( !name )
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( cur[0] == 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
|
|
|
len == (FT_Int)ft_strlen( (const char*)name ) )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int n;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
for ( n = 1; n < len; n++ )
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( cur[n] != name[n] )
|
2000-06-01 05:27:48 +02:00
|
|
|
break;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( n >= len )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
/* we found it - run the parsing callback */
|
2000-08-24 00:47:44 +02:00
|
|
|
parser->root.cursor = cur2;
|
|
|
|
CID_Skip_Spaces( parser );
|
2000-08-24 18:29:15 +02:00
|
|
|
parser->root.error = cid_load_keyword( face,
|
|
|
|
loader,
|
|
|
|
keyword );
|
2000-08-24 00:47:44 +02:00
|
|
|
if ( parser->root.error )
|
|
|
|
return parser->root.error;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-08-24 00:47:44 +02:00
|
|
|
cur = parser->root.cursor;
|
2000-06-01 05:27:48 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
keyword++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-08-24 00:47:44 +02:00
|
|
|
return parser->root.error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* read the subrmap and the subrs of each font dict */
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Error
|
|
|
|
cid_read_subrs( CID_Face face )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2002-03-30 18:08:04 +01:00
|
|
|
CID_FaceInfo cid = &face->cid;
|
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
FT_Stream stream = face->root.stream;
|
|
|
|
FT_Error error;
|
|
|
|
FT_Int n;
|
|
|
|
CID_Subrs subr;
|
|
|
|
FT_UInt max_offsets = 0;
|
|
|
|
FT_ULong* offsets = 0;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_NEW_ARRAY( face->subrs, cid->num_dicts ) )
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Exit;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
subr = face->subrs;
|
|
|
|
for ( n = 0; n < cid->num_dicts; n++, subr++ )
|
|
|
|
{
|
2002-02-28 19:59:37 +01:00
|
|
|
CID_FaceDict dict = cid->font_dicts + n;
|
2002-03-30 18:08:04 +01:00
|
|
|
FT_Int lenIV = dict->private_dict.lenIV;
|
|
|
|
FT_UInt count, num_subrs = dict->num_subrs;
|
|
|
|
FT_ULong data_len;
|
|
|
|
FT_Byte* p;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* reallocate offsets array if needed */
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( num_subrs + 1 > max_offsets )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UInt new_max = ( num_subrs + 1 + 3 ) & -4;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Fail;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
max_offsets = new_max;
|
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* read the subrmap's offsets */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||
|
|
|
|
FT_FRAME_ENTER( ( num_subrs + 1 ) * dict->sd_bytes ) )
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Fail;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
p = (FT_Byte*)stream->cursor;
|
|
|
|
for ( count = 0; count <= num_subrs; count++ )
|
2000-06-28 06:19:49 +02:00
|
|
|
offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes );
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
/* now, compute the size of subrs charstrings, */
|
|
|
|
/* allocate, and read them */
|
2000-06-01 05:27:48 +02:00
|
|
|
data_len = offsets[num_subrs] - offsets[0];
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
|
|
|
|
FT_ALLOC( subr->code[0], data_len ) )
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Fail;
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
|
|
|
|
FT_STREAM_READ( subr->code[0], data_len ) )
|
2001-12-21 16:26:19 +01:00
|
|
|
goto Fail;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
/* set up pointers */
|
|
|
|
for ( count = 1; count <= num_subrs; count++ )
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UInt len;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
len = offsets[count] - offsets[count - 1];
|
|
|
|
subr->code[count] = subr->code[count - 1] + len;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2001-03-12 23:33:52 +01:00
|
|
|
/* decrypt subroutines, but only if lenIV >= 0 */
|
2001-03-12 03:17:50 +01:00
|
|
|
if ( lenIV >= 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2001-03-12 03:17:50 +01:00
|
|
|
for ( count = 0; count < num_subrs; count++ )
|
|
|
|
{
|
|
|
|
FT_UInt len;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2001-03-12 03:17:50 +01:00
|
|
|
len = offsets[count + 1] - offsets[count];
|
|
|
|
cid_decrypt( subr->code[count], len, 4330 );
|
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
subr->num_subrs = num_subrs;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( offsets );
|
2000-06-01 05:27:48 +02:00
|
|
|
return error;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
Fail:
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( face->subrs )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
for ( n = 0; n < cid->num_dicts; n++ )
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( face->subrs[n].code )
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->subrs[n].code[0] );
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->subrs[n].code );
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->subrs );
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static void
|
|
|
|
t1_init_loader( CID_Loader* loader,
|
|
|
|
CID_Face face )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-07-04 20:12:13 +02:00
|
|
|
FT_UNUSED( face );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_MEM_SET( loader, 0, sizeof ( *loader ) );
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static void
|
|
|
|
t1_done_loader( CID_Loader* loader )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
CID_Parser* parser = &loader->parser;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* finalize parser */
|
|
|
|
CID_Done_Parser( parser );
|
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2001-06-27 21:46:12 +02:00
|
|
|
CID_Open_Face( CID_Face face )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2002-03-30 18:08:04 +01:00
|
|
|
CID_Loader loader;
|
|
|
|
CID_Parser* parser;
|
|
|
|
FT_Error error;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
t1_init_loader( &loader, face );
|
|
|
|
|
|
|
|
parser = &loader.parser;
|
2000-08-24 00:47:44 +02:00
|
|
|
error = CID_New_Parser( parser, face->root.stream, face->root.memory,
|
2002-02-28 17:10:29 +01:00
|
|
|
(PSAux_Service)face->psaux );
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-08-24 00:47:44 +02:00
|
|
|
error = cid_parse_dict( face, &loader,
|
|
|
|
parser->postscript,
|
|
|
|
parser->postscript_len );
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
face->cid.data_offset = loader.parser.data_offset;
|
|
|
|
error = cid_read_subrs( face );
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
Exit:
|
|
|
|
t1_done_loader( &loader );
|
|
|
|
return error;
|
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* END */
|