Compare commits
42 Commits
master
...
GSoC-2017-
Author | SHA1 | Date |
---|---|---|
Ewald Hew | 423d7cf165 | |
Ewald Hew | ea2f74f982 | |
Ewald Hew | 14c9575aea | |
Ewald Hew | 7e7764219f | |
Ewald Hew | 8327323b32 | |
Ewald Hew | 57b7f9fe78 | |
Ewald Hew | aedfc70e1e | |
Ewald Hew | e92f031fc6 | |
Ewald Hew | 270b0c5734 | |
Ewald Hew | 46a062c50b | |
Ewald Hew | 150c98952d | |
Ewald Hew | f5d196a29e | |
Ewald Hew | 0ccdc5f3be | |
Ewald Hew | 2e33c29f5e | |
Ewald Hew | 5c1a732d66 | |
Ewald Hew | 9e2dc76299 | |
Ewald Hew | d5ea39a756 | |
Ewald Hew | df637f79df | |
Ewald Hew | d980305f11 | |
Ewald Hew | be82fc50b9 | |
Ewald Hew | 7927aff510 | |
Ewald Hew | a4b0acf332 | |
Ewald Hew | ab3455a38e | |
Ewald Hew | 3c20490ae4 | |
Ewald Hew | e8d9b1a782 | |
Ewald Hew | daed878ee2 | |
Ewald Hew | aa6121a3ac | |
Ewald Hew | f1976a37f4 | |
Ewald Hew | 8e2bc02189 | |
Ewald Hew | 74226dd137 | |
Ewald Hew | 0d8c52714d | |
Ewald Hew | d6983de532 | |
Ewald Hew | 2cef133e54 | |
Ewald Hew | bab8bc2d57 | |
Ewald Hew | 04ff306700 | |
Ewald Hew | 0bcf12540b | |
Ewald Hew | d3a49b8611 | |
Ewald Hew | 0f1a34023f | |
Ewald Hew | f174295aeb | |
Ewald Hew | 3905ac526e | |
Ewald Hew | 172784184d | |
Ewald Hew | a650c95473 |
|
@ -367,6 +367,19 @@
|
||||||
#define FT_PCF_DRIVER_H <freetype/ftpcfdrv.h>
|
#define FT_PCF_DRIVER_H <freetype/ftpcfdrv.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************
|
||||||
|
*
|
||||||
|
* @macro:
|
||||||
|
* FT_TYPE1_DRIVER_H
|
||||||
|
*
|
||||||
|
* @description:
|
||||||
|
* A macro used in #include statements to name the file containing
|
||||||
|
* structures and macros related to the Type~1 driver module.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define FT_TYPE1_DRIVER_H <freetype/ftt1drv.h>
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
*
|
*
|
||||||
* @macro:
|
* @macro:
|
||||||
|
|
|
@ -0,0 +1,116 @@
|
||||||
|
/***************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* ftt1drv.h */
|
||||||
|
/* */
|
||||||
|
/* FreeType API for controlling the Type 1 driver (specification only). */
|
||||||
|
/* */
|
||||||
|
/* Copyright 2013-2017 by */
|
||||||
|
/* 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. */
|
||||||
|
/* */
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef FTT1DRV_H_
|
||||||
|
#define FTT1DRV_H_
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
|
#ifdef FREETYPE_H
|
||||||
|
#error "freetype.h of FreeType 1 has been loaded!"
|
||||||
|
#error "Please fix the directory search order for header files"
|
||||||
|
#error "so that freetype.h of FreeType 2 is found first."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* @property:
|
||||||
|
* hinting-engine[type1]
|
||||||
|
*
|
||||||
|
* @description:
|
||||||
|
* Thanks to Adobe, which contributed a new hinting (and parsing)
|
||||||
|
* engine, an application can select between `freetype' and `adobe' if
|
||||||
|
* compiled with T1_CONFIG_OPTION_OLD_ENGINE. If this configuration
|
||||||
|
* macro isn't defined, `hinting-engine' does nothing.
|
||||||
|
*
|
||||||
|
* The default engine is `freetype' if T1_CONFIG_OPTION_OLD_ENGINE is
|
||||||
|
* defined, and `adobe' otherwise.
|
||||||
|
*
|
||||||
|
* The following example code demonstrates how to select Adobe's hinting
|
||||||
|
* engine (omitting the error handling).
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* FT_Library library;
|
||||||
|
* FT_UInt hinting_engine = FT_T1_HINTING_ADOBE;
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* FT_Init_FreeType( &library );
|
||||||
|
*
|
||||||
|
* FT_Property_Set( library, "type1",
|
||||||
|
* "hinting-engine", &hinting_engine );
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @note:
|
||||||
|
* This property can be used with @FT_Property_Get also.
|
||||||
|
*
|
||||||
|
* This property can be set via the `FREETYPE_PROPERTIES' environment
|
||||||
|
* variable (using values `adobe' or `freetype').
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* @enum:
|
||||||
|
* FT_T1_HINTING_XXX
|
||||||
|
*
|
||||||
|
* @description:
|
||||||
|
* A list of constants used for the @hinting-engine[type1] property to
|
||||||
|
* select the hinting engine for Type 1 fonts.
|
||||||
|
*
|
||||||
|
* @values:
|
||||||
|
* FT_T1_HINTING_FREETYPE ::
|
||||||
|
* Use the old FreeType hinting engine.
|
||||||
|
*
|
||||||
|
* FT_T1_HINTING_ADOBE ::
|
||||||
|
* Use the hinting engine contributed by Adobe.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define FT_T1_HINTING_FREETYPE 0
|
||||||
|
#define FT_T1_HINTING_ADOBE 1
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
*
|
||||||
|
* @constant:
|
||||||
|
* FT_PARAM_TAG_RANDOM_SEED
|
||||||
|
*
|
||||||
|
* @description:
|
||||||
|
* An @FT_Parameter tag to be used with @FT_Face_Properties. The
|
||||||
|
* corresponding 32bit signed integer argument overrides the CFF
|
||||||
|
* module's random seed value with a face-specific one; see
|
||||||
|
* @random-seed.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define FT_PARAM_TAG_RANDOM_SEED \
|
||||||
|
FT_MAKE_TAG( 's', 'e', 'e', 'd' )
|
||||||
|
|
||||||
|
/* */
|
||||||
|
|
||||||
|
|
||||||
|
FT_END_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* FTT1DRV_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -0,0 +1,101 @@
|
||||||
|
/***************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* cffotypes.h */
|
||||||
|
/* */
|
||||||
|
/* Basic OpenType/CFF object type definitions (specification). */
|
||||||
|
/* */
|
||||||
|
/* Copyright notice here. */
|
||||||
|
/* */
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CFFOTYPES_H_
|
||||||
|
#define CFFOTYPES_H_
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_INTERNAL_OBJECTS_H
|
||||||
|
#include FT_INTERNAL_CFF_TYPES_H
|
||||||
|
#include FT_INTERNAL_TRUETYPE_TYPES_H
|
||||||
|
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
||||||
|
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||||
|
|
||||||
|
|
||||||
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
typedef TT_Face CFF_Face;
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Type> */
|
||||||
|
/* CFF_Size */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* A handle to an OpenType size object. */
|
||||||
|
/* */
|
||||||
|
typedef struct CFF_SizeRec_
|
||||||
|
{
|
||||||
|
FT_SizeRec root;
|
||||||
|
FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */
|
||||||
|
|
||||||
|
} CFF_SizeRec, *CFF_Size;
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Type> */
|
||||||
|
/* CFF_GlyphSlot */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* A handle to an OpenType glyph slot object. */
|
||||||
|
/* */
|
||||||
|
typedef struct CFF_GlyphSlotRec_
|
||||||
|
{
|
||||||
|
FT_GlyphSlotRec root;
|
||||||
|
|
||||||
|
FT_Bool hint;
|
||||||
|
FT_Bool scaled;
|
||||||
|
|
||||||
|
FT_Fixed x_scale;
|
||||||
|
FT_Fixed y_scale;
|
||||||
|
|
||||||
|
} CFF_GlyphSlotRec, *CFF_GlyphSlot;
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Type> */
|
||||||
|
/* CFF_Internal */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* The interface to the `internal' field of `FT_Size'. */
|
||||||
|
/* */
|
||||||
|
typedef struct CFF_InternalRec_
|
||||||
|
{
|
||||||
|
PSH_Globals topfont;
|
||||||
|
PSH_Globals subfonts[CFF_MAX_CID_FONTS];
|
||||||
|
|
||||||
|
} CFF_InternalRec, *CFF_Internal;
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* Subglyph transformation record. */
|
||||||
|
/* */
|
||||||
|
typedef struct CFF_Transform_
|
||||||
|
{
|
||||||
|
FT_Fixed xx, xy; /* transformation matrix coefficients */
|
||||||
|
FT_Fixed yx, yy;
|
||||||
|
FT_F26Dot6 ox, oy; /* offsets */
|
||||||
|
|
||||||
|
} CFF_Transform;
|
||||||
|
|
||||||
|
|
||||||
|
FT_END_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* CFFOTYPES_H_ */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -381,6 +381,9 @@ FT_BEGIN_HEADER
|
||||||
/* interface to Postscript Names service */
|
/* interface to Postscript Names service */
|
||||||
FT_Service_PsCMaps psnames;
|
FT_Service_PsCMaps psnames;
|
||||||
|
|
||||||
|
/* interface to CFFLoad service */
|
||||||
|
const void* cffload;
|
||||||
|
|
||||||
/* since version 2.3.0 */
|
/* since version 2.3.0 */
|
||||||
PS_FontInfoRec* font_info; /* font info dictionary */
|
PS_FontInfoRec* font_info; /* font info dictionary */
|
||||||
|
|
|
@ -330,6 +330,32 @@ FT_BEGIN_HEADER
|
||||||
{ NULL, NULL } \
|
{ NULL, NULL } \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define FT_DEFINE_SERVICEDESCREC10( class_, \
|
||||||
|
serv_id_1, serv_data_1, \
|
||||||
|
serv_id_2, serv_data_2, \
|
||||||
|
serv_id_3, serv_data_3, \
|
||||||
|
serv_id_4, serv_data_4, \
|
||||||
|
serv_id_5, serv_data_5, \
|
||||||
|
serv_id_6, serv_data_6, \
|
||||||
|
serv_id_7, serv_data_7, \
|
||||||
|
serv_id_8, serv_data_8, \
|
||||||
|
serv_id_9, serv_data_9, \
|
||||||
|
serv_id_10, serv_data_10) \
|
||||||
|
static const FT_ServiceDescRec class_[] = \
|
||||||
|
{ \
|
||||||
|
{ serv_id_1, serv_data_1 }, \
|
||||||
|
{ serv_id_2, serv_data_2 }, \
|
||||||
|
{ serv_id_3, serv_data_3 }, \
|
||||||
|
{ serv_id_4, serv_data_4 }, \
|
||||||
|
{ serv_id_5, serv_data_5 }, \
|
||||||
|
{ serv_id_6, serv_data_6 }, \
|
||||||
|
{ serv_id_7, serv_data_7 }, \
|
||||||
|
{ serv_id_8, serv_data_8 }, \
|
||||||
|
{ serv_id_9, serv_data_9 }, \
|
||||||
|
{ serv_id_10, serv_data_10 }, \
|
||||||
|
{ NULL, NULL } \
|
||||||
|
};
|
||||||
|
|
||||||
#else /* FT_CONFIG_OPTION_PIC */
|
#else /* FT_CONFIG_OPTION_PIC */
|
||||||
|
|
||||||
#define FT_DEFINE_SERVICEDESCREC1( class_, \
|
#define FT_DEFINE_SERVICEDESCREC1( class_, \
|
||||||
|
@ -755,6 +781,68 @@ FT_BEGIN_HEADER
|
||||||
return FT_Err_Ok; \
|
return FT_Err_Ok; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define FT_DEFINE_SERVICEDESCREC10( class_, \
|
||||||
|
serv_id_1, serv_data_1, \
|
||||||
|
serv_id_2, serv_data_2, \
|
||||||
|
serv_id_3, serv_data_3, \
|
||||||
|
serv_id_4, serv_data_4, \
|
||||||
|
serv_id_5, serv_data_5, \
|
||||||
|
serv_id_6, serv_data_6, \
|
||||||
|
serv_id_7, serv_data_7, \
|
||||||
|
serv_id_8, serv_data_8, \
|
||||||
|
serv_id_9, serv_data_9, \
|
||||||
|
serv_id_10, serv_data_10 ) \
|
||||||
|
void \
|
||||||
|
FT_Destroy_Class_ ## class_( FT_Library library, \
|
||||||
|
FT_ServiceDescRec* clazz ) \
|
||||||
|
{ \
|
||||||
|
FT_Memory memory = library->memory; \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
if ( clazz ) \
|
||||||
|
FT_FREE( clazz ); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
FT_Error \
|
||||||
|
FT_Create_Class_ ## class_( FT_Library library, \
|
||||||
|
FT_ServiceDescRec** output_class) \
|
||||||
|
{ \
|
||||||
|
FT_ServiceDescRec* clazz = NULL; \
|
||||||
|
FT_Error error; \
|
||||||
|
FT_Memory memory = library->memory; \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
if ( FT_ALLOC( clazz, sizeof ( *clazz ) * 11 ) ) \
|
||||||
|
return error; \
|
||||||
|
\
|
||||||
|
clazz[0].serv_id = serv_id_1; \
|
||||||
|
clazz[0].serv_data = serv_data_1; \
|
||||||
|
clazz[1].serv_id = serv_id_2; \
|
||||||
|
clazz[1].serv_data = serv_data_2; \
|
||||||
|
clazz[2].serv_id = serv_id_3; \
|
||||||
|
clazz[2].serv_data = serv_data_3; \
|
||||||
|
clazz[3].serv_id = serv_id_4; \
|
||||||
|
clazz[3].serv_data = serv_data_4; \
|
||||||
|
clazz[4].serv_id = serv_id_5; \
|
||||||
|
clazz[4].serv_data = serv_data_5; \
|
||||||
|
clazz[5].serv_id = serv_id_6; \
|
||||||
|
clazz[5].serv_data = serv_data_6; \
|
||||||
|
clazz[6].serv_id = serv_id_7; \
|
||||||
|
clazz[6].serv_data = serv_data_7; \
|
||||||
|
clazz[7].serv_id = serv_id_8; \
|
||||||
|
clazz[7].serv_data = serv_data_8; \
|
||||||
|
clazz[8].serv_id = serv_id_9; \
|
||||||
|
clazz[8].serv_data = serv_data_9; \
|
||||||
|
clazz[9].serv_id = serv_id_10; \
|
||||||
|
clazz[9].serv_data = serv_data_10; \
|
||||||
|
clazz[10].serv_id = NULL; \
|
||||||
|
clazz[10].serv_data = NULL; \
|
||||||
|
\
|
||||||
|
*output_class = clazz; \
|
||||||
|
\
|
||||||
|
return FT_Err_Ok; \
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* FT_CONFIG_OPTION_PIC */
|
#endif /* FT_CONFIG_OPTION_PIC */
|
||||||
|
|
||||||
|
|
||||||
|
@ -916,7 +1004,7 @@ FT_BEGIN_HEADER
|
||||||
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
|
#define FT_SERVICE_WINFNT_H <freetype/internal/services/svwinfnt.h>
|
||||||
#define FT_SERVICE_FONT_FORMAT_H <freetype/internal/services/svfntfmt.h>
|
#define FT_SERVICE_FONT_FORMAT_H <freetype/internal/services/svfntfmt.h>
|
||||||
#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
|
#define FT_SERVICE_TRUETYPE_GLYF_H <freetype/internal/services/svttglyf.h>
|
||||||
|
#define FT_SERVICE_CFF_TABLE_LOAD_H <freetype/internal/services/svcfftl.h>
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
|
@ -47,6 +47,9 @@
|
||||||
|
|
||||||
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
|
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
|
||||||
|
|
||||||
|
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
|
||||||
|
#define FT_INTERNAL_CFF_OBJECTS_TYPES_H <freetype/internal/cffotypes.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
|
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,32 @@
|
||||||
#include FT_INTERNAL_OBJECTS_H
|
#include FT_INTERNAL_OBJECTS_H
|
||||||
#include FT_INTERNAL_TYPE1_TYPES_H
|
#include FT_INTERNAL_TYPE1_TYPES_H
|
||||||
#include FT_INTERNAL_HASH_H
|
#include FT_INTERNAL_HASH_H
|
||||||
|
#include FT_INTERNAL_TRUETYPE_TYPES_H
|
||||||
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
||||||
|
#include FT_INTERNAL_CFF_TYPES_H
|
||||||
|
#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* */
|
||||||
|
/* PostScript modules driver class. */
|
||||||
|
/* */
|
||||||
|
typedef struct PS_DriverRec_
|
||||||
|
{
|
||||||
|
FT_DriverRec root;
|
||||||
|
|
||||||
|
FT_UInt hinting_engine;
|
||||||
|
FT_Bool no_stem_darkening;
|
||||||
|
FT_Int darken_params[8];
|
||||||
|
FT_Int32 random_seed;
|
||||||
|
|
||||||
|
} PS_DriverRec, *PS_Driver;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -439,6 +459,205 @@ FT_BEGIN_HEADER
|
||||||
} PS_ParserRec;
|
} PS_ParserRec;
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** PS BUILDER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
typedef struct PS_Builder_ PS_Builder;
|
||||||
|
typedef const struct PS_Builder_FuncsRec_* PS_Builder_Funcs;
|
||||||
|
|
||||||
|
typedef struct PS_Builder_FuncsRec_
|
||||||
|
{
|
||||||
|
void
|
||||||
|
(*init)( PS_Builder* ps_builder,
|
||||||
|
void* builder,
|
||||||
|
FT_Bool is_t1 );
|
||||||
|
|
||||||
|
void
|
||||||
|
(*done)( PS_Builder* builder );
|
||||||
|
|
||||||
|
} PS_Builder_FuncsRec;
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Structure> */
|
||||||
|
/* PS_Builder */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* A structure used during glyph loading to store its outline. */
|
||||||
|
/* */
|
||||||
|
/* <Fields> */
|
||||||
|
/* memory :: The current memory object. */
|
||||||
|
/* */
|
||||||
|
/* face :: The current face object. */
|
||||||
|
/* */
|
||||||
|
/* glyph :: The current glyph slot. */
|
||||||
|
/* */
|
||||||
|
/* loader :: XXX */
|
||||||
|
/* */
|
||||||
|
/* base :: The base glyph outline. */
|
||||||
|
/* */
|
||||||
|
/* current :: The current glyph outline. */
|
||||||
|
/* */
|
||||||
|
/* pos_x :: The horizontal translation (if composite glyph). */
|
||||||
|
/* */
|
||||||
|
/* pos_y :: The vertical translation (if composite glyph). */
|
||||||
|
/* */
|
||||||
|
/* left_bearing :: The left side bearing point. */
|
||||||
|
/* */
|
||||||
|
/* advance :: The horizontal advance vector. */
|
||||||
|
/* */
|
||||||
|
/* bbox :: Unused. */
|
||||||
|
/* */
|
||||||
|
/* path_begun :: A flag which indicates that a new path has begun. */
|
||||||
|
/* */
|
||||||
|
/* load_points :: If this flag is not set, no points are loaded. */
|
||||||
|
/* */
|
||||||
|
/* no_recurse :: Set but not used. */
|
||||||
|
/* */
|
||||||
|
/* metrics_only :: A boolean indicating that we only want to compute */
|
||||||
|
/* the metrics of a given glyph, not load all of its */
|
||||||
|
/* points. */
|
||||||
|
/* */
|
||||||
|
/* funcs :: An array of function pointers for the builder. */
|
||||||
|
/* */
|
||||||
|
struct PS_Builder_
|
||||||
|
{
|
||||||
|
FT_Memory memory;
|
||||||
|
FT_Face face;
|
||||||
|
CFF_GlyphSlot glyph;
|
||||||
|
FT_GlyphLoader loader;
|
||||||
|
FT_Outline* base;
|
||||||
|
FT_Outline* current;
|
||||||
|
|
||||||
|
FT_Pos* pos_x;
|
||||||
|
FT_Pos* pos_y;
|
||||||
|
|
||||||
|
FT_Vector* left_bearing;
|
||||||
|
FT_Vector* advance;
|
||||||
|
|
||||||
|
FT_BBox* bbox; /* bounding box */
|
||||||
|
FT_Bool path_begun;
|
||||||
|
FT_Bool load_points;
|
||||||
|
FT_Bool no_recurse;
|
||||||
|
|
||||||
|
FT_Bool metrics_only;
|
||||||
|
|
||||||
|
FT_Bool is_t1;
|
||||||
|
|
||||||
|
PS_Builder_FuncsRec funcs;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** PS DECODER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
#define PS_MAX_OPERANDS 48
|
||||||
|
#define PS_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */
|
||||||
|
/* only 10 are allowed but there exist */
|
||||||
|
/* fonts like `HiraKakuProN-W3.ttf' */
|
||||||
|
/* (Hiragino Kaku Gothic ProN W3; */
|
||||||
|
/* 8.2d6e1; 2014-12-19) that exceed */
|
||||||
|
/* this limit */
|
||||||
|
|
||||||
|
/* execution context charstring zone */
|
||||||
|
|
||||||
|
typedef struct PS_Decoder_Zone_
|
||||||
|
{
|
||||||
|
FT_Byte* base;
|
||||||
|
FT_Byte* limit;
|
||||||
|
FT_Byte* cursor;
|
||||||
|
|
||||||
|
} PS_Decoder_Zone;
|
||||||
|
|
||||||
|
|
||||||
|
typedef FT_Error
|
||||||
|
(*CFF_Decoder_Get_Glyph_Callback)( TT_Face face,
|
||||||
|
FT_UInt glyph_index,
|
||||||
|
FT_Byte** pointer,
|
||||||
|
FT_ULong* length );
|
||||||
|
|
||||||
|
typedef void
|
||||||
|
(*CFF_Decoder_Free_Glyph_Callback)( TT_Face face,
|
||||||
|
FT_Byte** pointer,
|
||||||
|
FT_ULong length );
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct PS_Decoder_
|
||||||
|
{
|
||||||
|
PS_Builder builder;
|
||||||
|
|
||||||
|
FT_Fixed stack[PS_MAX_OPERANDS + 1];
|
||||||
|
FT_Fixed* top;
|
||||||
|
|
||||||
|
PS_Decoder_Zone zones[PS_MAX_SUBRS_CALLS + 1];
|
||||||
|
PS_Decoder_Zone* zone;
|
||||||
|
|
||||||
|
FT_Int flex_state;
|
||||||
|
FT_Int num_flex_vectors;
|
||||||
|
FT_Vector flex_vectors[7];
|
||||||
|
|
||||||
|
CFF_Font cff;
|
||||||
|
CFF_SubFont current_subfont; /* for current glyph_index */
|
||||||
|
FT_Generic* cf2_instance;
|
||||||
|
|
||||||
|
FT_Pos glyph_width;
|
||||||
|
FT_Pos nominal_width;
|
||||||
|
|
||||||
|
FT_Bool read_width;
|
||||||
|
FT_Bool width_only;
|
||||||
|
FT_Int num_hints;
|
||||||
|
|
||||||
|
FT_UInt num_locals;
|
||||||
|
FT_UInt num_globals;
|
||||||
|
|
||||||
|
FT_Int locals_bias;
|
||||||
|
FT_Int globals_bias;
|
||||||
|
|
||||||
|
FT_Byte** locals;
|
||||||
|
FT_Byte** globals;
|
||||||
|
|
||||||
|
FT_Byte** glyph_names; /* for pure CFF fonts only */
|
||||||
|
FT_UInt num_glyphs; /* number of glyphs in font */
|
||||||
|
|
||||||
|
FT_Render_Mode hint_mode;
|
||||||
|
|
||||||
|
FT_Bool seac;
|
||||||
|
|
||||||
|
CFF_Decoder_Get_Glyph_Callback get_glyph_callback;
|
||||||
|
CFF_Decoder_Free_Glyph_Callback free_glyph_callback;
|
||||||
|
|
||||||
|
/* Type 1 stuff */
|
||||||
|
FT_Service_PsCMaps psnames; /* for seac */
|
||||||
|
|
||||||
|
FT_Int lenIV; /* internal for sub routine calls */
|
||||||
|
FT_UInt* locals_len; /* array of subrs length (optional) */
|
||||||
|
FT_Hash locals_hash; /* used if `num_subrs' was massaged */
|
||||||
|
|
||||||
|
FT_Matrix font_matrix;
|
||||||
|
FT_Vector font_offset;
|
||||||
|
|
||||||
|
PS_Blend blend; /* for multiple master support */
|
||||||
|
|
||||||
|
FT_Long* buildchar;
|
||||||
|
FT_UInt len_buildchar;
|
||||||
|
|
||||||
|
void* t1_parse_callback;
|
||||||
|
|
||||||
|
} PS_Decoder;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -654,9 +873,15 @@ FT_BEGIN_HEADER
|
||||||
(*done)( T1_Decoder decoder );
|
(*done)( T1_Decoder decoder );
|
||||||
|
|
||||||
FT_Error
|
FT_Error
|
||||||
(*parse_charstrings)( T1_Decoder decoder,
|
(*parse_charstrings_old)( T1_Decoder decoder,
|
||||||
FT_Byte* base,
|
FT_Byte* base,
|
||||||
FT_UInt len );
|
FT_UInt len );
|
||||||
|
|
||||||
|
FT_Error
|
||||||
|
(*parse_charstrings)( PS_Decoder* decoder,
|
||||||
|
FT_Byte* charstring_base,
|
||||||
|
FT_ULong charstring_len );
|
||||||
|
|
||||||
|
|
||||||
} T1_Decoder_FuncsRec;
|
} T1_Decoder_FuncsRec;
|
||||||
|
|
||||||
|
@ -700,8 +925,252 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
FT_Bool seac;
|
FT_Bool seac;
|
||||||
|
|
||||||
|
FT_Generic cf2_instance;
|
||||||
|
|
||||||
} T1_DecoderRec;
|
} T1_DecoderRec;
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** CFF BUILDER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct CFF_Builder_ CFF_Builder;
|
||||||
|
|
||||||
|
|
||||||
|
typedef FT_Error
|
||||||
|
(*CFF_Builder_Check_Points_Func)( CFF_Builder* builder,
|
||||||
|
FT_Int count );
|
||||||
|
|
||||||
|
typedef void
|
||||||
|
(*CFF_Builder_Add_Point_Func)( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y,
|
||||||
|
FT_Byte flag );
|
||||||
|
typedef FT_Error
|
||||||
|
(*CFF_Builder_Add_Point1_Func)( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y );
|
||||||
|
typedef FT_Error
|
||||||
|
(*CFF_Builder_Start_Point_Func)( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y );
|
||||||
|
typedef void
|
||||||
|
(*CFF_Builder_Close_Contour_Func)( CFF_Builder* builder );
|
||||||
|
|
||||||
|
typedef FT_Error
|
||||||
|
(*CFF_Builder_Add_Contour_Func)( CFF_Builder* builder );
|
||||||
|
|
||||||
|
typedef const struct CFF_Builder_FuncsRec_* CFF_Builder_Funcs;
|
||||||
|
|
||||||
|
typedef struct CFF_Builder_FuncsRec_
|
||||||
|
{
|
||||||
|
void
|
||||||
|
(*init)( CFF_Builder* builder,
|
||||||
|
TT_Face face,
|
||||||
|
CFF_Size size,
|
||||||
|
CFF_GlyphSlot glyph,
|
||||||
|
FT_Bool hinting );
|
||||||
|
|
||||||
|
void
|
||||||
|
(*done)( CFF_Builder* builder );
|
||||||
|
|
||||||
|
CFF_Builder_Check_Points_Func check_points;
|
||||||
|
CFF_Builder_Add_Point_Func add_point;
|
||||||
|
CFF_Builder_Add_Point1_Func add_point1;
|
||||||
|
CFF_Builder_Add_Contour_Func add_contour;
|
||||||
|
CFF_Builder_Start_Point_Func start_point;
|
||||||
|
CFF_Builder_Close_Contour_Func close_contour;
|
||||||
|
|
||||||
|
} CFF_Builder_FuncsRec;
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Structure> */
|
||||||
|
/* CFF_Builder */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* A structure used during glyph loading to store its outline. */
|
||||||
|
/* */
|
||||||
|
/* <Fields> */
|
||||||
|
/* memory :: The current memory object. */
|
||||||
|
/* */
|
||||||
|
/* face :: The current face object. */
|
||||||
|
/* */
|
||||||
|
/* glyph :: The current glyph slot. */
|
||||||
|
/* */
|
||||||
|
/* loader :: The current glyph loader. */
|
||||||
|
/* */
|
||||||
|
/* base :: The base glyph outline. */
|
||||||
|
/* */
|
||||||
|
/* current :: The current glyph outline. */
|
||||||
|
/* */
|
||||||
|
/* pos_x :: The horizontal translation (if composite glyph). */
|
||||||
|
/* */
|
||||||
|
/* pos_y :: The vertical translation (if composite glyph). */
|
||||||
|
/* */
|
||||||
|
/* left_bearing :: The left side bearing point. */
|
||||||
|
/* */
|
||||||
|
/* advance :: The horizontal advance vector. */
|
||||||
|
/* */
|
||||||
|
/* bbox :: Unused. */
|
||||||
|
/* */
|
||||||
|
/* path_begun :: A flag which indicates that a new path has begun. */
|
||||||
|
/* */
|
||||||
|
/* load_points :: If this flag is not set, no points are loaded. */
|
||||||
|
/* */
|
||||||
|
/* no_recurse :: Set but not used. */
|
||||||
|
/* */
|
||||||
|
/* metrics_only :: A boolean indicating that we only want to compute */
|
||||||
|
/* the metrics of a given glyph, not load all of its */
|
||||||
|
/* points. */
|
||||||
|
/* */
|
||||||
|
/* hints_funcs :: Auxiliary pointer for hinting. */
|
||||||
|
/* */
|
||||||
|
/* hints_globals :: Auxiliary pointer for hinting. */
|
||||||
|
/* */
|
||||||
|
struct CFF_Builder_
|
||||||
|
{
|
||||||
|
FT_Memory memory;
|
||||||
|
TT_Face face;
|
||||||
|
CFF_GlyphSlot glyph;
|
||||||
|
FT_GlyphLoader loader;
|
||||||
|
FT_Outline* base;
|
||||||
|
FT_Outline* current;
|
||||||
|
|
||||||
|
FT_Pos pos_x;
|
||||||
|
FT_Pos pos_y;
|
||||||
|
|
||||||
|
FT_Vector left_bearing;
|
||||||
|
FT_Vector advance;
|
||||||
|
|
||||||
|
FT_BBox bbox; /* bounding box */
|
||||||
|
FT_Bool path_begun;
|
||||||
|
FT_Bool load_points;
|
||||||
|
FT_Bool no_recurse;
|
||||||
|
|
||||||
|
FT_Bool metrics_only;
|
||||||
|
|
||||||
|
void* hints_funcs; /* hinter-specific */
|
||||||
|
void* hints_globals; /* hinter-specific */
|
||||||
|
|
||||||
|
CFF_Builder_FuncsRec funcs;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** CFF DECODER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
#define CFF_MAX_OPERANDS 48
|
||||||
|
#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */
|
||||||
|
/* only 10 are allowed but there exist */
|
||||||
|
/* fonts like `HiraKakuProN-W3.ttf' */
|
||||||
|
/* (Hiragino Kaku Gothic ProN W3; */
|
||||||
|
/* 8.2d6e1; 2014-12-19) that exceed */
|
||||||
|
/* this limit */
|
||||||
|
#define CFF_MAX_TRANS_ELEMENTS 32
|
||||||
|
|
||||||
|
/* execution context charstring zone */
|
||||||
|
|
||||||
|
typedef struct CFF_Decoder_Zone_
|
||||||
|
{
|
||||||
|
FT_Byte* base;
|
||||||
|
FT_Byte* limit;
|
||||||
|
FT_Byte* cursor;
|
||||||
|
|
||||||
|
} CFF_Decoder_Zone;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct CFF_Decoder_
|
||||||
|
{
|
||||||
|
CFF_Builder builder;
|
||||||
|
CFF_Font cff;
|
||||||
|
|
||||||
|
FT_Fixed stack[CFF_MAX_OPERANDS + 1];
|
||||||
|
FT_Fixed* top;
|
||||||
|
|
||||||
|
CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
|
||||||
|
CFF_Decoder_Zone* zone;
|
||||||
|
|
||||||
|
FT_Int flex_state;
|
||||||
|
FT_Int num_flex_vectors;
|
||||||
|
FT_Vector flex_vectors[7];
|
||||||
|
|
||||||
|
FT_Pos glyph_width;
|
||||||
|
FT_Pos nominal_width;
|
||||||
|
|
||||||
|
FT_Bool read_width;
|
||||||
|
FT_Bool width_only;
|
||||||
|
FT_Int num_hints;
|
||||||
|
FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
|
||||||
|
|
||||||
|
FT_UInt num_locals;
|
||||||
|
FT_UInt num_globals;
|
||||||
|
|
||||||
|
FT_Int locals_bias;
|
||||||
|
FT_Int globals_bias;
|
||||||
|
|
||||||
|
FT_Byte** locals;
|
||||||
|
FT_Byte** globals;
|
||||||
|
|
||||||
|
FT_Byte** glyph_names; /* for pure CFF fonts only */
|
||||||
|
FT_UInt num_glyphs; /* number of glyphs in font */
|
||||||
|
|
||||||
|
FT_Render_Mode hint_mode;
|
||||||
|
|
||||||
|
FT_Bool seac;
|
||||||
|
|
||||||
|
CFF_SubFont current_subfont; /* for current glyph_index */
|
||||||
|
|
||||||
|
CFF_Decoder_Get_Glyph_Callback get_glyph_callback;
|
||||||
|
CFF_Decoder_Free_Glyph_Callback free_glyph_callback;
|
||||||
|
|
||||||
|
} CFF_Decoder;
|
||||||
|
|
||||||
|
typedef const struct CFF_Decoder_FuncsRec_* CFF_Decoder_Funcs;
|
||||||
|
|
||||||
|
typedef struct CFF_Decoder_FuncsRec_
|
||||||
|
{
|
||||||
|
void
|
||||||
|
(*init)( CFF_Decoder* decoder,
|
||||||
|
TT_Face face,
|
||||||
|
CFF_Size size,
|
||||||
|
CFF_GlyphSlot slot,
|
||||||
|
FT_Bool hinting,
|
||||||
|
FT_Render_Mode hint_mode,
|
||||||
|
CFF_Decoder_Get_Glyph_Callback get_callback,
|
||||||
|
CFF_Decoder_Free_Glyph_Callback free_callback );
|
||||||
|
|
||||||
|
FT_Error
|
||||||
|
(*prepare)( CFF_Decoder* decoder,
|
||||||
|
CFF_Size size,
|
||||||
|
FT_UInt glyph_index );
|
||||||
|
|
||||||
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||||
|
FT_Error
|
||||||
|
(*parse_charstrings_old)( CFF_Decoder* decoder,
|
||||||
|
FT_Byte* charstring_base,
|
||||||
|
FT_ULong charstring_len,
|
||||||
|
FT_Bool in_dict );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
FT_Error
|
||||||
|
(*parse_charstrings)( PS_Decoder* decoder,
|
||||||
|
FT_Byte* charstring_base,
|
||||||
|
FT_ULong charstring_len );
|
||||||
|
|
||||||
|
} CFF_Decoder_FuncsRec;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -810,11 +1279,26 @@ FT_BEGIN_HEADER
|
||||||
FT_Offset length,
|
FT_Offset length,
|
||||||
FT_UShort seed );
|
FT_UShort seed );
|
||||||
|
|
||||||
|
FT_UInt32
|
||||||
|
(*cff_random)( FT_UInt32 r );
|
||||||
|
|
||||||
|
void
|
||||||
|
(*ps_decoder_init)( PS_Decoder* ps_decoder,
|
||||||
|
void* decoder,
|
||||||
|
FT_Bool is_t1 );
|
||||||
|
|
||||||
|
void
|
||||||
|
(*t1_make_subfont)( FT_Face face,
|
||||||
|
PS_Private priv,
|
||||||
|
CFF_SubFont subfont );
|
||||||
|
|
||||||
T1_CMap_Classes t1_cmap_classes;
|
T1_CMap_Classes t1_cmap_classes;
|
||||||
|
|
||||||
/* fields after this comment line were added after version 2.1.10 */
|
/* fields after this comment line were added after version 2.1.10 */
|
||||||
const AFM_Parser_FuncsRec* afm_parser_funcs;
|
const AFM_Parser_FuncsRec* afm_parser_funcs;
|
||||||
|
|
||||||
|
const CFF_Decoder_FuncsRec* cff_decoder_funcs;
|
||||||
|
|
||||||
} PSAux_ServiceRec, *PSAux_Service;
|
} PSAux_ServiceRec, *PSAux_Service;
|
||||||
|
|
||||||
/* backward compatible type definition */
|
/* backward compatible type definition */
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
/***************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* svcfftl.h */
|
||||||
|
/* */
|
||||||
|
/* The FreeType CFF tables loader service (specification). */
|
||||||
|
/* */
|
||||||
|
/* Copyright notice here */
|
||||||
|
/* */
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SVCFFTL_H_
|
||||||
|
#define SVCFFTL_H_
|
||||||
|
|
||||||
|
#include FT_INTERNAL_SERVICE_H
|
||||||
|
#include FT_INTERNAL_CFF_TYPES_H
|
||||||
|
|
||||||
|
|
||||||
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
|
#define FT_SERVICE_ID_CFF_LOAD "cff-load"
|
||||||
|
|
||||||
|
|
||||||
|
typedef FT_UShort
|
||||||
|
(*FT_Get_Standard_Encoding_Func)( FT_UInt charcode );
|
||||||
|
|
||||||
|
typedef FT_Error
|
||||||
|
(*FT_Load_Private_Dict_Func)( CFF_Font font,
|
||||||
|
CFF_SubFont subfont,
|
||||||
|
FT_UInt lenNDV,
|
||||||
|
FT_Fixed* NDV );
|
||||||
|
|
||||||
|
typedef FT_Byte
|
||||||
|
(*FT_FD_Select_Get_Func)( CFF_FDSelect fdselect,
|
||||||
|
FT_UInt glyph_index );
|
||||||
|
|
||||||
|
typedef FT_Bool
|
||||||
|
(*FT_Blend_Check_Vector_Func)( CFF_Blend blend,
|
||||||
|
FT_UInt vsindex,
|
||||||
|
FT_UInt lenNDV,
|
||||||
|
FT_Fixed* NDV );
|
||||||
|
|
||||||
|
typedef FT_Error
|
||||||
|
(*FT_Blend_Build_Vector_Func)( CFF_Blend blend,
|
||||||
|
FT_UInt vsindex,
|
||||||
|
FT_UInt lenNDV,
|
||||||
|
FT_Fixed* NDV );
|
||||||
|
|
||||||
|
|
||||||
|
FT_DEFINE_SERVICE( CFFLoad )
|
||||||
|
{
|
||||||
|
FT_Get_Standard_Encoding_Func get_standard_encoding;
|
||||||
|
FT_Load_Private_Dict_Func load_private_dict;
|
||||||
|
FT_FD_Select_Get_Func fd_select_get;
|
||||||
|
FT_Blend_Check_Vector_Func blend_check_vector;
|
||||||
|
FT_Blend_Build_Vector_Func blend_build_vector;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef FT_CONFIG_OPTION_PIC
|
||||||
|
|
||||||
|
#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \
|
||||||
|
get_standard_encoding_, \
|
||||||
|
load_private_dict_, \
|
||||||
|
fd_select_get_, \
|
||||||
|
blend_check_vector_, \
|
||||||
|
blend_build_vector_ ) \
|
||||||
|
static const FT_Service_CFFLoadRec class_ = \
|
||||||
|
{ \
|
||||||
|
get_standard_encoding_, \
|
||||||
|
load_private_dict_, \
|
||||||
|
fd_select_get_, \
|
||||||
|
blend_check_vector_, \
|
||||||
|
blend_build_vector_ \
|
||||||
|
};
|
||||||
|
|
||||||
|
#else /* FT_CONFIG_OPTION_PIC */
|
||||||
|
|
||||||
|
#define FT_DEFINE_SERVICE_CFFLOADREC( class_, \
|
||||||
|
get_standard_encoding_, \
|
||||||
|
load_private_dict_, \
|
||||||
|
fd_select_get_, \
|
||||||
|
blend_check_vector_, \
|
||||||
|
blend_build_vector_ ) \
|
||||||
|
void \
|
||||||
|
FT_Init_Class_ ## class_( FT_Service_CFFLoadRec* clazz ) \
|
||||||
|
{ \
|
||||||
|
clazz->get_standard_encoding = get_standard_encoding_; \
|
||||||
|
clazz->load_private_dict = load_private_dict_; \
|
||||||
|
clazz->fd_select_get = fd_select_get_; \
|
||||||
|
clazz->blend_check_vector = blend_check_vector_; \
|
||||||
|
clazz->blend_build_vector = blend_build_vector_; \
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FT_CONFIG_OPTION_PIC */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
FT_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -1445,6 +1445,9 @@ FT_BEGIN_HEADER
|
||||||
void* var;
|
void* var;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* a typeless pointer to the PostScript Aux service */
|
||||||
|
void* psaux;
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
|
|
@ -23,15 +23,6 @@ SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
|
||||||
cffobjs
|
cffobjs
|
||||||
cffparse
|
cffparse
|
||||||
cffpic
|
cffpic
|
||||||
cf2arrst
|
|
||||||
cf2blues
|
|
||||||
cf2error
|
|
||||||
cf2font
|
|
||||||
cf2ft
|
|
||||||
cf2hints
|
|
||||||
cf2intrp
|
|
||||||
cf2read
|
|
||||||
cf2stack
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -27,15 +27,4 @@
|
||||||
#include "cffload.c"
|
#include "cffload.c"
|
||||||
#include "cffobjs.c"
|
#include "cffobjs.c"
|
||||||
|
|
||||||
#include "cf2arrst.c"
|
|
||||||
#include "cf2blues.c"
|
|
||||||
#include "cf2error.c"
|
|
||||||
#include "cf2font.c"
|
|
||||||
#include "cf2ft.c"
|
|
||||||
#include "cf2hints.c"
|
|
||||||
#include "cf2intrp.c"
|
|
||||||
#include "cf2read.c"
|
|
||||||
#include "cf2stack.c"
|
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#ifndef CFFCMAP_H_
|
#ifndef CFFCMAP_H_
|
||||||
#define CFFCMAP_H_
|
#define CFFCMAP_H_
|
||||||
|
|
||||||
#include "cffobjs.h"
|
#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
|
@ -21,16 +21,19 @@
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
#include FT_INTERNAL_SFNT_H
|
#include FT_INTERNAL_SFNT_H
|
||||||
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
#include FT_SERVICE_CID_H
|
#include FT_SERVICE_CID_H
|
||||||
#include FT_SERVICE_POSTSCRIPT_INFO_H
|
#include FT_SERVICE_POSTSCRIPT_INFO_H
|
||||||
#include FT_SERVICE_POSTSCRIPT_NAME_H
|
#include FT_SERVICE_POSTSCRIPT_NAME_H
|
||||||
#include FT_SERVICE_TT_CMAP_H
|
#include FT_SERVICE_TT_CMAP_H
|
||||||
|
#include FT_SERVICE_CFF_TABLE_LOAD_H
|
||||||
|
|
||||||
#include "cffdrivr.h"
|
#include "cffdrivr.h"
|
||||||
#include "cffgload.h"
|
#include "cffgload.h"
|
||||||
#include "cffload.h"
|
#include "cffload.h"
|
||||||
#include "cffcmap.h"
|
#include "cffcmap.h"
|
||||||
#include "cffparse.h"
|
#include "cffparse.h"
|
||||||
|
#include "cffobjs.h"
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||||
|
@ -742,7 +745,7 @@
|
||||||
FT_Bool value_is_string )
|
FT_Bool value_is_string )
|
||||||
{
|
{
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
CFF_Driver driver = (CFF_Driver)module;
|
PS_Driver driver = (PS_Driver)module;
|
||||||
|
|
||||||
#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
#ifndef FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
|
||||||
FT_UNUSED( value_is_string );
|
FT_UNUSED( value_is_string );
|
||||||
|
@ -908,7 +911,7 @@
|
||||||
const void* value )
|
const void* value )
|
||||||
{
|
{
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
CFF_Driver driver = (CFF_Driver)module;
|
PS_Driver driver = (PS_Driver)module;
|
||||||
|
|
||||||
|
|
||||||
if ( !ft_strcmp( property_name, "darkening-parameters" ) )
|
if ( !ft_strcmp( property_name, "darkening-parameters" ) )
|
||||||
|
@ -1088,6 +1091,21 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CFFLOAD SERVICE
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
FT_DEFINE_SERVICE_CFFLOADREC(
|
||||||
|
cff_service_cff_load,
|
||||||
|
|
||||||
|
(FT_Get_Standard_Encoding_Func) cff_get_standard_encoding,
|
||||||
|
(FT_Load_Private_Dict_Func) cff_load_private_dict,
|
||||||
|
(FT_FD_Select_Get_Func) cff_fd_select_get,
|
||||||
|
(FT_Blend_Check_Vector_Func) cff_blend_check_vector,
|
||||||
|
(FT_Blend_Build_Vector_Func) cff_blend_build_vector
|
||||||
|
)
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -1102,6 +1120,34 @@
|
||||||
|
|
||||||
#if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \
|
#if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \
|
||||||
defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
|
FT_DEFINE_SERVICEDESCREC10(
|
||||||
|
cff_services,
|
||||||
|
|
||||||
|
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
||||||
|
FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET,
|
||||||
|
FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET,
|
||||||
|
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
||||||
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
||||||
|
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
|
||||||
|
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
||||||
|
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
||||||
|
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
|
||||||
|
FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
|
||||||
|
)
|
||||||
|
#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
|
||||||
|
FT_DEFINE_SERVICEDESCREC8(
|
||||||
|
cff_services,
|
||||||
|
|
||||||
|
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
||||||
|
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
||||||
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
||||||
|
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
|
||||||
|
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
||||||
|
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
||||||
|
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
|
||||||
|
FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
|
||||||
|
)
|
||||||
|
#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
FT_DEFINE_SERVICEDESCREC9(
|
FT_DEFINE_SERVICEDESCREC9(
|
||||||
cff_services,
|
cff_services,
|
||||||
|
|
||||||
|
@ -1110,46 +1156,22 @@
|
||||||
FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET,
|
FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET,
|
||||||
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
||||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
||||||
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
|
|
||||||
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
||||||
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
||||||
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
|
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
|
||||||
|
FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
|
||||||
)
|
)
|
||||||
#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
|
#else
|
||||||
FT_DEFINE_SERVICEDESCREC7(
|
FT_DEFINE_SERVICEDESCREC7(
|
||||||
cff_services,
|
cff_services,
|
||||||
|
|
||||||
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
||||||
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
||||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
||||||
FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
|
|
||||||
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
||||||
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
||||||
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
|
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET,
|
||||||
)
|
FT_SERVICE_ID_CFF_LOAD, &CFF_SERVICE_CFF_LOAD_GET
|
||||||
#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
|
||||||
FT_DEFINE_SERVICEDESCREC8(
|
|
||||||
cff_services,
|
|
||||||
|
|
||||||
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
|
||||||
FT_SERVICE_ID_MULTI_MASTERS, &CFF_SERVICE_MULTI_MASTERS_GET,
|
|
||||||
FT_SERVICE_ID_METRICS_VARIATIONS, &CFF_SERVICE_METRICS_VAR_GET,
|
|
||||||
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
|
||||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
|
||||||
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
|
||||||
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
|
||||||
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
|
|
||||||
)
|
|
||||||
#else
|
|
||||||
FT_DEFINE_SERVICEDESCREC6(
|
|
||||||
cff_services,
|
|
||||||
|
|
||||||
FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
|
|
||||||
FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
|
|
||||||
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
|
|
||||||
FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
|
|
||||||
FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
|
|
||||||
FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
|
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1208,7 +1230,7 @@
|
||||||
FT_MODULE_DRIVER_HAS_HINTER |
|
FT_MODULE_DRIVER_HAS_HINTER |
|
||||||
FT_MODULE_DRIVER_HINTS_LIGHTLY,
|
FT_MODULE_DRIVER_HINTS_LIGHTLY,
|
||||||
|
|
||||||
sizeof ( CFF_DriverRec ),
|
sizeof ( PS_DriverRec ),
|
||||||
"cff",
|
"cff",
|
||||||
0x10000L,
|
0x10000L,
|
||||||
0x20000L,
|
0x20000L,
|
||||||
|
|
2616
src/cff/cffgload.c
2616
src/cff/cffgload.c
File diff suppressed because it is too large
Load Diff
|
@ -22,119 +22,11 @@
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
#include "cffobjs.h"
|
#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
#define CFF_MAX_OPERANDS 48
|
|
||||||
#define CFF_MAX_SUBRS_CALLS 16 /* maximum subroutine nesting; */
|
|
||||||
/* only 10 are allowed but there exist */
|
|
||||||
/* fonts like `HiraKakuProN-W3.ttf' */
|
|
||||||
/* (Hiragino Kaku Gothic ProN W3; */
|
|
||||||
/* 8.2d6e1; 2014-12-19) that exceed */
|
|
||||||
/* this limit */
|
|
||||||
#define CFF_MAX_TRANS_ELEMENTS 32
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Structure> */
|
|
||||||
/* CFF_Builder */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* A structure used during glyph loading to store its outline. */
|
|
||||||
/* */
|
|
||||||
/* <Fields> */
|
|
||||||
/* memory :: The current memory object. */
|
|
||||||
/* */
|
|
||||||
/* face :: The current face object. */
|
|
||||||
/* */
|
|
||||||
/* glyph :: The current glyph slot. */
|
|
||||||
/* */
|
|
||||||
/* loader :: The current glyph loader. */
|
|
||||||
/* */
|
|
||||||
/* base :: The base glyph outline. */
|
|
||||||
/* */
|
|
||||||
/* current :: The current glyph outline. */
|
|
||||||
/* */
|
|
||||||
/* pos_x :: The horizontal translation (if composite glyph). */
|
|
||||||
/* */
|
|
||||||
/* pos_y :: The vertical translation (if composite glyph). */
|
|
||||||
/* */
|
|
||||||
/* left_bearing :: The left side bearing point. */
|
|
||||||
/* */
|
|
||||||
/* advance :: The horizontal advance vector. */
|
|
||||||
/* */
|
|
||||||
/* bbox :: Unused. */
|
|
||||||
/* */
|
|
||||||
/* path_begun :: A flag which indicates that a new path has begun. */
|
|
||||||
/* */
|
|
||||||
/* load_points :: If this flag is not set, no points are loaded. */
|
|
||||||
/* */
|
|
||||||
/* no_recurse :: Set but not used. */
|
|
||||||
/* */
|
|
||||||
/* metrics_only :: A boolean indicating that we only want to compute */
|
|
||||||
/* the metrics of a given glyph, not load all of its */
|
|
||||||
/* points. */
|
|
||||||
/* */
|
|
||||||
/* hints_funcs :: Auxiliary pointer for hinting. */
|
|
||||||
/* */
|
|
||||||
/* hints_globals :: Auxiliary pointer for hinting. */
|
|
||||||
/* */
|
|
||||||
typedef struct CFF_Builder_
|
|
||||||
{
|
|
||||||
FT_Memory memory;
|
|
||||||
TT_Face face;
|
|
||||||
CFF_GlyphSlot glyph;
|
|
||||||
FT_GlyphLoader loader;
|
|
||||||
FT_Outline* base;
|
|
||||||
FT_Outline* current;
|
|
||||||
|
|
||||||
FT_Pos pos_x;
|
|
||||||
FT_Pos pos_y;
|
|
||||||
|
|
||||||
FT_Vector left_bearing;
|
|
||||||
FT_Vector advance;
|
|
||||||
|
|
||||||
FT_BBox bbox; /* bounding box */
|
|
||||||
FT_Bool path_begun;
|
|
||||||
FT_Bool load_points;
|
|
||||||
FT_Bool no_recurse;
|
|
||||||
|
|
||||||
FT_Bool metrics_only;
|
|
||||||
|
|
||||||
void* hints_funcs; /* hinter-specific */
|
|
||||||
void* hints_globals; /* hinter-specific */
|
|
||||||
|
|
||||||
} CFF_Builder;
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
|
||||||
cff_check_points( CFF_Builder* builder,
|
|
||||||
FT_Int count );
|
|
||||||
|
|
||||||
FT_LOCAL( void )
|
|
||||||
cff_builder_add_point( CFF_Builder* builder,
|
|
||||||
FT_Pos x,
|
|
||||||
FT_Pos y,
|
|
||||||
FT_Byte flag );
|
|
||||||
FT_LOCAL( FT_Error )
|
|
||||||
cff_builder_add_point1( CFF_Builder* builder,
|
|
||||||
FT_Pos x,
|
|
||||||
FT_Pos y );
|
|
||||||
FT_LOCAL( FT_Error )
|
|
||||||
cff_builder_start_point( CFF_Builder* builder,
|
|
||||||
FT_Pos x,
|
|
||||||
FT_Pos y );
|
|
||||||
FT_LOCAL( void )
|
|
||||||
cff_builder_close_contour( CFF_Builder* builder );
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Int )
|
|
||||||
cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
|
|
||||||
FT_Int charcode );
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cff_get_glyph_data( TT_Face face,
|
cff_get_glyph_data( TT_Face face,
|
||||||
FT_UInt glyph_index,
|
FT_UInt glyph_index,
|
||||||
|
@ -146,74 +38,6 @@ FT_BEGIN_HEADER
|
||||||
FT_ULong length );
|
FT_ULong length );
|
||||||
|
|
||||||
|
|
||||||
/* execution context charstring zone */
|
|
||||||
|
|
||||||
typedef struct CFF_Decoder_Zone_
|
|
||||||
{
|
|
||||||
FT_Byte* base;
|
|
||||||
FT_Byte* limit;
|
|
||||||
FT_Byte* cursor;
|
|
||||||
|
|
||||||
} CFF_Decoder_Zone;
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct CFF_Decoder_
|
|
||||||
{
|
|
||||||
CFF_Builder builder;
|
|
||||||
CFF_Font cff;
|
|
||||||
|
|
||||||
FT_Fixed stack[CFF_MAX_OPERANDS + 1];
|
|
||||||
FT_Fixed* top;
|
|
||||||
|
|
||||||
CFF_Decoder_Zone zones[CFF_MAX_SUBRS_CALLS + 1];
|
|
||||||
CFF_Decoder_Zone* zone;
|
|
||||||
|
|
||||||
FT_Int flex_state;
|
|
||||||
FT_Int num_flex_vectors;
|
|
||||||
FT_Vector flex_vectors[7];
|
|
||||||
|
|
||||||
FT_Pos glyph_width;
|
|
||||||
FT_Pos nominal_width;
|
|
||||||
|
|
||||||
FT_Bool read_width;
|
|
||||||
FT_Bool width_only;
|
|
||||||
FT_Int num_hints;
|
|
||||||
FT_Fixed buildchar[CFF_MAX_TRANS_ELEMENTS];
|
|
||||||
|
|
||||||
FT_UInt num_locals;
|
|
||||||
FT_UInt num_globals;
|
|
||||||
|
|
||||||
FT_Int locals_bias;
|
|
||||||
FT_Int globals_bias;
|
|
||||||
|
|
||||||
FT_Byte** locals;
|
|
||||||
FT_Byte** globals;
|
|
||||||
|
|
||||||
FT_Byte** glyph_names; /* for pure CFF fonts only */
|
|
||||||
FT_UInt num_glyphs; /* number of glyphs in font */
|
|
||||||
|
|
||||||
FT_Render_Mode hint_mode;
|
|
||||||
|
|
||||||
FT_Bool seac;
|
|
||||||
|
|
||||||
CFF_SubFont current_subfont; /* for current glyph_index */
|
|
||||||
|
|
||||||
} CFF_Decoder;
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( void )
|
|
||||||
cff_decoder_init( CFF_Decoder* decoder,
|
|
||||||
TT_Face face,
|
|
||||||
CFF_Size size,
|
|
||||||
CFF_GlyphSlot slot,
|
|
||||||
FT_Bool hinting,
|
|
||||||
FT_Render_Mode hint_mode );
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
|
||||||
cff_decoder_prepare( CFF_Decoder* decoder,
|
|
||||||
CFF_Size size,
|
|
||||||
FT_UInt glyph_index );
|
|
||||||
|
|
||||||
#if 0 /* unused until we support pure CFF fonts */
|
#if 0 /* unused until we support pure CFF fonts */
|
||||||
|
|
||||||
/* Compute the maximum advance width of a font through quick parsing */
|
/* Compute the maximum advance width of a font through quick parsing */
|
||||||
|
@ -223,13 +47,6 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
#endif /* 0 */
|
#endif /* 0 */
|
||||||
|
|
||||||
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
|
||||||
FT_LOCAL( FT_Error )
|
|
||||||
cff_decoder_parse_charstrings( CFF_Decoder* decoder,
|
|
||||||
FT_Byte* charstring_base,
|
|
||||||
FT_ULong charstring_len,
|
|
||||||
FT_Bool in_dict );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cff_slot_load( CFF_GlyphSlot glyph,
|
cff_slot_load( CFF_GlyphSlot glyph,
|
||||||
|
|
|
@ -1945,18 +1945,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_UInt32 )
|
|
||||||
cff_random( FT_UInt32 r )
|
|
||||||
{
|
|
||||||
/* a 32bit version of the `xorshift' algorithm */
|
|
||||||
r ^= r << 13;
|
|
||||||
r ^= r >> 17;
|
|
||||||
r ^= r << 5;
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* There are 3 ways to call this function, distinguished by code. */
|
/* There are 3 ways to call this function, distinguished by code. */
|
||||||
/* */
|
/* */
|
||||||
/* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */
|
/* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */
|
||||||
|
@ -1980,6 +1968,8 @@
|
||||||
CFF_FontRecDict top = &subfont->font_dict;
|
CFF_FontRecDict top = &subfont->font_dict;
|
||||||
CFF_Private priv = &subfont->private_dict;
|
CFF_Private priv = &subfont->private_dict;
|
||||||
|
|
||||||
|
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
||||||
|
|
||||||
FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT ||
|
FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT ||
|
||||||
code == CFF2_CODE_FONTDICT );
|
code == CFF2_CODE_FONTDICT );
|
||||||
FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK
|
FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK
|
||||||
|
@ -2085,7 +2075,7 @@
|
||||||
*/
|
*/
|
||||||
if ( face->root.internal->random_seed == -1 )
|
if ( face->root.internal->random_seed == -1 )
|
||||||
{
|
{
|
||||||
CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( face );
|
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
|
||||||
|
|
||||||
|
|
||||||
subfont->random = (FT_UInt32)driver->random_seed;
|
subfont->random = (FT_UInt32)driver->random_seed;
|
||||||
|
@ -2094,7 +2084,7 @@
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
driver->random_seed =
|
driver->random_seed =
|
||||||
(FT_Int32)cff_random( (FT_UInt32)driver->random_seed );
|
(FT_Int32)psaux->cff_random( (FT_UInt32)driver->random_seed );
|
||||||
|
|
||||||
} while ( driver->random_seed < 0 );
|
} while ( driver->random_seed < 0 );
|
||||||
}
|
}
|
||||||
|
@ -2107,7 +2097,7 @@
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
face->root.internal->random_seed =
|
face->root.internal->random_seed =
|
||||||
(FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed );
|
(FT_Int32)psaux->cff_random( (FT_UInt32)face->root.internal->random_seed );
|
||||||
|
|
||||||
} while ( face->root.internal->random_seed < 0 );
|
} while ( face->root.internal->random_seed < 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include "cfftypes.h"
|
#include FT_INTERNAL_CFF_TYPES_H
|
||||||
#include "cffparse.h"
|
#include "cffparse.h"
|
||||||
#include "cffobjs.h" /* for CFF_Face */
|
#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
@ -61,9 +61,6 @@ FT_BEGIN_HEADER
|
||||||
FT_UInt cid );
|
FT_UInt cid );
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( FT_UInt32 )
|
|
||||||
cff_random( FT_UInt32 r );
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cff_font_load( FT_Library library,
|
cff_font_load( FT_Library library,
|
||||||
FT_Stream stream,
|
FT_Stream stream,
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
|
||||||
#include "cffobjs.h"
|
#include "cffobjs.h"
|
||||||
#include "cffload.h"
|
#include "cffload.h"
|
||||||
#include "cffcmap.h"
|
#include "cffcmap.h"
|
||||||
|
@ -39,6 +40,8 @@
|
||||||
|
|
||||||
#include "cfferrs.h"
|
#include "cfferrs.h"
|
||||||
|
|
||||||
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
|
@ -493,6 +496,8 @@
|
||||||
SFNT_Service sfnt;
|
SFNT_Service sfnt;
|
||||||
FT_Service_PsCMaps psnames;
|
FT_Service_PsCMaps psnames;
|
||||||
PSHinter_Service pshinter;
|
PSHinter_Service pshinter;
|
||||||
|
PSAux_Service psaux;
|
||||||
|
FT_Service_CFFLoad cffload;
|
||||||
FT_Bool pure_cff = 1;
|
FT_Bool pure_cff = 1;
|
||||||
FT_Bool cff2 = 0;
|
FT_Bool cff2 = 0;
|
||||||
FT_Bool sfnt_format = 0;
|
FT_Bool sfnt_format = 0;
|
||||||
|
@ -513,6 +518,18 @@
|
||||||
pshinter = (PSHinter_Service)FT_Get_Module_Interface(
|
pshinter = (PSHinter_Service)FT_Get_Module_Interface(
|
||||||
library, "pshinter" );
|
library, "pshinter" );
|
||||||
|
|
||||||
|
psaux = (PSAux_Service)FT_Get_Module_Interface(
|
||||||
|
library, "psaux" );
|
||||||
|
if ( !psaux )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "cff_face_init: cannot access `psaux' module\n" ));
|
||||||
|
error = FT_THROW( Missing_Module );
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
face->psaux = psaux;
|
||||||
|
|
||||||
|
FT_FACE_FIND_GLOBAL_SERVICE( face, cffload, CFF_LOAD );
|
||||||
|
|
||||||
FT_TRACE2(( "CFF driver\n" ));
|
FT_TRACE2(( "CFF driver\n" ));
|
||||||
|
|
||||||
/* create input stream from resource */
|
/* create input stream from resource */
|
||||||
|
@ -614,6 +631,7 @@
|
||||||
|
|
||||||
cff->pshinter = pshinter;
|
cff->pshinter = pshinter;
|
||||||
cff->psnames = psnames;
|
cff->psnames = psnames;
|
||||||
|
cff->cffload = cffload;
|
||||||
|
|
||||||
cffface->face_index = face_index & 0xFFFF;
|
cffface->face_index = face_index & 0xFFFF;
|
||||||
|
|
||||||
|
@ -1159,7 +1177,7 @@
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
cff_driver_init( FT_Module module ) /* CFF_Driver */
|
cff_driver_init( FT_Module module ) /* CFF_Driver */
|
||||||
{
|
{
|
||||||
CFF_Driver driver = (CFF_Driver)module;
|
PS_Driver driver = (PS_Driver)module;
|
||||||
|
|
||||||
FT_UInt32 seed;
|
FT_UInt32 seed;
|
||||||
|
|
||||||
|
|
|
@ -21,111 +21,11 @@
|
||||||
|
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_INTERNAL_OBJECTS_H
|
|
||||||
#include "cfftypes.h"
|
|
||||||
#include FT_INTERNAL_TRUETYPE_TYPES_H
|
|
||||||
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
|
||||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Type> */
|
|
||||||
/* CFF_Driver */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* A handle to an OpenType driver object. */
|
|
||||||
/* */
|
|
||||||
typedef struct CFF_DriverRec_* CFF_Driver;
|
|
||||||
|
|
||||||
typedef TT_Face CFF_Face;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Type> */
|
|
||||||
/* CFF_Size */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* A handle to an OpenType size object. */
|
|
||||||
/* */
|
|
||||||
typedef struct CFF_SizeRec_
|
|
||||||
{
|
|
||||||
FT_SizeRec root;
|
|
||||||
FT_ULong strike_index; /* 0xFFFFFFFF to indicate invalid */
|
|
||||||
|
|
||||||
} CFF_SizeRec, *CFF_Size;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Type> */
|
|
||||||
/* CFF_GlyphSlot */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* A handle to an OpenType glyph slot object. */
|
|
||||||
/* */
|
|
||||||
typedef struct CFF_GlyphSlotRec_
|
|
||||||
{
|
|
||||||
FT_GlyphSlotRec root;
|
|
||||||
|
|
||||||
FT_Bool hint;
|
|
||||||
FT_Bool scaled;
|
|
||||||
|
|
||||||
FT_Fixed x_scale;
|
|
||||||
FT_Fixed y_scale;
|
|
||||||
|
|
||||||
} CFF_GlyphSlotRec, *CFF_GlyphSlot;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Type> */
|
|
||||||
/* CFF_Internal */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* The interface to the `internal' field of `FT_Size'. */
|
|
||||||
/* */
|
|
||||||
typedef struct CFF_InternalRec_
|
|
||||||
{
|
|
||||||
PSH_Globals topfont;
|
|
||||||
PSH_Globals subfonts[CFF_MAX_CID_FONTS];
|
|
||||||
|
|
||||||
} CFF_InternalRec, *CFF_Internal;
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* Subglyph transformation record. */
|
|
||||||
/* */
|
|
||||||
typedef struct CFF_Transform_
|
|
||||||
{
|
|
||||||
FT_Fixed xx, xy; /* transformation matrix coefficients */
|
|
||||||
FT_Fixed yx, yy;
|
|
||||||
FT_F26Dot6 ox, oy; /* offsets */
|
|
||||||
|
|
||||||
} CFF_Transform;
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* */
|
|
||||||
/* CFF driver class. */
|
|
||||||
/* */
|
|
||||||
typedef struct CFF_DriverRec_
|
|
||||||
{
|
|
||||||
FT_DriverRec root;
|
|
||||||
|
|
||||||
FT_UInt hinting_engine;
|
|
||||||
FT_Bool no_stem_darkening;
|
|
||||||
FT_Int darken_params[8];
|
|
||||||
FT_Int32 random_seed;
|
|
||||||
|
|
||||||
} CFF_DriverRec;
|
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cff_size_init( FT_Size size ); /* CFF_Size */
|
cff_size_init( FT_Size size ); /* CFF_Size */
|
||||||
|
|
||||||
|
@ -171,10 +71,10 @@ FT_BEGIN_HEADER
|
||||||
/* Driver functions */
|
/* Driver functions */
|
||||||
/* */
|
/* */
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cff_driver_init( FT_Module module ); /* CFF_Driver */
|
cff_driver_init( FT_Module module ); /* PS_Driver */
|
||||||
|
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
cff_driver_done( FT_Module module ); /* CFF_Driver */
|
cff_driver_done( FT_Module module ); /* PS_Driver */
|
||||||
|
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
|
@ -21,10 +21,10 @@
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_CALC_H
|
#include FT_INTERNAL_CALC_H
|
||||||
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
|
|
||||||
#include "cfferrs.h"
|
#include "cfferrs.h"
|
||||||
#include "cffpic.h"
|
#include "cffpic.h"
|
||||||
#include "cffgload.h"
|
|
||||||
#include "cffload.h"
|
#include "cffload.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1299,12 +1299,18 @@
|
||||||
FT_Byte* start,
|
FT_Byte* start,
|
||||||
FT_Byte* limit )
|
FT_Byte* limit )
|
||||||
{
|
{
|
||||||
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||||
|
PSAux_Service psaux;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
FT_Byte* p = start;
|
FT_Byte* p = start;
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
FT_Library library = parser->library;
|
FT_Library library = parser->library;
|
||||||
FT_UNUSED( library );
|
FT_UNUSED( library );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
parser->top = parser->stack;
|
parser->top = parser->stack;
|
||||||
parser->start = start;
|
parser->start = start;
|
||||||
parser->limit = limit;
|
parser->limit = limit;
|
||||||
|
@ -1388,10 +1394,19 @@
|
||||||
cff_rec.top_font.font_dict.num_axes = parser->num_axes;
|
cff_rec.top_font.font_dict.num_axes = parser->num_axes;
|
||||||
decoder.cff = &cff_rec;
|
decoder.cff = &cff_rec;
|
||||||
|
|
||||||
error = cff_decoder_parse_charstrings( &decoder,
|
psaux = (PSAux_Service)FT_Get_Module_Interface(
|
||||||
charstring_base,
|
library, "psaux" );
|
||||||
charstring_len,
|
if ( !psaux )
|
||||||
1 );
|
{
|
||||||
|
FT_ERROR(( "cff_parser_run: cannot access `psaux' module\n" ));
|
||||||
|
error = FT_THROW( Missing_Module );
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = psaux->cff_decoder_funcs->parse_charstrings_old( &decoder,
|
||||||
|
charstring_base,
|
||||||
|
charstring_len,
|
||||||
|
1 );
|
||||||
|
|
||||||
/* Now copy the stack data in the temporary decoder object, */
|
/* Now copy the stack data in the temporary decoder object, */
|
||||||
/* converting it back to charstring number representations */
|
/* converting it back to charstring number representations */
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include "cfftypes.h"
|
#include FT_INTERNAL_CFF_TYPES_H
|
||||||
#include FT_INTERNAL_OBJECTS_H
|
#include FT_INTERNAL_OBJECTS_H
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
|
|
||||||
#include FT_INTERNAL_PIC_H
|
#include FT_INTERNAL_PIC_H
|
||||||
|
|
||||||
|
|
||||||
#ifndef FT_CONFIG_OPTION_PIC
|
#ifndef FT_CONFIG_OPTION_PIC
|
||||||
|
|
||||||
#define CFF_SERVICE_PS_INFO_GET cff_service_ps_info
|
#define CFF_SERVICE_PS_INFO_GET cff_service_ps_info
|
||||||
|
@ -34,6 +33,7 @@
|
||||||
#define CFF_SERVICES_GET cff_services
|
#define CFF_SERVICES_GET cff_services
|
||||||
#define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters
|
#define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters
|
||||||
#define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations
|
#define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations
|
||||||
|
#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load
|
||||||
#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
|
#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
|
||||||
#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
|
#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
|
||||||
#define CFF_FIELD_HANDLERS_GET cff_field_handlers
|
#define CFF_FIELD_HANDLERS_GET cff_field_handlers
|
||||||
|
@ -65,6 +65,7 @@ FT_BEGIN_HEADER
|
||||||
FT_Service_PropertiesRec cff_service_properties;
|
FT_Service_PropertiesRec cff_service_properties;
|
||||||
FT_Service_MultiMastersRec cff_service_multi_masters;
|
FT_Service_MultiMastersRec cff_service_multi_masters;
|
||||||
FT_Service_MetricsVariationsRec cff_service_metrics_variations;
|
FT_Service_MetricsVariationsRec cff_service_metrics_variations;
|
||||||
|
FT_Service_CFFLoadRec cff_service_cff_load;
|
||||||
FT_CMap_ClassRec cff_cmap_encoding_class_rec;
|
FT_CMap_ClassRec cff_cmap_encoding_class_rec;
|
||||||
FT_CMap_ClassRec cff_cmap_unicode_class_rec;
|
FT_CMap_ClassRec cff_cmap_unicode_class_rec;
|
||||||
|
|
||||||
|
@ -92,6 +93,8 @@ FT_BEGIN_HEADER
|
||||||
( GET_PIC( library )->cff_service_multi_masters )
|
( GET_PIC( library )->cff_service_multi_masters )
|
||||||
#define CFF_SERVICE_METRICS_VAR_GET \
|
#define CFF_SERVICE_METRICS_VAR_GET \
|
||||||
( GET_PIC( library )->cff_service_metrics_variations )
|
( GET_PIC( library )->cff_service_metrics_variations )
|
||||||
|
#define CFF_SERVICE_CFF_LOAD_GET \
|
||||||
|
( GET_PIC( library )->cff_service_cff_load )
|
||||||
#define CFF_CMAP_ENCODING_CLASS_REC_GET \
|
#define CFF_CMAP_ENCODING_CLASS_REC_GET \
|
||||||
( GET_PIC( library )->cff_cmap_encoding_class_rec )
|
( GET_PIC( library )->cff_cmap_encoding_class_rec )
|
||||||
#define CFF_CMAP_UNICODE_CLASS_REC_GET \
|
#define CFF_CMAP_UNICODE_CLASS_REC_GET \
|
||||||
|
|
|
@ -32,27 +32,14 @@ CFF_DRV_SRC := $(CFF_DIR)/cffcmap.c \
|
||||||
$(CFF_DIR)/cffload.c \
|
$(CFF_DIR)/cffload.c \
|
||||||
$(CFF_DIR)/cffobjs.c \
|
$(CFF_DIR)/cffobjs.c \
|
||||||
$(CFF_DIR)/cffparse.c \
|
$(CFF_DIR)/cffparse.c \
|
||||||
$(CFF_DIR)/cffpic.c \
|
$(CFF_DIR)/cffpic.c
|
||||||
$(CFF_DIR)/cf2arrst.c \
|
|
||||||
$(CFF_DIR)/cf2blues.c \
|
|
||||||
$(CFF_DIR)/cf2error.c \
|
|
||||||
$(CFF_DIR)/cf2font.c \
|
|
||||||
$(CFF_DIR)/cf2ft.c \
|
|
||||||
$(CFF_DIR)/cf2hints.c \
|
|
||||||
$(CFF_DIR)/cf2intrp.c \
|
|
||||||
$(CFF_DIR)/cf2read.c \
|
|
||||||
$(CFF_DIR)/cf2stack.c
|
|
||||||
|
|
||||||
|
|
||||||
# CFF driver headers
|
# CFF driver headers
|
||||||
#
|
#
|
||||||
CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
|
CFF_DRV_H := $(CFF_DRV_SRC:%.c=%.h) \
|
||||||
$(CFF_DIR)/cfferrs.h \
|
$(CFF_DIR)/cfferrs.h \
|
||||||
$(CFF_DIR)/cfftoken.h \
|
$(CFF_DIR)/cfftoken.h
|
||||||
$(CFF_DIR)/cfftypes.h \
|
|
||||||
$(CFF_DIR)/cf2fixed.h \
|
|
||||||
$(CFF_DIR)/cf2glue.h \
|
|
||||||
$(CFF_DIR)/cf2types.h
|
|
||||||
|
|
||||||
|
|
||||||
# CFF driver object(s)
|
# CFF driver object(s)
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
#include FT_OUTLINE_H
|
#include FT_OUTLINE_H
|
||||||
#include FT_INTERNAL_CALC_H
|
#include FT_INTERNAL_CALC_H
|
||||||
|
|
||||||
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
|
#include FT_INTERNAL_CFF_TYPES_H
|
||||||
|
#include FT_TYPE1_DRIVER_H
|
||||||
|
|
||||||
#include "ciderrs.h"
|
#include "ciderrs.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,6 +56,8 @@
|
||||||
FT_ULong glyph_length = 0;
|
FT_ULong glyph_length = 0;
|
||||||
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
||||||
|
|
||||||
|
FT_Bool force_scaling = FALSE;
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
FT_Incremental_InterfaceRec *inc =
|
FT_Incremental_InterfaceRec *inc =
|
||||||
face->root.internal->incremental_interface;
|
face->root.internal->incremental_interface;
|
||||||
|
@ -169,9 +175,43 @@
|
||||||
if ( decoder->lenIV >= 0 )
|
if ( decoder->lenIV >= 0 )
|
||||||
psaux->t1_decrypt( charstring, glyph_length, 4330 );
|
psaux->t1_decrypt( charstring, glyph_length, 4330 );
|
||||||
|
|
||||||
error = decoder->funcs.parse_charstrings(
|
/* choose which renderer to use */
|
||||||
decoder, charstring + cs_offset,
|
if ( ((PS_Driver)FT_FACE_DRIVER( face ))->hinting_engine == FT_T1_HINTING_FREETYPE ||
|
||||||
glyph_length - cs_offset );
|
decoder->builder.metrics_only )
|
||||||
|
error = psaux->t1_decoder_funcs->parse_charstrings_old( decoder,
|
||||||
|
charstring + cs_offset,
|
||||||
|
glyph_length - cs_offset );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PS_Decoder psdecoder;
|
||||||
|
CFF_SubFontRec subfont;
|
||||||
|
|
||||||
|
|
||||||
|
psaux->ps_decoder_init( &psdecoder, decoder, TRUE );
|
||||||
|
|
||||||
|
psaux->t1_make_subfont( FT_FACE( face ), &dict->private_dict, &subfont );
|
||||||
|
psdecoder.current_subfont = &subfont;
|
||||||
|
|
||||||
|
error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder,
|
||||||
|
charstring + cs_offset,
|
||||||
|
glyph_length - cs_offset );
|
||||||
|
|
||||||
|
/* Adobe's engine uses 16.16 numbers everywhere; */
|
||||||
|
/* as a consequence, glyphs larger than 2000ppem get rejected */
|
||||||
|
if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
|
||||||
|
{
|
||||||
|
/* this time, we retry unhinted and scale up the glyph later on */
|
||||||
|
/* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
|
||||||
|
/* 0x400 for both `x_scale' and `y_scale' in this case) */
|
||||||
|
((CID_GlyphSlot)decoder->builder.glyph)->hint = FALSE;
|
||||||
|
|
||||||
|
force_scaling = TRUE;
|
||||||
|
|
||||||
|
error = psaux->t1_decoder_funcs->parse_charstrings( &psdecoder,
|
||||||
|
charstring + cs_offset,
|
||||||
|
glyph_length - cs_offset );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
|
@ -200,6 +240,8 @@
|
||||||
Exit:
|
Exit:
|
||||||
FT_FREE( charstring );
|
FT_FREE( charstring );
|
||||||
|
|
||||||
|
((CID_GlyphSlot)decoder->builder.glyph)->scaled = force_scaling;
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,6 +330,7 @@
|
||||||
T1_DecoderRec decoder;
|
T1_DecoderRec decoder;
|
||||||
CID_Face face = (CID_Face)cidglyph->face;
|
CID_Face face = (CID_Face)cidglyph->face;
|
||||||
FT_Bool hinting;
|
FT_Bool hinting;
|
||||||
|
FT_Bool scaled;
|
||||||
|
|
||||||
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
||||||
FT_Matrix font_matrix;
|
FT_Matrix font_matrix;
|
||||||
|
@ -311,7 +354,10 @@
|
||||||
|
|
||||||
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
|
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
|
||||||
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
|
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
|
||||||
|
scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
|
||||||
|
|
||||||
|
glyph->hint = hinting;
|
||||||
|
glyph->scaled = scaled;
|
||||||
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
||||||
|
|
||||||
error = psaux->t1_decoder_funcs->init( &decoder,
|
error = psaux->t1_decoder_funcs->init( &decoder,
|
||||||
|
@ -337,6 +383,10 @@
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
|
|
||||||
|
/* Copy flags back for forced scaling */
|
||||||
|
hinting = glyph->hint;
|
||||||
|
scaled = glyph->scaled;
|
||||||
|
|
||||||
font_matrix = decoder.font_matrix;
|
font_matrix = decoder.font_matrix;
|
||||||
font_offset = decoder.font_offset;
|
font_offset = decoder.font_offset;
|
||||||
|
|
||||||
|
@ -410,7 +460,7 @@
|
||||||
metrics->vertAdvance += font_offset.y;
|
metrics->vertAdvance += font_offset.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || scaled )
|
||||||
{
|
{
|
||||||
/* scale the outline and the metrics */
|
/* scale the outline and the metrics */
|
||||||
FT_Int n;
|
FT_Int n;
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
#include FT_SERVICE_POSTSCRIPT_CMAPS_H
|
||||||
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
|
||||||
|
#include FT_TYPE1_DRIVER_H
|
||||||
|
|
||||||
#include "ciderrs.h"
|
#include "ciderrs.h"
|
||||||
|
|
||||||
|
@ -463,9 +464,38 @@
|
||||||
/* FreeType error code. 0 means success. */
|
/* FreeType error code. 0 means success. */
|
||||||
/* */
|
/* */
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
cid_driver_init( FT_Module driver )
|
cid_driver_init( FT_Module module )
|
||||||
{
|
{
|
||||||
FT_UNUSED( driver );
|
PS_Driver driver = (PS_Driver)module;
|
||||||
|
|
||||||
|
FT_UInt32 seed;
|
||||||
|
|
||||||
|
|
||||||
|
/* set default property values, cf. `ftcffdrv.h' */
|
||||||
|
driver->hinting_engine = FT_T1_HINTING_ADOBE;
|
||||||
|
|
||||||
|
driver->no_stem_darkening = TRUE;
|
||||||
|
|
||||||
|
driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
|
||||||
|
driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
|
||||||
|
driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2;
|
||||||
|
driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2;
|
||||||
|
driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3;
|
||||||
|
driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3;
|
||||||
|
driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4;
|
||||||
|
driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4;
|
||||||
|
|
||||||
|
/* compute random seed from some memory addresses */
|
||||||
|
seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
|
||||||
|
(FT_Offset)(char*)&module ^
|
||||||
|
(FT_Offset)(char*)module->memory );
|
||||||
|
seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
|
||||||
|
|
||||||
|
driver->random_seed = (FT_Int32)seed;
|
||||||
|
if ( driver->random_seed < 0 )
|
||||||
|
driver->random_seed = -driver->random_seed;
|
||||||
|
else if ( driver->random_seed == 0 )
|
||||||
|
driver->random_seed = 123456789;
|
||||||
|
|
||||||
return FT_Err_Ok;
|
return FT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,7 @@
|
||||||
FT_MODULE_FONT_DRIVER |
|
FT_MODULE_FONT_DRIVER |
|
||||||
FT_MODULE_DRIVER_SCALABLE |
|
FT_MODULE_DRIVER_SCALABLE |
|
||||||
FT_MODULE_DRIVER_HAS_HINTER,
|
FT_MODULE_DRIVER_HAS_HINTER,
|
||||||
sizeof ( FT_DriverRec ),
|
sizeof ( PS_DriverRec ),
|
||||||
|
|
||||||
"t1cid", /* module name */
|
"t1cid", /* module name */
|
||||||
0x10000L, /* version 1.0 of driver */
|
0x10000L, /* version 1.0 of driver */
|
||||||
|
|
|
@ -22,6 +22,16 @@ SubDir FT2_TOP $(FT2_SRC_DIR) psaux ;
|
||||||
psobjs
|
psobjs
|
||||||
t1cmap
|
t1cmap
|
||||||
t1decode
|
t1decode
|
||||||
|
cffdecode
|
||||||
|
psarrst
|
||||||
|
psblues
|
||||||
|
pserror
|
||||||
|
psfont
|
||||||
|
psft
|
||||||
|
pshints
|
||||||
|
psintrp
|
||||||
|
psread
|
||||||
|
psstack
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,56 @@
|
||||||
|
/***************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* cffdecode.h */
|
||||||
|
/* */
|
||||||
|
/* PostScript CFF (Type 2) decoding routines (specification). */
|
||||||
|
/* */
|
||||||
|
/* Copyright notice here. */
|
||||||
|
/* */
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CFFDECODE_H_
|
||||||
|
#define CFFDECODE_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <ft2build.h>
|
||||||
|
|
||||||
|
|
||||||
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
cff_decoder_init( CFF_Decoder* decoder,
|
||||||
|
TT_Face face,
|
||||||
|
CFF_Size size,
|
||||||
|
CFF_GlyphSlot slot,
|
||||||
|
FT_Bool hinting,
|
||||||
|
FT_Render_Mode hint_mode,
|
||||||
|
CFF_Decoder_Get_Glyph_Callback get_callback,
|
||||||
|
CFF_Decoder_Free_Glyph_Callback free_callback);
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
cff_decoder_prepare( CFF_Decoder* decoder,
|
||||||
|
CFF_Size size,
|
||||||
|
FT_UInt glyph_index );
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Int )
|
||||||
|
cff_lookup_glyph_by_stdcharcode( CFF_Font cff,
|
||||||
|
FT_Int charcode );
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
cff_decoder_parse_charstrings( CFF_Decoder* decoder,
|
||||||
|
FT_Byte* charstring_base,
|
||||||
|
FT_ULong charstring_len,
|
||||||
|
FT_Bool in_dict );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
FT_END_HEADER
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2arrst.c */
|
/* psarrst.c */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for Array Stacks (body). */
|
/* Adobe's code for Array Stacks (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -36,13 +36,13 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
|
|
||||||
#include "cf2glue.h"
|
#include "psglue.h"
|
||||||
#include "cf2arrst.h"
|
#include "psarrst.h"
|
||||||
|
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2arrst.h */
|
/* psarrst.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for Array Stacks (specification). */
|
/* Adobe's code for Array Stacks (specification). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
#define CF2ARRST_H_
|
#define CF2ARRST_H_
|
||||||
|
|
||||||
|
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
|
@ -25,6 +25,17 @@
|
||||||
#include "psobjs.c"
|
#include "psobjs.c"
|
||||||
#include "t1cmap.c"
|
#include "t1cmap.c"
|
||||||
#include "t1decode.c"
|
#include "t1decode.c"
|
||||||
|
#include "cffdecode.c"
|
||||||
|
|
||||||
|
#include "psarrst.c"
|
||||||
|
#include "psblues.c"
|
||||||
|
#include "pserror.c"
|
||||||
|
#include "psfont.c"
|
||||||
|
#include "psft.c"
|
||||||
|
#include "pshints.c"
|
||||||
|
#include "psintrp.c"
|
||||||
|
#include "psread.c"
|
||||||
|
#include "psstack.c"
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
#include "psobjs.h"
|
#include "psobjs.h"
|
||||||
#include "t1decode.h"
|
#include "t1decode.h"
|
||||||
#include "t1cmap.h"
|
#include "t1cmap.h"
|
||||||
|
#include "psft.h"
|
||||||
|
#include "cffdecode.h"
|
||||||
|
|
||||||
#ifndef T1_CONFIG_OPTION_NO_AFM
|
#ifndef T1_CONFIG_OPTION_NO_AFM
|
||||||
#include "afmparse.h"
|
#include "afmparse.h"
|
||||||
|
@ -59,6 +61,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FT_CALLBACK_TABLE_DEF
|
||||||
|
const PS_Builder_FuncsRec ps_builder_funcs =
|
||||||
|
{
|
||||||
|
ps_builder_init, /* init */
|
||||||
|
ps_builder_done /* done */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
FT_CALLBACK_TABLE_DEF
|
FT_CALLBACK_TABLE_DEF
|
||||||
const T1_Builder_FuncsRec t1_builder_funcs =
|
const T1_Builder_FuncsRec t1_builder_funcs =
|
||||||
{
|
{
|
||||||
|
@ -79,7 +89,8 @@
|
||||||
{
|
{
|
||||||
t1_decoder_init, /* init */
|
t1_decoder_init, /* init */
|
||||||
t1_decoder_done, /* done */
|
t1_decoder_done, /* done */
|
||||||
t1_decoder_parse_charstrings /* parse_charstrings */
|
t1_decoder_parse_charstrings, /* parse_charstrings_old */
|
||||||
|
cf2_decoder_parse_charstrings /* parse_charstrings */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +115,34 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FT_CALLBACK_TABLE_DEF
|
||||||
|
const CFF_Builder_FuncsRec cff_builder_funcs =
|
||||||
|
{
|
||||||
|
cff_builder_init, /* init */
|
||||||
|
cff_builder_done, /* done */
|
||||||
|
|
||||||
|
cff_check_points, /* check_points */
|
||||||
|
cff_builder_add_point, /* add_point */
|
||||||
|
cff_builder_add_point1, /* add_point1 */
|
||||||
|
cff_builder_add_contour, /* add_contour */
|
||||||
|
cff_builder_start_point, /* start_point */
|
||||||
|
cff_builder_close_contour /* close_contour */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
FT_CALLBACK_TABLE_DEF
|
||||||
|
const CFF_Decoder_FuncsRec cff_decoder_funcs =
|
||||||
|
{
|
||||||
|
cff_decoder_init, /* init */
|
||||||
|
cff_decoder_prepare, /* prepare */
|
||||||
|
|
||||||
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||||
|
cff_decoder_parse_charstrings, /* parse_charstrings_old */
|
||||||
|
#endif
|
||||||
|
cf2_decoder_parse_charstrings /* parse_charstrings */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
const PSAux_Interface psaux_interface =
|
const PSAux_Interface psaux_interface =
|
||||||
{
|
{
|
||||||
|
@ -112,6 +151,9 @@
|
||||||
&t1_builder_funcs,
|
&t1_builder_funcs,
|
||||||
&t1_decoder_funcs,
|
&t1_decoder_funcs,
|
||||||
t1_decrypt,
|
t1_decrypt,
|
||||||
|
cff_random,
|
||||||
|
ps_decoder_init,
|
||||||
|
t1_make_subfont,
|
||||||
|
|
||||||
(const T1_CMap_ClassesRec*) &t1_cmap_classes,
|
(const T1_CMap_ClassesRec*) &t1_cmap_classes,
|
||||||
|
|
||||||
|
@ -120,6 +162,8 @@
|
||||||
#else
|
#else
|
||||||
0,
|
0,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
&cff_decoder_funcs,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2blues.c */
|
/* psblues.c */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for handling Blue Zones (body). */
|
/* Adobe's code for handling Blue Zones (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -36,12 +36,12 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
|
|
||||||
#include "cf2blues.h"
|
#include "psblues.h"
|
||||||
#include "cf2hints.h"
|
#include "pshints.h"
|
||||||
#include "cf2font.h"
|
#include "psfont.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
CF2_Font font )
|
CF2_Font font )
|
||||||
{
|
{
|
||||||
/* pointer to parsed font object */
|
/* pointer to parsed font object */
|
||||||
CFF_Decoder* decoder = font->decoder;
|
PS_Decoder* decoder = font->decoder;
|
||||||
|
|
||||||
CF2_Fixed zoneHeight;
|
CF2_Fixed zoneHeight;
|
||||||
CF2_Fixed maxZoneHeight = 0;
|
CF2_Fixed maxZoneHeight = 0;
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2blues.h */
|
/* psblues.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for handling Blue Zones (specification). */
|
/* Adobe's code for handling Blue Zones (specification). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
#define CF2BLUES_H_
|
#define CF2BLUES_H_
|
||||||
|
|
||||||
|
|
||||||
#include "cf2glue.h"
|
#include "psglue.h"
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2error.c */
|
/* pserror.c */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for error handling (body). */
|
/* Adobe's code for error handling (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -36,8 +36,8 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2error.h */
|
/* pserror.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for error handling (specification). */
|
/* Adobe's code for error handling (specification). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
|
|
||||||
#include FT_ERRORS_H
|
#include FT_ERRORS_H
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2fixed.h */
|
/* psfixed.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for Fixed Point Mathematics (specification only). */
|
/* Adobe's code for Fixed Point Mathematics (specification only). */
|
||||||
/* */
|
/* */
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2font.c */
|
/* psfont.c */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for font instances (body). */
|
/* Adobe's code for font instances (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -39,12 +39,12 @@
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_INTERNAL_CALC_H
|
#include FT_INTERNAL_CALC_H
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
|
|
||||||
#include "cf2glue.h"
|
#include "psglue.h"
|
||||||
#include "cf2font.h"
|
#include "psfont.h"
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
#include "cf2intrp.h"
|
#include "psintrp.h"
|
||||||
|
|
||||||
|
|
||||||
/* Compute a stem darkening amount in character space. */
|
/* Compute a stem darkening amount in character space. */
|
||||||
|
@ -243,7 +243,7 @@
|
||||||
const CF2_Matrix* transform )
|
const CF2_Matrix* transform )
|
||||||
{
|
{
|
||||||
/* pointer to parsed font object */
|
/* pointer to parsed font object */
|
||||||
CFF_Decoder* decoder = font->decoder;
|
PS_Decoder* decoder = font->decoder;
|
||||||
|
|
||||||
FT_Bool needExtraSetup = FALSE;
|
FT_Bool needExtraSetup = FALSE;
|
||||||
|
|
||||||
|
@ -260,7 +260,6 @@
|
||||||
CF2_UInt lenNormalizedV = 0;
|
CF2_UInt lenNormalizedV = 0;
|
||||||
FT_Fixed* normalizedV = NULL;
|
FT_Fixed* normalizedV = NULL;
|
||||||
|
|
||||||
|
|
||||||
/* clear previous error */
|
/* clear previous error */
|
||||||
font->error = FT_Err_Ok;
|
font->error = FT_Err_Ok;
|
||||||
|
|
||||||
|
@ -273,46 +272,50 @@
|
||||||
needExtraSetup = TRUE;
|
needExtraSetup = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check for variation vectors */
|
if ( !font->isT1 )
|
||||||
vstore = cf2_getVStore( decoder );
|
|
||||||
hasVariations = ( vstore->dataCount != 0 );
|
|
||||||
|
|
||||||
if ( hasVariations )
|
|
||||||
{
|
{
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload;
|
||||||
/* check whether Private DICT in this subfont needs to be reparsed */
|
/* check for variation vectors */
|
||||||
font->error = cf2_getNormalizedVector( decoder,
|
vstore = cf2_getVStore( decoder );
|
||||||
&lenNormalizedV,
|
hasVariations = ( vstore->dataCount != 0 );
|
||||||
&normalizedV );
|
|
||||||
if ( font->error )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if ( cff_blend_check_vector( &subFont->blend,
|
if ( hasVariations )
|
||||||
subFont->private_dict.vsindex,
|
|
||||||
lenNormalizedV,
|
|
||||||
normalizedV ) )
|
|
||||||
{
|
{
|
||||||
/* blend has changed, reparse */
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
cff_load_private_dict( decoder->cff,
|
/* check whether Private DICT in this subfont needs to be reparsed */
|
||||||
subFont,
|
font->error = cf2_getNormalizedVector( decoder,
|
||||||
lenNormalizedV,
|
&lenNormalizedV,
|
||||||
normalizedV );
|
&normalizedV );
|
||||||
needExtraSetup = TRUE;
|
if ( font->error )
|
||||||
}
|
return;
|
||||||
|
|
||||||
|
if ( cffload->blend_check_vector( &subFont->blend,
|
||||||
|
subFont->private_dict.vsindex,
|
||||||
|
lenNormalizedV,
|
||||||
|
normalizedV ) )
|
||||||
|
{
|
||||||
|
/* blend has changed, reparse */
|
||||||
|
cffload->load_private_dict( decoder->cff,
|
||||||
|
subFont,
|
||||||
|
lenNormalizedV,
|
||||||
|
normalizedV );
|
||||||
|
needExtraSetup = TRUE;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* copy from subfont */
|
/* copy from subfont */
|
||||||
font->blend.font = subFont->blend.font;
|
font->blend.font = subFont->blend.font;
|
||||||
|
|
||||||
/* clear state of charstring blend */
|
/* clear state of charstring blend */
|
||||||
font->blend.usedBV = FALSE;
|
font->blend.usedBV = FALSE;
|
||||||
|
|
||||||
/* initialize value for charstring */
|
/* initialize value for charstring */
|
||||||
font->vsindex = subFont->private_dict.vsindex;
|
font->vsindex = subFont->private_dict.vsindex;
|
||||||
|
|
||||||
/* store vector inputs for blends in charstring */
|
/* store vector inputs for blends in charstring */
|
||||||
font->lenNDV = lenNormalizedV;
|
font->lenNDV = lenNormalizedV;
|
||||||
font->NDV = normalizedV;
|
font->NDV = normalizedV;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if ppem has changed, we need to recompute some cached data */
|
/* if ppem has changed, we need to recompute some cached data */
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2font.h */
|
/* psfont.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for font instances (specification). */
|
/* Adobe's code for font instances (specification). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -40,9 +40,10 @@
|
||||||
#define CF2FONT_H_
|
#define CF2FONT_H_
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include FT_SERVICE_CFF_TABLE_LOAD_H
|
||||||
#include "cf2blues.h"
|
|
||||||
#include "cffload.h"
|
#include "psft.h"
|
||||||
|
#include "psblues.h"
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
@ -64,6 +65,7 @@ FT_BEGIN_HEADER
|
||||||
FT_Memory memory;
|
FT_Memory memory;
|
||||||
FT_Error error; /* shared error for this instance */
|
FT_Error error; /* shared error for this instance */
|
||||||
|
|
||||||
|
FT_Bool isT1;
|
||||||
FT_Bool isCFF2;
|
FT_Bool isCFF2;
|
||||||
CF2_RenderingFlags renderingFlags;
|
CF2_RenderingFlags renderingFlags;
|
||||||
|
|
||||||
|
@ -89,7 +91,7 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
/* FreeType related members */
|
/* FreeType related members */
|
||||||
CF2_OutlineRec outline; /* freetype glyph outline functions */
|
CF2_OutlineRec outline; /* freetype glyph outline functions */
|
||||||
CFF_Decoder* decoder;
|
PS_Decoder* decoder;
|
||||||
CFF_SubFont lastSubfont; /* FreeType parsed data; */
|
CFF_SubFont lastSubfont; /* FreeType parsed data; */
|
||||||
/* top font or subfont */
|
/* top font or subfont */
|
||||||
|
|
||||||
|
@ -111,6 +113,8 @@ FT_BEGIN_HEADER
|
||||||
/* counterclockwise winding */
|
/* counterclockwise winding */
|
||||||
|
|
||||||
CF2_BluesRec blues; /* computed zone data */
|
CF2_BluesRec blues; /* computed zone data */
|
||||||
|
|
||||||
|
FT_Service_CFFLoad cffload; /* Pointer to cff functions */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2ft.c */
|
/* psft.c */
|
||||||
/* */
|
/* */
|
||||||
/* FreeType Glue Component to Adobe's Interpreter (body). */
|
/* FreeType Glue Component to Adobe's Interpreter (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -36,12 +36,18 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
|
|
||||||
#include "cf2font.h"
|
#include "psfont.h"
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
|
|
||||||
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
|
#include FT_MULTIPLE_MASTERS_H
|
||||||
|
#include FT_SERVICE_MULTIPLE_MASTERS_H
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include FT_SERVICE_CFF_TABLE_LOAD_H
|
||||||
|
|
||||||
#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */
|
#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */
|
||||||
|
|
||||||
|
@ -83,7 +89,7 @@
|
||||||
cf2_setGlyphWidth( CF2_Outline outline,
|
cf2_setGlyphWidth( CF2_Outline outline,
|
||||||
CF2_Fixed width )
|
CF2_Fixed width )
|
||||||
{
|
{
|
||||||
CFF_Decoder* decoder = outline->decoder;
|
PS_Decoder* decoder = outline->decoder;
|
||||||
|
|
||||||
|
|
||||||
FT_ASSERT( decoder );
|
FT_ASSERT( decoder );
|
||||||
|
@ -122,8 +128,8 @@
|
||||||
const CF2_CallbackParams params )
|
const CF2_CallbackParams params )
|
||||||
{
|
{
|
||||||
/* downcast the object pointer */
|
/* downcast the object pointer */
|
||||||
CF2_Outline outline = (CF2_Outline)callbacks;
|
CF2_Outline outline = (CF2_Outline)callbacks;
|
||||||
CFF_Builder* builder;
|
PS_Builder* builder;
|
||||||
|
|
||||||
(void)params; /* only used in debug mode */
|
(void)params; /* only used in debug mode */
|
||||||
|
|
||||||
|
@ -134,7 +140,7 @@
|
||||||
builder = &outline->decoder->builder;
|
builder = &outline->decoder->builder;
|
||||||
|
|
||||||
/* note: two successive moves simply close the contour twice */
|
/* note: two successive moves simply close the contour twice */
|
||||||
cff_builder_close_contour( builder );
|
ps_builder_close_contour( builder );
|
||||||
builder->path_begun = 0;
|
builder->path_begun = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +152,8 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
|
|
||||||
/* downcast the object pointer */
|
/* downcast the object pointer */
|
||||||
CF2_Outline outline = (CF2_Outline)callbacks;
|
CF2_Outline outline = (CF2_Outline)callbacks;
|
||||||
CFF_Builder* builder;
|
PS_Builder* builder;
|
||||||
|
|
||||||
|
|
||||||
FT_ASSERT( outline && outline->decoder );
|
FT_ASSERT( outline && outline->decoder );
|
||||||
|
@ -159,9 +165,9 @@
|
||||||
{
|
{
|
||||||
/* record the move before the line; also check points and set */
|
/* record the move before the line; also check points and set */
|
||||||
/* `path_begun' */
|
/* `path_begun' */
|
||||||
error = cff_builder_start_point( builder,
|
error = ps_builder_start_point( builder,
|
||||||
params->pt0.x,
|
params->pt0.x,
|
||||||
params->pt0.y );
|
params->pt0.y );
|
||||||
if ( error )
|
if ( error )
|
||||||
{
|
{
|
||||||
if ( !*callbacks->error )
|
if ( !*callbacks->error )
|
||||||
|
@ -170,10 +176,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* `cff_builder_add_point1' includes a check_points call for one point */
|
/* `ps_builder_add_point1' includes a check_points call for one point */
|
||||||
error = cff_builder_add_point1( builder,
|
error = ps_builder_add_point1( builder,
|
||||||
params->pt1.x,
|
params->pt1.x,
|
||||||
params->pt1.y );
|
params->pt1.y );
|
||||||
if ( error )
|
if ( error )
|
||||||
{
|
{
|
||||||
if ( !*callbacks->error )
|
if ( !*callbacks->error )
|
||||||
|
@ -190,8 +196,8 @@
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
|
|
||||||
/* downcast the object pointer */
|
/* downcast the object pointer */
|
||||||
CF2_Outline outline = (CF2_Outline)callbacks;
|
CF2_Outline outline = (CF2_Outline)callbacks;
|
||||||
CFF_Builder* builder;
|
PS_Builder* builder;
|
||||||
|
|
||||||
|
|
||||||
FT_ASSERT( outline && outline->decoder );
|
FT_ASSERT( outline && outline->decoder );
|
||||||
|
@ -203,9 +209,9 @@
|
||||||
{
|
{
|
||||||
/* record the move before the line; also check points and set */
|
/* record the move before the line; also check points and set */
|
||||||
/* `path_begun' */
|
/* `path_begun' */
|
||||||
error = cff_builder_start_point( builder,
|
error = ps_builder_start_point( builder,
|
||||||
params->pt0.x,
|
params->pt0.x,
|
||||||
params->pt0.y );
|
params->pt0.y );
|
||||||
if ( error )
|
if ( error )
|
||||||
{
|
{
|
||||||
if ( !*callbacks->error )
|
if ( !*callbacks->error )
|
||||||
|
@ -215,7 +221,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prepare room for 3 points: 2 off-curve, 1 on-curve */
|
/* prepare room for 3 points: 2 off-curve, 1 on-curve */
|
||||||
error = cff_check_points( builder, 3 );
|
error = ps_builder_check_points( builder, 3 );
|
||||||
if ( error )
|
if ( error )
|
||||||
{
|
{
|
||||||
if ( !*callbacks->error )
|
if ( !*callbacks->error )
|
||||||
|
@ -223,15 +229,15 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cff_builder_add_point( builder,
|
ps_builder_add_point( builder,
|
||||||
params->pt1.x,
|
params->pt1.x,
|
||||||
params->pt1.y, 0 );
|
params->pt1.y, 0 );
|
||||||
cff_builder_add_point( builder,
|
ps_builder_add_point( builder,
|
||||||
params->pt2.x,
|
params->pt2.x,
|
||||||
params->pt2.y, 0 );
|
params->pt2.y, 0 );
|
||||||
cff_builder_add_point( builder,
|
ps_builder_add_point( builder,
|
||||||
params->pt3.x,
|
params->pt3.x,
|
||||||
params->pt3.y, 1 );
|
params->pt3.y, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -253,11 +259,11 @@
|
||||||
|
|
||||||
/* get scaling and hint flag from GlyphSlot */
|
/* get scaling and hint flag from GlyphSlot */
|
||||||
static void
|
static void
|
||||||
cf2_getScaleAndHintFlag( CFF_Decoder* decoder,
|
cf2_getScaleAndHintFlag( PS_Decoder* decoder,
|
||||||
CF2_Fixed* x_scale,
|
CF2_Fixed* x_scale,
|
||||||
CF2_Fixed* y_scale,
|
CF2_Fixed* y_scale,
|
||||||
FT_Bool* hinted,
|
FT_Bool* hinted,
|
||||||
FT_Bool* scaled )
|
FT_Bool* scaled )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->builder.glyph );
|
FT_ASSERT( decoder && decoder->builder.glyph );
|
||||||
|
|
||||||
|
@ -284,47 +290,60 @@
|
||||||
/* get units per em from `FT_Face' */
|
/* get units per em from `FT_Face' */
|
||||||
/* TODO: should handle font matrix concatenation? */
|
/* TODO: should handle font matrix concatenation? */
|
||||||
static FT_UShort
|
static FT_UShort
|
||||||
cf2_getUnitsPerEm( CFF_Decoder* decoder )
|
cf2_getUnitsPerEm( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->builder.face );
|
FT_ASSERT( decoder && decoder->builder.face );
|
||||||
FT_ASSERT( decoder->builder.face->root.units_per_EM );
|
FT_ASSERT( decoder->builder.face->units_per_EM );
|
||||||
|
|
||||||
return decoder->builder.face->root.units_per_EM;
|
return decoder->builder.face->units_per_EM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Main entry point: Render one glyph. */
|
/* Main entry point: Render one glyph. */
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
cf2_decoder_parse_charstrings( CFF_Decoder* decoder,
|
cf2_decoder_parse_charstrings( PS_Decoder* decoder,
|
||||||
FT_Byte* charstring_base,
|
FT_Byte* charstring_base,
|
||||||
FT_ULong charstring_len )
|
FT_ULong charstring_len )
|
||||||
{
|
{
|
||||||
FT_Memory memory;
|
FT_Memory memory;
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
CF2_Font font;
|
CF2_Font font;
|
||||||
|
|
||||||
|
FT_Bool is_t1 = decoder->builder.is_t1;
|
||||||
|
|
||||||
FT_ASSERT( decoder && decoder->cff );
|
|
||||||
|
FT_ASSERT( decoder &&
|
||||||
|
( is_t1 || decoder->cff ) );
|
||||||
|
|
||||||
|
if ( is_t1 && !decoder->current_subfont )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "cf2_decoder_parse_charstrings (Type 1): "
|
||||||
|
"SubFont missing. Use `t1_make_subfont' first\n" ));
|
||||||
|
return FT_THROW( Invalid_Table );
|
||||||
|
}
|
||||||
|
|
||||||
memory = decoder->builder.memory;
|
memory = decoder->builder.memory;
|
||||||
|
|
||||||
/* CF2 data is saved here across glyphs */
|
/* CF2 data is saved here across glyphs */
|
||||||
font = (CF2_Font)decoder->cff->cf2_instance.data;
|
font = (CF2_Font)decoder->cf2_instance->data;
|
||||||
|
|
||||||
/* on first glyph, allocate instance structure */
|
/* on first glyph, allocate instance structure */
|
||||||
if ( !decoder->cff->cf2_instance.data )
|
if ( !decoder->cf2_instance->data )
|
||||||
{
|
{
|
||||||
decoder->cff->cf2_instance.finalizer =
|
decoder->cf2_instance->finalizer =
|
||||||
(FT_Generic_Finalizer)cf2_free_instance;
|
(FT_Generic_Finalizer)cf2_free_instance;
|
||||||
|
|
||||||
if ( FT_ALLOC( decoder->cff->cf2_instance.data,
|
if ( FT_ALLOC( decoder->cf2_instance->data,
|
||||||
sizeof ( CF2_FontRec ) ) )
|
sizeof ( CF2_FontRec ) ) )
|
||||||
return FT_THROW( Out_Of_Memory );
|
return FT_THROW( Out_Of_Memory );
|
||||||
|
|
||||||
font = (CF2_Font)decoder->cff->cf2_instance.data;
|
font = (CF2_Font)decoder->cf2_instance->data;
|
||||||
|
|
||||||
font->memory = memory;
|
font->memory = memory;
|
||||||
|
|
||||||
|
if ( !is_t1 )
|
||||||
|
font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload;
|
||||||
|
|
||||||
/* initialize a client outline, to be shared by each glyph rendered */
|
/* initialize a client outline, to be shared by each glyph rendered */
|
||||||
cf2_outline_init( &font->outline, font->memory, &font->error );
|
cf2_outline_init( &font->outline, font->memory, &font->error );
|
||||||
}
|
}
|
||||||
|
@ -337,13 +356,13 @@
|
||||||
{
|
{
|
||||||
/* build parameters for Adobe engine */
|
/* build parameters for Adobe engine */
|
||||||
|
|
||||||
CFF_Builder* builder = &decoder->builder;
|
PS_Builder* builder = &decoder->builder;
|
||||||
CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
|
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
|
||||||
|
|
||||||
FT_Bool no_stem_darkening_driver =
|
FT_Bool no_stem_darkening_driver =
|
||||||
driver->no_stem_darkening;
|
driver->no_stem_darkening;
|
||||||
FT_Char no_stem_darkening_font =
|
FT_Char no_stem_darkening_font =
|
||||||
builder->face->root.internal->no_stem_darkening;
|
builder->face->internal->no_stem_darkening;
|
||||||
|
|
||||||
/* local error */
|
/* local error */
|
||||||
FT_Error error2 = FT_Err_Ok;
|
FT_Error error2 = FT_Err_Ok;
|
||||||
|
@ -372,8 +391,14 @@
|
||||||
&hinted,
|
&hinted,
|
||||||
&scaled );
|
&scaled );
|
||||||
|
|
||||||
/* copy isCFF2 boolean from TT_Face to CF2_Font */
|
if ( is_t1 )
|
||||||
font->isCFF2 = builder->face->is_cff2;
|
font->isCFF2 = FALSE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* copy isCFF2 boolean from TT_Face to CF2_Font */
|
||||||
|
font->isCFF2 = ((TT_Face)builder->face)->is_cff2;
|
||||||
|
}
|
||||||
|
font->isT1 = is_t1;
|
||||||
|
|
||||||
font->renderingFlags = 0;
|
font->renderingFlags = 0;
|
||||||
if ( hinted )
|
if ( hinted )
|
||||||
|
@ -416,7 +441,7 @@
|
||||||
|
|
||||||
/* get pointer to current FreeType subfont (based on current glyphID) */
|
/* get pointer to current FreeType subfont (based on current glyphID) */
|
||||||
FT_LOCAL_DEF( CFF_SubFont )
|
FT_LOCAL_DEF( CFF_SubFont )
|
||||||
cf2_getSubfont( CFF_Decoder* decoder )
|
cf2_getSubfont( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -426,7 +451,7 @@
|
||||||
|
|
||||||
/* get pointer to VStore structure */
|
/* get pointer to VStore structure */
|
||||||
FT_LOCAL_DEF( CFF_VStore )
|
FT_LOCAL_DEF( CFF_VStore )
|
||||||
cf2_getVStore( CFF_Decoder* decoder )
|
cf2_getVStore( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->cff );
|
FT_ASSERT( decoder && decoder->cff );
|
||||||
|
|
||||||
|
@ -436,7 +461,7 @@
|
||||||
|
|
||||||
/* get maxstack value from CFF2 Top DICT */
|
/* get maxstack value from CFF2 Top DICT */
|
||||||
FT_LOCAL_DEF( FT_UInt )
|
FT_LOCAL_DEF( FT_UInt )
|
||||||
cf2_getMaxstack( CFF_Decoder* decoder )
|
cf2_getMaxstack( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->cff );
|
FT_ASSERT( decoder && decoder->cff );
|
||||||
|
|
||||||
|
@ -450,25 +475,32 @@
|
||||||
/* */
|
/* */
|
||||||
/* Note: Uses FT_Fixed not CF2_Fixed for the vector. */
|
/* Note: Uses FT_Fixed not CF2_Fixed for the vector. */
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
cf2_getNormalizedVector( CFF_Decoder* decoder,
|
cf2_getNormalizedVector( PS_Decoder* decoder,
|
||||||
CF2_UInt *len,
|
CF2_UInt *len,
|
||||||
FT_Fixed* *vec )
|
FT_Fixed* *vec )
|
||||||
{
|
{
|
||||||
|
TT_Face face;
|
||||||
|
FT_Service_MultiMasters mm;
|
||||||
|
|
||||||
FT_ASSERT( decoder && decoder->builder.face );
|
FT_ASSERT( decoder && decoder->builder.face );
|
||||||
FT_ASSERT( vec && len );
|
FT_ASSERT( vec && len );
|
||||||
|
FT_ASSERT( !decoder->builder.is_t1 );
|
||||||
|
|
||||||
return cff_get_var_blend( decoder->builder.face, len, NULL, vec, NULL );
|
face = (TT_Face)decoder->builder.face;
|
||||||
|
mm = (FT_Service_MultiMasters)face->mm;
|
||||||
|
|
||||||
|
return mm->get_var_blend( FT_FACE( face ), len, NULL, vec, NULL );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* get `y_ppem' from `CFF_Size' */
|
/* get `y_ppem' from `CFF_Size' */
|
||||||
FT_LOCAL_DEF( CF2_Fixed )
|
FT_LOCAL_DEF( CF2_Fixed )
|
||||||
cf2_getPpemY( CFF_Decoder* decoder )
|
cf2_getPpemY( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder &&
|
FT_ASSERT( decoder &&
|
||||||
decoder->builder.face &&
|
decoder->builder.face &&
|
||||||
decoder->builder.face->root.size );
|
decoder->builder.face->size );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note that `y_ppem' can be zero if there wasn't a call to
|
* Note that `y_ppem' can be zero if there wasn't a call to
|
||||||
|
@ -480,7 +512,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
return cf2_intToFixed(
|
return cf2_intToFixed(
|
||||||
decoder->builder.face->root.size->metrics.y_ppem );
|
decoder->builder.face->size->metrics.y_ppem );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -488,7 +520,7 @@
|
||||||
/* FreeType stores these as integer font units */
|
/* FreeType stores these as integer font units */
|
||||||
/* (note: variable names seem swapped) */
|
/* (note: variable names seem swapped) */
|
||||||
FT_LOCAL_DEF( CF2_Fixed )
|
FT_LOCAL_DEF( CF2_Fixed )
|
||||||
cf2_getStdVW( CFF_Decoder* decoder )
|
cf2_getStdVW( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -498,7 +530,7 @@
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( CF2_Fixed )
|
FT_LOCAL_DEF( CF2_Fixed )
|
||||||
cf2_getStdHW( CFF_Decoder* decoder )
|
cf2_getStdHW( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -509,10 +541,10 @@
|
||||||
|
|
||||||
/* note: FreeType stores 1000 times the actual value for `BlueScale' */
|
/* note: FreeType stores 1000 times the actual value for `BlueScale' */
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_getBlueMetrics( CFF_Decoder* decoder,
|
cf2_getBlueMetrics( PS_Decoder* decoder,
|
||||||
CF2_Fixed* blueScale,
|
CF2_Fixed* blueScale,
|
||||||
CF2_Fixed* blueShift,
|
CF2_Fixed* blueShift,
|
||||||
CF2_Fixed* blueFuzz )
|
CF2_Fixed* blueFuzz )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -529,9 +561,9 @@
|
||||||
/* get blue values counts and arrays; the FreeType parser has validated */
|
/* get blue values counts and arrays; the FreeType parser has validated */
|
||||||
/* the counts and verified that each is an even number */
|
/* the counts and verified that each is an even number */
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_getBlueValues( CFF_Decoder* decoder,
|
cf2_getBlueValues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data )
|
FT_Pos* *data )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -542,9 +574,9 @@
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_getOtherBlues( CFF_Decoder* decoder,
|
cf2_getOtherBlues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data )
|
FT_Pos* *data )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -555,9 +587,9 @@
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_getFamilyBlues( CFF_Decoder* decoder,
|
cf2_getFamilyBlues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data )
|
FT_Pos* *data )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -568,9 +600,9 @@
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_getFamilyOtherBlues( CFF_Decoder* decoder,
|
cf2_getFamilyOtherBlues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data )
|
FT_Pos* *data )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -581,7 +613,7 @@
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( CF2_Int )
|
FT_LOCAL_DEF( CF2_Int )
|
||||||
cf2_getLanguageGroup( CFF_Decoder* decoder )
|
cf2_getLanguageGroup( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -592,9 +624,9 @@
|
||||||
/* convert unbiased subroutine index to `CF2_Buffer' and */
|
/* convert unbiased subroutine index to `CF2_Buffer' and */
|
||||||
/* return 0 on success */
|
/* return 0 on success */
|
||||||
FT_LOCAL_DEF( CF2_Int )
|
FT_LOCAL_DEF( CF2_Int )
|
||||||
cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
|
cf2_initGlobalRegionBuffer( PS_Decoder* decoder,
|
||||||
CF2_Int subrNum,
|
CF2_Int subrNum,
|
||||||
CF2_Buffer buf )
|
CF2_Buffer buf )
|
||||||
{
|
{
|
||||||
CF2_UInt idx;
|
CF2_UInt idx;
|
||||||
|
|
||||||
|
@ -620,9 +652,9 @@
|
||||||
/* convert AdobeStandardEncoding code to CF2_Buffer; */
|
/* convert AdobeStandardEncoding code to CF2_Buffer; */
|
||||||
/* used for seac component */
|
/* used for seac component */
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
cf2_getSeacComponent( CFF_Decoder* decoder,
|
cf2_getSeacComponent( PS_Decoder* decoder,
|
||||||
CF2_Int code,
|
CF2_Int code,
|
||||||
CF2_Buffer buf )
|
CF2_Buffer buf )
|
||||||
{
|
{
|
||||||
CF2_Int gid;
|
CF2_Int gid;
|
||||||
FT_Byte* charstring;
|
FT_Byte* charstring;
|
||||||
|
@ -631,13 +663,14 @@
|
||||||
|
|
||||||
|
|
||||||
FT_ASSERT( decoder );
|
FT_ASSERT( decoder );
|
||||||
|
FT_ASSERT( !decoder->builder.is_t1 );
|
||||||
|
|
||||||
FT_ZERO( buf );
|
FT_ZERO( buf );
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
/* Incremental fonts don't necessarily have valid charsets. */
|
/* Incremental fonts don't necessarily have valid charsets. */
|
||||||
/* They use the character code, not the glyph index, in this case. */
|
/* They use the character code, not the glyph index, in this case. */
|
||||||
if ( decoder->builder.face->root.internal->incremental_interface )
|
if ( decoder->builder.face->internal->incremental_interface )
|
||||||
gid = code;
|
gid = code;
|
||||||
else
|
else
|
||||||
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
||||||
|
@ -647,10 +680,10 @@
|
||||||
return FT_THROW( Invalid_Glyph_Format );
|
return FT_THROW( Invalid_Glyph_Format );
|
||||||
}
|
}
|
||||||
|
|
||||||
error = cff_get_glyph_data( decoder->builder.face,
|
error = decoder->get_glyph_callback( (TT_Face)decoder->builder.face,
|
||||||
(CF2_UInt)gid,
|
(CF2_UInt)gid,
|
||||||
&charstring,
|
&charstring,
|
||||||
&len );
|
&len );
|
||||||
/* TODO: for now, just pass the FreeType error through */
|
/* TODO: for now, just pass the FreeType error through */
|
||||||
if ( error )
|
if ( error )
|
||||||
return error;
|
return error;
|
||||||
|
@ -667,21 +700,90 @@
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_freeSeacComponent( CFF_Decoder* decoder,
|
cf2_freeSeacComponent( PS_Decoder* decoder,
|
||||||
CF2_Buffer buf )
|
CF2_Buffer buf )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder );
|
FT_ASSERT( decoder );
|
||||||
|
FT_ASSERT( !decoder->builder.is_t1 );
|
||||||
|
|
||||||
cff_free_glyph_data( decoder->builder.face,
|
decoder->free_glyph_callback( (TT_Face)decoder->builder.face,
|
||||||
(FT_Byte**)&buf->start,
|
(FT_Byte**)&buf->start,
|
||||||
(FT_ULong)( buf->end - buf->start ) );
|
(FT_ULong)( buf->end - buf->start ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
cf2_getT1SeacComponent( PS_Decoder* decoder,
|
||||||
|
FT_UInt glyph_index,
|
||||||
|
CF2_Buffer buf )
|
||||||
|
{
|
||||||
|
FT_Data glyph_data;
|
||||||
|
FT_Error error = FT_Err_Ok;
|
||||||
|
T1_Face face = (T1_Face)decoder->builder.face;
|
||||||
|
T1_Font type1 = &face->type1;
|
||||||
|
|
||||||
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
|
FT_Incremental_InterfaceRec *inc =
|
||||||
|
face->root.internal->incremental_interface;
|
||||||
|
/* For incremental fonts get the character data using the */
|
||||||
|
/* callback function. */
|
||||||
|
if ( inc )
|
||||||
|
error = inc->funcs->get_glyph_data( inc->object,
|
||||||
|
glyph_index, &glyph_data );
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
/* For ordinary fonts get the character data stored in the face record. */
|
||||||
|
{
|
||||||
|
glyph_data.pointer = type1->charstrings[glyph_index];
|
||||||
|
glyph_data.length = (FT_Int)type1->charstrings_len[glyph_index];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !error )
|
||||||
|
{
|
||||||
|
FT_Byte* charstring_base = (FT_Byte*)glyph_data.pointer;
|
||||||
|
FT_ULong charstring_len = (FT_ULong)glyph_data.length;
|
||||||
|
|
||||||
|
|
||||||
|
FT_ASSERT( charstring_base + charstring_len >= charstring_base );
|
||||||
|
|
||||||
|
FT_ZERO( buf );
|
||||||
|
buf->start =
|
||||||
|
buf->ptr = charstring_base;
|
||||||
|
buf->end = charstring_base + charstring_len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
cf2_freeT1SeacComponent( PS_Decoder* decoder,
|
||||||
|
CF2_Buffer buf )
|
||||||
|
{
|
||||||
|
T1_Face face;
|
||||||
|
FT_Data data;
|
||||||
|
|
||||||
|
|
||||||
|
FT_ASSERT( decoder );
|
||||||
|
|
||||||
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
|
face = (T1_Face)decoder->builder.face;
|
||||||
|
|
||||||
|
data.pointer = buf->start;
|
||||||
|
data.length = (FT_Int)( buf->end - buf->start );
|
||||||
|
|
||||||
|
if ( face->root.internal->incremental_interface )
|
||||||
|
face->root.internal->incremental_interface->funcs->free_glyph_data(
|
||||||
|
face->root.internal->incremental_interface->object,
|
||||||
|
&data );
|
||||||
|
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( CF2_Int )
|
FT_LOCAL_DEF( CF2_Int )
|
||||||
cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
|
cf2_initLocalRegionBuffer( PS_Decoder* decoder,
|
||||||
CF2_Int subrNum,
|
CF2_Int subrNum,
|
||||||
CF2_Buffer buf )
|
CF2_Buffer buf )
|
||||||
{
|
{
|
||||||
CF2_UInt idx;
|
CF2_UInt idx;
|
||||||
|
|
||||||
|
@ -691,21 +793,47 @@
|
||||||
FT_ZERO( buf );
|
FT_ZERO( buf );
|
||||||
|
|
||||||
idx = (CF2_UInt)( subrNum + decoder->locals_bias );
|
idx = (CF2_UInt)( subrNum + decoder->locals_bias );
|
||||||
if ( idx >= decoder->num_locals )
|
if ( idx < 0 || idx >= decoder->num_locals )
|
||||||
return TRUE; /* error */
|
return TRUE; /* error */
|
||||||
|
|
||||||
FT_ASSERT( decoder->locals );
|
FT_ASSERT( decoder->locals );
|
||||||
|
|
||||||
buf->start =
|
buf->start = decoder->locals[idx];
|
||||||
buf->ptr = decoder->locals[idx];
|
|
||||||
buf->end = decoder->locals[idx + 1];
|
if ( decoder->builder.is_t1 )
|
||||||
|
{
|
||||||
|
/* 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. */
|
||||||
|
if ( decoder->locals_len )
|
||||||
|
buf->end = buf->start + decoder->locals_len[idx];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* We are using subroutines from a CID font. We must adjust */
|
||||||
|
/* for the seed bytes. */
|
||||||
|
buf->start += ( decoder->lenIV >= 0 ? decoder->lenIV : 0 );
|
||||||
|
buf->end = decoder->locals[idx + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !buf->start )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "cf2_initLocalRegionBuffer (Type 1 mode):"
|
||||||
|
" invoking empty subrs\n" ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf->end = decoder->locals[idx + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
buf->ptr = buf->start;
|
||||||
|
|
||||||
return FALSE; /* success */
|
return FALSE; /* success */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( CF2_Fixed )
|
FT_LOCAL_DEF( CF2_Fixed )
|
||||||
cf2_getDefaultWidthX( CFF_Decoder* decoder )
|
cf2_getDefaultWidthX( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -715,7 +843,7 @@
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( CF2_Fixed )
|
FT_LOCAL_DEF( CF2_Fixed )
|
||||||
cf2_getNominalWidthX( CFF_Decoder* decoder )
|
cf2_getNominalWidthX( PS_Decoder* decoder )
|
||||||
{
|
{
|
||||||
FT_ASSERT( decoder && decoder->current_subfont );
|
FT_ASSERT( decoder && decoder->current_subfont );
|
||||||
|
|
||||||
|
@ -727,7 +855,7 @@
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_outline_reset( CF2_Outline outline )
|
cf2_outline_reset( CF2_Outline outline )
|
||||||
{
|
{
|
||||||
CFF_Decoder* decoder = outline->decoder;
|
PS_Decoder* decoder = outline->decoder;
|
||||||
|
|
||||||
|
|
||||||
FT_ASSERT( decoder );
|
FT_ASSERT( decoder );
|
||||||
|
@ -741,12 +869,12 @@
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
cf2_outline_close( CF2_Outline outline )
|
cf2_outline_close( CF2_Outline outline )
|
||||||
{
|
{
|
||||||
CFF_Decoder* decoder = outline->decoder;
|
PS_Decoder* decoder = outline->decoder;
|
||||||
|
|
||||||
|
|
||||||
FT_ASSERT( decoder );
|
FT_ASSERT( decoder );
|
||||||
|
|
||||||
cff_builder_close_contour( &decoder->builder );
|
ps_builder_close_contour( &decoder->builder );
|
||||||
|
|
||||||
FT_GlyphLoader_Add( decoder->builder.loader );
|
FT_GlyphLoader_Add( decoder->builder.loader );
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2ft.h */
|
/* psft.h */
|
||||||
/* */
|
/* */
|
||||||
/* FreeType Glue Component to Adobe's Interpreter (specification). */
|
/* FreeType Glue Component to Adobe's Interpreter (specification). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
#define CF2FT_H_
|
#define CF2FT_H_
|
||||||
|
|
||||||
|
|
||||||
#include "cf2types.h"
|
#include "pstypes.h"
|
||||||
|
|
||||||
|
|
||||||
/* TODO: disable asserts for now */
|
/* TODO: disable asserts for now */
|
||||||
|
@ -49,88 +49,96 @@
|
||||||
|
|
||||||
#include FT_SYSTEM_H
|
#include FT_SYSTEM_H
|
||||||
|
|
||||||
#include "cf2glue.h"
|
#include "psglue.h"
|
||||||
#include "cffgload.h" /* for CFF_Decoder */
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for PS_Decoder */
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cf2_decoder_parse_charstrings( CFF_Decoder* decoder,
|
cf2_decoder_parse_charstrings( PS_Decoder* decoder,
|
||||||
FT_Byte* charstring_base,
|
FT_Byte* charstring_base,
|
||||||
FT_ULong charstring_len );
|
FT_ULong charstring_len );
|
||||||
|
|
||||||
FT_LOCAL( CFF_SubFont )
|
FT_LOCAL( CFF_SubFont )
|
||||||
cf2_getSubfont( CFF_Decoder* decoder );
|
cf2_getSubfont( PS_Decoder* decoder );
|
||||||
|
|
||||||
FT_LOCAL( CFF_VStore )
|
FT_LOCAL( CFF_VStore )
|
||||||
cf2_getVStore( CFF_Decoder* decoder );
|
cf2_getVStore( PS_Decoder* decoder );
|
||||||
|
|
||||||
FT_LOCAL( FT_UInt )
|
FT_LOCAL( FT_UInt )
|
||||||
cf2_getMaxstack( CFF_Decoder* decoder );
|
cf2_getMaxstack( PS_Decoder* decoder );
|
||||||
|
|
||||||
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cf2_getNormalizedVector( CFF_Decoder* decoder,
|
cf2_getNormalizedVector( PS_Decoder* decoder,
|
||||||
CF2_UInt *len,
|
CF2_UInt *len,
|
||||||
FT_Fixed* *vec );
|
FT_Fixed* *vec );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FT_LOCAL( CF2_Fixed )
|
FT_LOCAL( CF2_Fixed )
|
||||||
cf2_getPpemY( CFF_Decoder* decoder );
|
cf2_getPpemY( PS_Decoder* decoder );
|
||||||
FT_LOCAL( CF2_Fixed )
|
FT_LOCAL( CF2_Fixed )
|
||||||
cf2_getStdVW( CFF_Decoder* decoder );
|
cf2_getStdVW( PS_Decoder* decoder );
|
||||||
FT_LOCAL( CF2_Fixed )
|
FT_LOCAL( CF2_Fixed )
|
||||||
cf2_getStdHW( CFF_Decoder* decoder );
|
cf2_getStdHW( PS_Decoder* decoder );
|
||||||
|
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
cf2_getBlueMetrics( CFF_Decoder* decoder,
|
cf2_getBlueMetrics( PS_Decoder* decoder,
|
||||||
CF2_Fixed* blueScale,
|
CF2_Fixed* blueScale,
|
||||||
CF2_Fixed* blueShift,
|
CF2_Fixed* blueShift,
|
||||||
CF2_Fixed* blueFuzz );
|
CF2_Fixed* blueFuzz );
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
cf2_getBlueValues( CFF_Decoder* decoder,
|
cf2_getBlueValues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data );
|
FT_Pos* *data );
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
cf2_getOtherBlues( CFF_Decoder* decoder,
|
cf2_getOtherBlues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data );
|
FT_Pos* *data );
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
cf2_getFamilyBlues( CFF_Decoder* decoder,
|
cf2_getFamilyBlues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data );
|
FT_Pos* *data );
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
cf2_getFamilyOtherBlues( CFF_Decoder* decoder,
|
cf2_getFamilyOtherBlues( PS_Decoder* decoder,
|
||||||
size_t* count,
|
size_t* count,
|
||||||
FT_Pos* *data );
|
FT_Pos* *data );
|
||||||
|
|
||||||
FT_LOCAL( CF2_Int )
|
FT_LOCAL( CF2_Int )
|
||||||
cf2_getLanguageGroup( CFF_Decoder* decoder );
|
cf2_getLanguageGroup( PS_Decoder* decoder );
|
||||||
|
|
||||||
FT_LOCAL( CF2_Int )
|
FT_LOCAL( CF2_Int )
|
||||||
cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
|
cf2_initGlobalRegionBuffer( PS_Decoder* decoder,
|
||||||
CF2_Int subrNum,
|
CF2_Int subrNum,
|
||||||
CF2_Buffer buf );
|
CF2_Buffer buf );
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cf2_getSeacComponent( CFF_Decoder* decoder,
|
cf2_getSeacComponent( PS_Decoder* decoder,
|
||||||
CF2_Int code,
|
CF2_Int code,
|
||||||
CF2_Buffer buf );
|
CF2_Buffer buf );
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
cf2_freeSeacComponent( CFF_Decoder* decoder,
|
cf2_freeSeacComponent( PS_Decoder* decoder,
|
||||||
CF2_Buffer buf );
|
CF2_Buffer buf );
|
||||||
FT_LOCAL( CF2_Int )
|
FT_LOCAL( CF2_Int )
|
||||||
cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
|
cf2_initLocalRegionBuffer( PS_Decoder* decoder,
|
||||||
CF2_Int subrNum,
|
CF2_Int subrNum,
|
||||||
CF2_Buffer buf );
|
CF2_Buffer buf );
|
||||||
|
|
||||||
FT_LOCAL( CF2_Fixed )
|
FT_LOCAL( CF2_Fixed )
|
||||||
cf2_getDefaultWidthX( CFF_Decoder* decoder );
|
cf2_getDefaultWidthX( PS_Decoder* decoder );
|
||||||
FT_LOCAL( CF2_Fixed )
|
FT_LOCAL( CF2_Fixed )
|
||||||
cf2_getNominalWidthX( CFF_Decoder* decoder );
|
cf2_getNominalWidthX( PS_Decoder* decoder );
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
cf2_getT1SeacComponent( PS_Decoder* decoder,
|
||||||
|
FT_UInt glyph_index,
|
||||||
|
CF2_Buffer buf );
|
||||||
|
FT_LOCAL( void )
|
||||||
|
cf2_freeT1SeacComponent( PS_Decoder* decoder,
|
||||||
|
CF2_Buffer buf );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FreeType client outline
|
* FreeType client outline
|
||||||
*
|
*
|
||||||
|
@ -139,7 +147,7 @@ FT_BEGIN_HEADER
|
||||||
typedef struct CF2_OutlineRec_
|
typedef struct CF2_OutlineRec_
|
||||||
{
|
{
|
||||||
CF2_OutlineCallbacksRec root; /* base class must be first */
|
CF2_OutlineCallbacksRec root; /* base class must be first */
|
||||||
CFF_Decoder* decoder;
|
PS_Decoder* decoder;
|
||||||
|
|
||||||
} CF2_OutlineRec, *CF2_Outline;
|
} CF2_OutlineRec, *CF2_Outline;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2glue.h */
|
/* psglue.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for shared stuff (specification only). */
|
/* Adobe's code for shared stuff (specification only). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -41,10 +41,10 @@
|
||||||
|
|
||||||
|
|
||||||
/* common includes for other modules */
|
/* common includes for other modules */
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
#include "cf2fixed.h"
|
#include "psfixed.h"
|
||||||
#include "cf2arrst.h"
|
#include "psarrst.h"
|
||||||
#include "cf2read.h"
|
#include "psread.h"
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2hints.c */
|
/* pshints.c */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for handling CFF hints (body). */
|
/* Adobe's code for handling CFF hints (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -36,13 +36,13 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
|
|
||||||
#include "cf2glue.h"
|
#include "psglue.h"
|
||||||
#include "cf2font.h"
|
#include "psfont.h"
|
||||||
#include "cf2hints.h"
|
#include "pshints.h"
|
||||||
#include "cf2intrp.h"
|
#include "psintrp.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -299,6 +299,31 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
cf2_hintmap_dump( CF2_HintMap hintmap )
|
||||||
|
{
|
||||||
|
CF2_UInt i;
|
||||||
|
|
||||||
|
|
||||||
|
FT_TRACE6(( " index csCoord dsCoord scale flags\n" ));
|
||||||
|
|
||||||
|
for ( i = 0; i < hintmap->count; i++ )
|
||||||
|
{
|
||||||
|
CF2_Hint hint = &hintmap->edge[i];
|
||||||
|
|
||||||
|
FT_TRACE6(( " %3d %7.2f %7.2f %5d %s%s%s%s\n",
|
||||||
|
hint->index,
|
||||||
|
hint->csCoord / 65536.0,
|
||||||
|
hint->dsCoord / (hint->scale * 1.0),
|
||||||
|
hint->scale,
|
||||||
|
( cf2_hint_isPair( hint ) ? "p" : "g" ),
|
||||||
|
( cf2_hint_isTop( hint ) ? "t" : "b" ),
|
||||||
|
( cf2_hint_isLocked( hint ) ? "L" : ""),
|
||||||
|
( cf2_hint_isSynthetic( hint ) ? "S" : "" ) ));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* transform character space coordinate to device space using hint map */
|
/* transform character space coordinate to device space using hint map */
|
||||||
static CF2_Fixed
|
static CF2_Fixed
|
||||||
cf2_hintmap_map( CF2_HintMap hintmap,
|
cf2_hintmap_map( CF2_HintMap hintmap,
|
||||||
|
@ -612,6 +637,14 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_TRACE7(( " Got hint at %.2f (%.2f)\n",
|
||||||
|
firstHintEdge->csCoord / 65536.0,
|
||||||
|
firstHintEdge->dsCoord / 65536.0 ));
|
||||||
|
if ( isPair )
|
||||||
|
FT_TRACE7(( " Got hint at %.2f (%.2f)\n",
|
||||||
|
secondHintEdge->csCoord / 65536.0,
|
||||||
|
secondHintEdge->dsCoord / 65536.0 ));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Discard any hints that overlap in character space. Most often, this
|
* Discard any hints that overlap in character space. Most often, this
|
||||||
* is while building the initial map, where captured hints from all
|
* is while building the initial map, where captured hints from all
|
||||||
|
@ -730,12 +763,19 @@
|
||||||
/* insert first edge */
|
/* insert first edge */
|
||||||
hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */
|
hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */
|
||||||
hintmap->count += 1;
|
hintmap->count += 1;
|
||||||
|
FT_TRACE7(( " Inserting hint %.2f (%.2f)\n",
|
||||||
|
firstHintEdge->csCoord / 65536.0,
|
||||||
|
firstHintEdge->dsCoord / 65536.0 ));
|
||||||
|
|
||||||
if ( isPair )
|
if ( isPair )
|
||||||
{
|
{
|
||||||
/* insert second edge */
|
/* insert second edge */
|
||||||
hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */
|
hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */
|
||||||
hintmap->count += 1;
|
hintmap->count += 1;
|
||||||
|
FT_TRACE7(( " Inserting hint %.2f (%.2f)\n",
|
||||||
|
secondHintEdge->csCoord / 65536.0,
|
||||||
|
secondHintEdge->dsCoord / 65536.0 ));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -970,6 +1010,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FT_TRACE6(( initialMap ? "flags: [p]air [g]host [t]op "
|
||||||
|
"[b]ottom [L]ocked [S]ynthetic\n"
|
||||||
|
"Initial hintmap\n"
|
||||||
|
: "Hints:\n" ));
|
||||||
|
cf2_hintmap_dump( hintmap );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: The following line is a convenient place to break when
|
* Note: The following line is a convenient place to break when
|
||||||
* debugging hinting. Examine `hintmap->edge' for the list of
|
* debugging hinting. Examine `hintmap->edge' for the list of
|
||||||
|
@ -982,6 +1028,9 @@
|
||||||
/* adjust positions of hint edges that are not locked to blue zones */
|
/* adjust positions of hint edges that are not locked to blue zones */
|
||||||
cf2_hintmap_adjustHints( hintmap );
|
cf2_hintmap_adjustHints( hintmap );
|
||||||
|
|
||||||
|
FT_TRACE6(( "(adjusted)\n" ));
|
||||||
|
cf2_hintmap_dump( hintmap );
|
||||||
|
|
||||||
/* save the position of all hints that were used in this hint map; */
|
/* save the position of all hints that were used in this hint map; */
|
||||||
/* if we use them again, we'll locate them in the same position */
|
/* if we use them again, we'll locate them in the same position */
|
||||||
if ( !initialMap )
|
if ( !initialMap )
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2hints.h */
|
/* pshints.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for handling CFF hints (body). */
|
/* Adobe's code for handling CFF hints (body). */
|
||||||
/* */
|
/* */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2font.h */
|
/* psintrp.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's CFF Interpreter (specification). */
|
/* Adobe's CFF Interpreter (specification). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -40,8 +40,8 @@
|
||||||
#define CF2INTRP_H_
|
#define CF2INTRP_H_
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include "cf2hints.h"
|
#include "pshints.h"
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
|
@ -20,6 +20,8 @@
|
||||||
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_CALC_H
|
#include FT_INTERNAL_CALC_H
|
||||||
|
#include FT_CFF_DRIVER_H
|
||||||
|
#include FT_TYPE1_DRIVER_H
|
||||||
|
|
||||||
#include "psobjs.h"
|
#include "psobjs.h"
|
||||||
#include "psconv.h"
|
#include "psconv.h"
|
||||||
|
@ -1758,6 +1760,565 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** CFF BUILDER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Function> */
|
||||||
|
/* cff_builder_init */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* Initializes a given glyph builder. */
|
||||||
|
/* */
|
||||||
|
/* <InOut> */
|
||||||
|
/* builder :: A pointer to the glyph builder to initialize. */
|
||||||
|
/* */
|
||||||
|
/* <Input> */
|
||||||
|
/* face :: The current face object. */
|
||||||
|
/* */
|
||||||
|
/* size :: The current size object. */
|
||||||
|
/* */
|
||||||
|
/* glyph :: The current glyph object. */
|
||||||
|
/* */
|
||||||
|
/* hinting :: Whether hinting is active. */
|
||||||
|
/* */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
cff_builder_init( CFF_Builder* builder,
|
||||||
|
TT_Face face,
|
||||||
|
CFF_Size size,
|
||||||
|
CFF_GlyphSlot glyph,
|
||||||
|
FT_Bool hinting )
|
||||||
|
{
|
||||||
|
builder->path_begun = 0;
|
||||||
|
builder->load_points = 1;
|
||||||
|
|
||||||
|
builder->face = face;
|
||||||
|
builder->glyph = glyph;
|
||||||
|
builder->memory = face->root.memory;
|
||||||
|
|
||||||
|
if ( glyph )
|
||||||
|
{
|
||||||
|
FT_GlyphLoader loader = glyph->root.internal->loader;
|
||||||
|
|
||||||
|
|
||||||
|
builder->loader = loader;
|
||||||
|
builder->base = &loader->base.outline;
|
||||||
|
builder->current = &loader->current.outline;
|
||||||
|
FT_GlyphLoader_Rewind( loader );
|
||||||
|
|
||||||
|
builder->hints_globals = NULL;
|
||||||
|
builder->hints_funcs = NULL;
|
||||||
|
|
||||||
|
if ( hinting && size )
|
||||||
|
{
|
||||||
|
FT_Size ftsize = FT_SIZE( size );
|
||||||
|
CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data;
|
||||||
|
|
||||||
|
if ( internal )
|
||||||
|
{
|
||||||
|
builder->hints_globals = (void *)internal->topfont;
|
||||||
|
builder->hints_funcs = glyph->root.internal->glyph_hints;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
builder->pos_x = 0;
|
||||||
|
builder->pos_y = 0;
|
||||||
|
|
||||||
|
builder->left_bearing.x = 0;
|
||||||
|
builder->left_bearing.y = 0;
|
||||||
|
builder->advance.x = 0;
|
||||||
|
builder->advance.y = 0;
|
||||||
|
|
||||||
|
builder->funcs = cff_builder_funcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Function> */
|
||||||
|
/* cff_builder_done */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* Finalizes a given glyph builder. Its contents can still be used */
|
||||||
|
/* after the call, but the function saves important information */
|
||||||
|
/* within the corresponding glyph slot. */
|
||||||
|
/* */
|
||||||
|
/* <Input> */
|
||||||
|
/* builder :: A pointer to the glyph builder to finalize. */
|
||||||
|
/* */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
cff_builder_done( CFF_Builder* builder )
|
||||||
|
{
|
||||||
|
CFF_GlyphSlot glyph = builder->glyph;
|
||||||
|
|
||||||
|
|
||||||
|
if ( glyph )
|
||||||
|
glyph->root.outline = *builder->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* check that there is enough space for `count' more points */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
cff_check_points( CFF_Builder* builder,
|
||||||
|
FT_Int count )
|
||||||
|
{
|
||||||
|
return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* add a new point, do not check space */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
cff_builder_add_point( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y,
|
||||||
|
FT_Byte flag )
|
||||||
|
{
|
||||||
|
FT_Outline* outline = builder->current;
|
||||||
|
|
||||||
|
|
||||||
|
if ( builder->load_points )
|
||||||
|
{
|
||||||
|
FT_Vector* point = outline->points + outline->n_points;
|
||||||
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
|
||||||
|
|
||||||
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||||
|
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
|
||||||
|
|
||||||
|
|
||||||
|
if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
|
||||||
|
{
|
||||||
|
point->x = x >> 16;
|
||||||
|
point->y = y >> 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
/* cf2_decoder_parse_charstrings uses 16.16 coordinates */
|
||||||
|
point->x = x >> 10;
|
||||||
|
point->y = y >> 10;
|
||||||
|
}
|
||||||
|
*control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
|
||||||
|
}
|
||||||
|
|
||||||
|
outline->n_points++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* check space for a new on-curve point, then add it */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
cff_builder_add_point1( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y )
|
||||||
|
{
|
||||||
|
FT_Error error;
|
||||||
|
|
||||||
|
|
||||||
|
error = cff_check_points( builder, 1 );
|
||||||
|
if ( !error )
|
||||||
|
cff_builder_add_point( builder, x, y, 1 );
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* check space for a new contour, then add it */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
cff_builder_add_contour( CFF_Builder* builder )
|
||||||
|
{
|
||||||
|
FT_Outline* outline = builder->current;
|
||||||
|
FT_Error error;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !builder->load_points )
|
||||||
|
{
|
||||||
|
outline->n_contours++;
|
||||||
|
return FT_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
|
||||||
|
if ( !error )
|
||||||
|
{
|
||||||
|
if ( outline->n_contours > 0 )
|
||||||
|
outline->contours[outline->n_contours - 1] =
|
||||||
|
(short)( outline->n_points - 1 );
|
||||||
|
|
||||||
|
outline->n_contours++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* if a path was begun, add its first on-curve point */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
cff_builder_start_point( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y )
|
||||||
|
{
|
||||||
|
FT_Error error = FT_Err_Ok;
|
||||||
|
|
||||||
|
|
||||||
|
/* test whether we are building a new contour */
|
||||||
|
if ( !builder->path_begun )
|
||||||
|
{
|
||||||
|
builder->path_begun = 1;
|
||||||
|
error = cff_builder_add_contour( builder );
|
||||||
|
if ( !error )
|
||||||
|
error = cff_builder_add_point1( builder, x, y );
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* close the current contour */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
cff_builder_close_contour( CFF_Builder* builder )
|
||||||
|
{
|
||||||
|
FT_Outline* outline = builder->current;
|
||||||
|
FT_Int first;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !outline )
|
||||||
|
return;
|
||||||
|
|
||||||
|
first = outline->n_contours <= 1
|
||||||
|
? 0 : outline->contours[outline->n_contours - 2] + 1;
|
||||||
|
|
||||||
|
/* We must not include the last point in the path if it */
|
||||||
|
/* is located on the first point. */
|
||||||
|
if ( outline->n_points > 1 )
|
||||||
|
{
|
||||||
|
FT_Vector* p1 = outline->points + first;
|
||||||
|
FT_Vector* p2 = outline->points + outline->n_points - 1;
|
||||||
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
|
||||||
|
|
||||||
|
|
||||||
|
/* `delete' last point only if it coincides with the first */
|
||||||
|
/* point and if it is not a control point (which can happen). */
|
||||||
|
if ( p1->x == p2->x && p1->y == p2->y )
|
||||||
|
if ( *control == FT_CURVE_TAG_ON )
|
||||||
|
outline->n_points--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( outline->n_contours > 0 )
|
||||||
|
{
|
||||||
|
/* Don't add contours only consisting of one point, i.e., */
|
||||||
|
/* check whether begin point and last point are the same. */
|
||||||
|
if ( first == outline->n_points - 1 )
|
||||||
|
{
|
||||||
|
outline->n_contours--;
|
||||||
|
outline->n_points--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outline->contours[outline->n_contours - 1] =
|
||||||
|
(short)( outline->n_points - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** PS BUILDER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Function> */
|
||||||
|
/* ps_builder_init */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* Initializes a given glyph builder. */
|
||||||
|
/* */
|
||||||
|
/* <InOut> */
|
||||||
|
/* builder :: A pointer to the glyph builder to initialize. */
|
||||||
|
/* */
|
||||||
|
/* <Input> */
|
||||||
|
/* face :: The current face object. */
|
||||||
|
/* */
|
||||||
|
/* size :: The current size object. */
|
||||||
|
/* */
|
||||||
|
/* glyph :: The current glyph object. */
|
||||||
|
/* */
|
||||||
|
/* hinting :: Whether hinting should be applied. */
|
||||||
|
/* */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
ps_builder_init( PS_Builder* ps_builder,
|
||||||
|
void* builder,
|
||||||
|
FT_Bool is_t1 )
|
||||||
|
{
|
||||||
|
FT_ZERO( ps_builder );
|
||||||
|
|
||||||
|
if ( is_t1 )
|
||||||
|
{
|
||||||
|
T1_Builder t1builder = (T1_Builder)builder;
|
||||||
|
|
||||||
|
ps_builder->memory = t1builder->memory;
|
||||||
|
ps_builder->face = (FT_Face)t1builder->face;
|
||||||
|
ps_builder->glyph = (CFF_GlyphSlot)t1builder->glyph;
|
||||||
|
ps_builder->loader = t1builder->loader;
|
||||||
|
ps_builder->base = t1builder->base;
|
||||||
|
ps_builder->current = t1builder->current;
|
||||||
|
|
||||||
|
ps_builder->pos_x = &t1builder->pos_x;
|
||||||
|
ps_builder->pos_y = &t1builder->pos_y;
|
||||||
|
|
||||||
|
ps_builder->left_bearing = &t1builder->left_bearing;
|
||||||
|
ps_builder->advance = &t1builder->advance;
|
||||||
|
|
||||||
|
ps_builder->bbox = &t1builder->bbox;
|
||||||
|
ps_builder->path_begun = 0;
|
||||||
|
ps_builder->load_points = t1builder->load_points;
|
||||||
|
ps_builder->no_recurse = t1builder->no_recurse;
|
||||||
|
|
||||||
|
ps_builder->metrics_only = t1builder->metrics_only;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CFF_Builder* cffbuilder = (CFF_Builder*)builder;
|
||||||
|
|
||||||
|
ps_builder->memory = cffbuilder->memory;
|
||||||
|
ps_builder->face = (FT_Face)cffbuilder->face;
|
||||||
|
ps_builder->glyph = cffbuilder->glyph;
|
||||||
|
ps_builder->loader = cffbuilder->loader;
|
||||||
|
ps_builder->base = cffbuilder->base;
|
||||||
|
ps_builder->current = cffbuilder->current;
|
||||||
|
|
||||||
|
ps_builder->pos_x = &cffbuilder->pos_x;
|
||||||
|
ps_builder->pos_y = &cffbuilder->pos_y;
|
||||||
|
|
||||||
|
ps_builder->left_bearing = &cffbuilder->left_bearing;
|
||||||
|
ps_builder->advance = &cffbuilder->advance;
|
||||||
|
|
||||||
|
ps_builder->bbox = &cffbuilder->bbox;
|
||||||
|
ps_builder->path_begun = cffbuilder->path_begun;
|
||||||
|
ps_builder->load_points = cffbuilder->load_points;
|
||||||
|
ps_builder->no_recurse = cffbuilder->no_recurse;
|
||||||
|
|
||||||
|
ps_builder->metrics_only = cffbuilder->metrics_only;
|
||||||
|
}
|
||||||
|
|
||||||
|
ps_builder->is_t1 = is_t1;
|
||||||
|
ps_builder->funcs = ps_builder_funcs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Function> */
|
||||||
|
/* ps_builder_done */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* Finalizes a given glyph builder. Its contents can still be used */
|
||||||
|
/* after the call, but the function saves important information */
|
||||||
|
/* within the corresponding glyph slot. */
|
||||||
|
/* */
|
||||||
|
/* <Input> */
|
||||||
|
/* builder :: A pointer to the glyph builder to finalize. */
|
||||||
|
/* */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
ps_builder_done( PS_Builder* builder )
|
||||||
|
{
|
||||||
|
CFF_GlyphSlot glyph = builder->glyph;
|
||||||
|
|
||||||
|
|
||||||
|
if ( glyph )
|
||||||
|
glyph->root.outline = *builder->base;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* check that there is enough space for `count' more points */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
ps_builder_check_points( PS_Builder* builder,
|
||||||
|
FT_Int count )
|
||||||
|
{
|
||||||
|
return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* add a new point, do not check space */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
ps_builder_add_point( PS_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y,
|
||||||
|
FT_Byte flag )
|
||||||
|
{
|
||||||
|
FT_Outline* outline = builder->current;
|
||||||
|
|
||||||
|
|
||||||
|
if ( builder->load_points )
|
||||||
|
{
|
||||||
|
FT_Vector* point = outline->points + outline->n_points;
|
||||||
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
|
||||||
|
|
||||||
|
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
|
||||||
|
|
||||||
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
||||||
|
if ( !builder->is_t1 &&
|
||||||
|
driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
|
||||||
|
{
|
||||||
|
point->x = x >> 16;
|
||||||
|
point->y = y >> 16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if ( builder->is_t1 &&
|
||||||
|
driver->hinting_engine == FT_T1_HINTING_FREETYPE )
|
||||||
|
{
|
||||||
|
point->x = FIXED_TO_INT( x );
|
||||||
|
point->y = FIXED_TO_INT( y );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* cf2_decoder_parse_charstrings uses 16.16 coordinates */
|
||||||
|
point->x = x >> 10;
|
||||||
|
point->y = y >> 10;
|
||||||
|
}
|
||||||
|
*control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
|
||||||
|
}
|
||||||
|
outline->n_points++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* check space for a new on-curve point, then add it */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
ps_builder_add_point1( PS_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y )
|
||||||
|
{
|
||||||
|
FT_Error error;
|
||||||
|
|
||||||
|
|
||||||
|
error = ps_builder_check_points( builder, 1 );
|
||||||
|
if ( !error )
|
||||||
|
ps_builder_add_point( builder, x, y, 1 );
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* check space for a new contour, then add it */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
ps_builder_add_contour( PS_Builder* builder )
|
||||||
|
{
|
||||||
|
FT_Outline* outline = builder->current;
|
||||||
|
FT_Error error;
|
||||||
|
|
||||||
|
|
||||||
|
/* this might happen in invalid fonts */
|
||||||
|
if ( !outline )
|
||||||
|
{
|
||||||
|
FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" ));
|
||||||
|
return FT_THROW( Invalid_File_Format );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !builder->load_points )
|
||||||
|
{
|
||||||
|
outline->n_contours++;
|
||||||
|
return FT_Err_Ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
|
||||||
|
if ( !error )
|
||||||
|
{
|
||||||
|
if ( outline->n_contours > 0 )
|
||||||
|
outline->contours[outline->n_contours - 1] =
|
||||||
|
(short)( outline->n_points - 1 );
|
||||||
|
|
||||||
|
outline->n_contours++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* if a path was begun, add its first on-curve point */
|
||||||
|
FT_LOCAL_DEF( FT_Error )
|
||||||
|
ps_builder_start_point( PS_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y )
|
||||||
|
{
|
||||||
|
FT_Error error = FT_Err_Ok;
|
||||||
|
|
||||||
|
|
||||||
|
/* test whether we are building a new contour */
|
||||||
|
if ( !builder->path_begun )
|
||||||
|
{
|
||||||
|
builder->path_begun = 1;
|
||||||
|
error = ps_builder_add_contour( builder );
|
||||||
|
if ( !error )
|
||||||
|
error = ps_builder_add_point1( builder, x, y );
|
||||||
|
}
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* close the current contour */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
ps_builder_close_contour( PS_Builder* builder )
|
||||||
|
{
|
||||||
|
FT_Outline* outline = builder->current;
|
||||||
|
FT_Int first;
|
||||||
|
|
||||||
|
|
||||||
|
if ( !outline )
|
||||||
|
return;
|
||||||
|
|
||||||
|
first = outline->n_contours <= 1
|
||||||
|
? 0 : outline->contours[outline->n_contours - 2] + 1;
|
||||||
|
|
||||||
|
/* in malformed fonts it can happen that a contour was started */
|
||||||
|
/* but no points were added */
|
||||||
|
if ( outline->n_contours && first == outline->n_points )
|
||||||
|
{
|
||||||
|
outline->n_contours--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We must not include the last point in the path if it */
|
||||||
|
/* is located on the first point. */
|
||||||
|
if ( outline->n_points > 1 )
|
||||||
|
{
|
||||||
|
FT_Vector* p1 = outline->points + first;
|
||||||
|
FT_Vector* p2 = outline->points + outline->n_points - 1;
|
||||||
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
|
||||||
|
|
||||||
|
|
||||||
|
/* `delete' last point only if it coincides with the first */
|
||||||
|
/* point and it is not a control point (which can happen). */
|
||||||
|
if ( p1->x == p2->x && p1->y == p2->y )
|
||||||
|
if ( *control == FT_CURVE_TAG_ON )
|
||||||
|
outline->n_points--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( outline->n_contours > 0 )
|
||||||
|
{
|
||||||
|
/* Don't add contours only consisting of one point, i.e., */
|
||||||
|
/* check whether the first and the last point is the same. */
|
||||||
|
if ( first == outline->n_points - 1 )
|
||||||
|
{
|
||||||
|
outline->n_contours--;
|
||||||
|
outline->n_points--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
outline->contours[outline->n_contours - 1] =
|
||||||
|
(short)( outline->n_points - 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -1766,6 +2327,172 @@
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Function> */
|
||||||
|
/* ps_decoder_init */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* Creates a wrapper decoder for use in the combined */
|
||||||
|
/* Type 1 / CFF interpreter. */
|
||||||
|
/* */
|
||||||
|
/* <InOut> */
|
||||||
|
/* ps_decoder :: A pointer to the decoder to initialize. */
|
||||||
|
/* */
|
||||||
|
/* <Input> */
|
||||||
|
/* decoder :: A pointer to the original decoder. */
|
||||||
|
/* */
|
||||||
|
/* is_t1 :: Flag indicating Type 1 or CFF */
|
||||||
|
/* */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
ps_decoder_init( PS_Decoder* ps_decoder,
|
||||||
|
void* decoder,
|
||||||
|
FT_Bool is_t1 )
|
||||||
|
{
|
||||||
|
FT_ZERO( ps_decoder );
|
||||||
|
|
||||||
|
if ( is_t1 )
|
||||||
|
{
|
||||||
|
T1_Decoder t1_decoder = (T1_Decoder)decoder;
|
||||||
|
|
||||||
|
ps_builder_init( &ps_decoder->builder,
|
||||||
|
&t1_decoder->builder,
|
||||||
|
is_t1 );
|
||||||
|
|
||||||
|
ps_decoder->cf2_instance = &t1_decoder->cf2_instance;
|
||||||
|
ps_decoder->psnames = t1_decoder->psnames;
|
||||||
|
|
||||||
|
ps_decoder->num_glyphs = t1_decoder->num_glyphs;
|
||||||
|
ps_decoder->glyph_names = t1_decoder->glyph_names;
|
||||||
|
ps_decoder->hint_mode = t1_decoder->hint_mode;
|
||||||
|
ps_decoder->blend = t1_decoder->blend;
|
||||||
|
|
||||||
|
ps_decoder->num_locals = t1_decoder->num_subrs;
|
||||||
|
ps_decoder->locals = t1_decoder->subrs;
|
||||||
|
ps_decoder->locals_len = t1_decoder->subrs_len;
|
||||||
|
ps_decoder->locals_hash = t1_decoder->subrs_hash;
|
||||||
|
|
||||||
|
ps_decoder->buildchar = t1_decoder->buildchar;
|
||||||
|
ps_decoder->len_buildchar = t1_decoder->len_buildchar;
|
||||||
|
|
||||||
|
ps_decoder->lenIV = t1_decoder->lenIV;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CFF_Decoder* cff_decoder = (CFF_Decoder*)decoder;
|
||||||
|
|
||||||
|
ps_builder_init( &ps_decoder->builder,
|
||||||
|
&cff_decoder->builder,
|
||||||
|
is_t1 );
|
||||||
|
|
||||||
|
ps_decoder->cff = cff_decoder->cff;
|
||||||
|
ps_decoder->cf2_instance = &cff_decoder->cff->cf2_instance;
|
||||||
|
ps_decoder->current_subfont = cff_decoder->current_subfont;
|
||||||
|
|
||||||
|
ps_decoder->num_globals = cff_decoder->num_globals;
|
||||||
|
ps_decoder->globals = cff_decoder->globals;
|
||||||
|
ps_decoder->globals_bias = cff_decoder->globals_bias;
|
||||||
|
ps_decoder->num_locals = cff_decoder->num_locals;
|
||||||
|
ps_decoder->locals = cff_decoder->locals;
|
||||||
|
ps_decoder->locals_bias = cff_decoder->locals_bias;
|
||||||
|
|
||||||
|
ps_decoder->glyph_width = cff_decoder->glyph_width;
|
||||||
|
ps_decoder->nominal_width = cff_decoder->nominal_width;
|
||||||
|
ps_decoder->width_only = cff_decoder->width_only;
|
||||||
|
|
||||||
|
ps_decoder->hint_mode = cff_decoder->hint_mode;
|
||||||
|
|
||||||
|
ps_decoder->get_glyph_callback = cff_decoder->get_glyph_callback;
|
||||||
|
ps_decoder->free_glyph_callback = cff_decoder->free_glyph_callback;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Synthesize a SubFont object for Type 1 fonts, for use in the */
|
||||||
|
/* new interpreter to access Private dict data */
|
||||||
|
FT_LOCAL_DEF( void )
|
||||||
|
t1_make_subfont( FT_Face face,
|
||||||
|
PS_Private priv,
|
||||||
|
CFF_SubFont subfont )
|
||||||
|
{
|
||||||
|
CFF_Private cpriv = &subfont->private_dict;
|
||||||
|
FT_UInt n, count;
|
||||||
|
|
||||||
|
FT_ZERO( subfont );
|
||||||
|
FT_ZERO( cpriv );
|
||||||
|
|
||||||
|
count = cpriv->num_blue_values = priv->num_blue_values;
|
||||||
|
for ( n = 0; n < count; n++ )
|
||||||
|
cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
|
||||||
|
|
||||||
|
count = cpriv->num_other_blues = priv->num_other_blues;
|
||||||
|
for ( n = 0; n < count; n++ )
|
||||||
|
cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
|
||||||
|
|
||||||
|
count = cpriv->num_family_blues = priv->num_family_blues;
|
||||||
|
for ( n = 0; n < count; n++ )
|
||||||
|
cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
|
||||||
|
|
||||||
|
count = cpriv->num_family_other_blues = priv->num_family_other_blues;
|
||||||
|
for ( n = 0; n < count; n++ )
|
||||||
|
cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n];
|
||||||
|
|
||||||
|
cpriv->blue_scale = priv->blue_scale;
|
||||||
|
cpriv->blue_shift = (FT_Pos)priv->blue_shift;
|
||||||
|
cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz;
|
||||||
|
|
||||||
|
cpriv->standard_width = (FT_Pos)priv->standard_width[0];
|
||||||
|
cpriv->standard_height = (FT_Pos)priv->standard_height[0];
|
||||||
|
|
||||||
|
count = cpriv->num_snap_widths = priv->num_snap_widths;
|
||||||
|
for ( n = 0; n < count; n++ )
|
||||||
|
cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n];
|
||||||
|
|
||||||
|
count = cpriv->num_snap_heights = priv->num_snap_heights;
|
||||||
|
for ( n = 0; n < count; n++ )
|
||||||
|
cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n];
|
||||||
|
|
||||||
|
cpriv->force_bold = priv->force_bold;
|
||||||
|
cpriv->lenIV = priv->lenIV;
|
||||||
|
cpriv->language_group = priv->language_group;
|
||||||
|
cpriv->expansion_factor = priv->expansion_factor;
|
||||||
|
|
||||||
|
cpriv->subfont = subfont;
|
||||||
|
|
||||||
|
|
||||||
|
/* Initialize the random number generator. */
|
||||||
|
if ( face->internal->random_seed != -1 )
|
||||||
|
{
|
||||||
|
/* . If we have a face-specific seed, use it. */
|
||||||
|
/* If non-zero, update it to a positive value. */
|
||||||
|
subfont->random = (FT_UInt32)face->internal->random_seed;
|
||||||
|
if ( face->internal->random_seed )
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
face->internal->random_seed = (FT_Int32)cff_random(
|
||||||
|
(FT_UInt32)face->internal->random_seed );
|
||||||
|
} while ( face->internal->random_seed < 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( !subfont->random )
|
||||||
|
{
|
||||||
|
FT_UInt32 seed;
|
||||||
|
|
||||||
|
/* compute random seed from some memory addresses */
|
||||||
|
seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
|
||||||
|
(FT_Offset)(char*)&face ^
|
||||||
|
(FT_Offset)(char*)&subfont );
|
||||||
|
seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
|
||||||
|
if ( seed == 0 )
|
||||||
|
seed = 0x7384;
|
||||||
|
|
||||||
|
subfont->random = seed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
t1_decrypt( FT_Byte* buffer,
|
t1_decrypt( FT_Byte* buffer,
|
||||||
FT_Offset length,
|
FT_Offset length,
|
||||||
|
@ -1779,4 +2506,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL_DEF( FT_UInt32 )
|
||||||
|
cff_random( FT_UInt32 r )
|
||||||
|
{
|
||||||
|
/* a 32bit version of the `xorshift' algorithm */
|
||||||
|
r ^= r << 13;
|
||||||
|
r ^= r >> 17;
|
||||||
|
r ^= r << 5;
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* END */
|
/* END */
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
|
#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
@ -190,6 +191,92 @@ FT_BEGIN_HEADER
|
||||||
t1_builder_close_contour( T1_Builder builder );
|
t1_builder_close_contour( T1_Builder builder );
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** CFF BUILDER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
cff_builder_init( CFF_Builder* builder,
|
||||||
|
TT_Face face,
|
||||||
|
CFF_Size size,
|
||||||
|
CFF_GlyphSlot glyph,
|
||||||
|
FT_Bool hinting );
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
cff_builder_done( CFF_Builder* builder );
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
cff_check_points( CFF_Builder* builder,
|
||||||
|
FT_Int count );
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
cff_builder_add_point( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y,
|
||||||
|
FT_Byte flag );
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
cff_builder_add_point1( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y );
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
cff_builder_start_point( CFF_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y );
|
||||||
|
FT_LOCAL( void )
|
||||||
|
cff_builder_close_contour( CFF_Builder* builder );
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
cff_builder_add_contour( CFF_Builder* builder );
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/***** *****/
|
||||||
|
/***** PS BUILDER *****/
|
||||||
|
/***** *****/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
ps_builder_init( PS_Builder* ps_builder,
|
||||||
|
void* builder,
|
||||||
|
FT_Bool is_t1 );
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
ps_builder_done( PS_Builder* builder );
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
ps_builder_check_points( PS_Builder* builder,
|
||||||
|
FT_Int count );
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
ps_builder_add_point( PS_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y,
|
||||||
|
FT_Byte flag );
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
ps_builder_add_point1( PS_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y );
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
ps_builder_add_contour( PS_Builder* builder );
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Error )
|
||||||
|
ps_builder_start_point( PS_Builder* builder,
|
||||||
|
FT_Pos x,
|
||||||
|
FT_Pos y );
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
ps_builder_close_contour( PS_Builder* builder );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/***** *****/
|
/***** *****/
|
||||||
|
@ -198,12 +285,26 @@ FT_BEGIN_HEADER
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
ps_decoder_init( PS_Decoder* ps_decoder,
|
||||||
|
void* decoder,
|
||||||
|
FT_Bool is_t1 );
|
||||||
|
|
||||||
|
FT_LOCAL( void )
|
||||||
|
t1_make_subfont( FT_Face face,
|
||||||
|
PS_Private priv,
|
||||||
|
CFF_SubFont subfont );
|
||||||
|
|
||||||
FT_LOCAL( void )
|
FT_LOCAL( void )
|
||||||
t1_decrypt( FT_Byte* buffer,
|
t1_decrypt( FT_Byte* buffer,
|
||||||
FT_Offset length,
|
FT_Offset length,
|
||||||
FT_UShort seed );
|
FT_UShort seed );
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL( FT_UInt32 )
|
||||||
|
cff_random( FT_UInt32 r );
|
||||||
|
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
||||||
#endif /* PSOBJS_H_ */
|
#endif /* PSOBJS_H_ */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2read.c */
|
/* psread.c */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for stream handling (body). */
|
/* Adobe's code for stream handling (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -36,12 +36,12 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
|
|
||||||
#include "cf2glue.h"
|
#include "psglue.h"
|
||||||
|
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
|
|
||||||
|
|
||||||
/* Define CF2_IO_FAIL as 1 to enable random errors and random */
|
/* Define CF2_IO_FAIL as 1 to enable random errors and random */
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2read.h */
|
/* psread.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for stream handling (specification). */
|
/* Adobe's code for stream handling (specification). */
|
||||||
/* */
|
/* */
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2stack.c */
|
/* psstack.c */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for emulating a CFF stack (body). */
|
/* Adobe's code for emulating a CFF stack (body). */
|
||||||
/* */
|
/* */
|
||||||
|
@ -36,14 +36,14 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "cf2ft.h"
|
#include "psft.h"
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
|
|
||||||
#include "cf2glue.h"
|
#include "psglue.h"
|
||||||
#include "cf2font.h"
|
#include "psfont.h"
|
||||||
#include "cf2stack.h"
|
#include "psstack.h"
|
||||||
|
|
||||||
#include "cf2error.h"
|
#include "pserror.h"
|
||||||
|
|
||||||
|
|
||||||
/* Allocate and initialize an instance of CF2_Stack. */
|
/* Allocate and initialize an instance of CF2_Stack. */
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2stack.h */
|
/* psstack.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for emulating a CFF stack (specification). */
|
/* Adobe's code for emulating a CFF stack (specification). */
|
||||||
/* */
|
/* */
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* cf2types.h */
|
/* pstypes.h */
|
||||||
/* */
|
/* */
|
||||||
/* Adobe's code for defining data types (specification only). */
|
/* Adobe's code for defining data types (specification only). */
|
||||||
/* */
|
/* */
|
|
@ -33,12 +33,25 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \
|
||||||
$(PSAUX_DIR)/t1cmap.c \
|
$(PSAUX_DIR)/t1cmap.c \
|
||||||
$(PSAUX_DIR)/afmparse.c \
|
$(PSAUX_DIR)/afmparse.c \
|
||||||
$(PSAUX_DIR)/psconv.c \
|
$(PSAUX_DIR)/psconv.c \
|
||||||
$(PSAUX_DIR)/psauxmod.c
|
$(PSAUX_DIR)/psauxmod.c \
|
||||||
|
$(PSAUX_DIR)/psarrst.c \
|
||||||
|
$(PSAUX_DIR)/psblues.c \
|
||||||
|
$(PSAUX_DIR)/pserror.c \
|
||||||
|
$(PSAUX_DIR)/psfont.c \
|
||||||
|
$(PSAUX_DIR)/psft.c \
|
||||||
|
$(PSAUX_DIR)/pshints.c \
|
||||||
|
$(PSAUX_DIR)/psintrp.c \
|
||||||
|
$(PSAUX_DIR)/psread.c \
|
||||||
|
$(PSAUX_DIR)/psstack.c \
|
||||||
|
$(PSAUX_DIR)/cffdecode.c
|
||||||
|
|
||||||
# PSAUX driver headers
|
# PSAUX driver headers
|
||||||
#
|
#
|
||||||
PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) \
|
PSAUX_DRV_H := $(PSAUX_DRV_SRC:%c=%h) \
|
||||||
$(PSAUX_DIR)/psauxerr.h
|
$(PSAUX_DIR)/psauxerr.h \
|
||||||
|
$(PSAUX_DIR)/psfixed.h \
|
||||||
|
$(PSAUX_DIR)/psglue.h \
|
||||||
|
$(PSAUX_DIR)/pstypes.h
|
||||||
|
|
||||||
|
|
||||||
# PSAUX driver object(s)
|
# PSAUX driver object(s)
|
||||||
|
|
|
@ -109,6 +109,55 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/* */
|
||||||
|
/* <Function> */
|
||||||
|
/* t1_lookup_glyph_by_stdcharcode_ps */
|
||||||
|
/* */
|
||||||
|
/* <Description> */
|
||||||
|
/* Looks up a given glyph by its StandardEncoding charcode. Used to */
|
||||||
|
/* implement the SEAC Type 1 operator in the Adobe engine */
|
||||||
|
/* */
|
||||||
|
/* <Input> */
|
||||||
|
/* face :: The current face object. */
|
||||||
|
/* */
|
||||||
|
/* charcode :: The character code to look for. */
|
||||||
|
/* */
|
||||||
|
/* <Return> */
|
||||||
|
/* A glyph index in the font face. Returns -1 if the corresponding */
|
||||||
|
/* glyph wasn't found. */
|
||||||
|
/* */
|
||||||
|
FT_LOCAL_DEF( FT_Int )
|
||||||
|
t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder,
|
||||||
|
FT_Int charcode )
|
||||||
|
{
|
||||||
|
FT_UInt n;
|
||||||
|
const FT_String* glyph_name;
|
||||||
|
FT_Service_PsCMaps psnames = decoder->psnames;
|
||||||
|
|
||||||
|
|
||||||
|
/* check range of standard char code */
|
||||||
|
if ( charcode < 0 || charcode > 255 )
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
glyph_name = psnames->adobe_std_strings(
|
||||||
|
psnames->adobe_std_encoding[charcode]);
|
||||||
|
|
||||||
|
for ( n = 0; n < decoder->num_glyphs; n++ )
|
||||||
|
{
|
||||||
|
FT_String* name = (FT_String*)decoder->glyph_names[n];
|
||||||
|
|
||||||
|
|
||||||
|
if ( name &&
|
||||||
|
name[0] == glyph_name[0] &&
|
||||||
|
ft_strcmp( name, glyph_name ) == 0 )
|
||||||
|
return (FT_Int)n;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Function> */
|
/* <Function> */
|
||||||
|
@ -1641,7 +1690,15 @@
|
||||||
FT_LOCAL_DEF( void )
|
FT_LOCAL_DEF( void )
|
||||||
t1_decoder_done( T1_Decoder decoder )
|
t1_decoder_done( T1_Decoder decoder )
|
||||||
{
|
{
|
||||||
|
FT_Memory memory = decoder->builder.memory;
|
||||||
|
|
||||||
t1_builder_done( &decoder->builder );
|
t1_builder_done( &decoder->builder );
|
||||||
|
|
||||||
|
if ( decoder->cf2_instance.finalizer )
|
||||||
|
{
|
||||||
|
decoder->cf2_instance.finalizer( decoder->cf2_instance.data );
|
||||||
|
FT_FREE( decoder->cf2_instance.data );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@ FT_BEGIN_HEADER
|
||||||
FT_CALLBACK_TABLE
|
FT_CALLBACK_TABLE
|
||||||
const T1_Decoder_FuncsRec t1_decoder_funcs;
|
const T1_Decoder_FuncsRec t1_decoder_funcs;
|
||||||
|
|
||||||
|
FT_LOCAL( FT_Int )
|
||||||
|
t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder,
|
||||||
|
FT_Int charcode );
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
t1_decoder_parse_glyph( T1_Decoder decoder,
|
t1_decoder_parse_glyph( T1_Decoder decoder,
|
||||||
|
|
|
@ -713,7 +713,7 @@
|
||||||
FT_MODULE_DRIVER_SCALABLE |
|
FT_MODULE_DRIVER_SCALABLE |
|
||||||
FT_MODULE_DRIVER_HAS_HINTER,
|
FT_MODULE_DRIVER_HAS_HINTER,
|
||||||
|
|
||||||
sizeof ( FT_DriverRec ),
|
sizeof ( PS_DriverRec ),
|
||||||
|
|
||||||
"type1",
|
"type1",
|
||||||
0x10000L,
|
0x10000L,
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
#include FT_OUTLINE_H
|
#include FT_OUTLINE_H
|
||||||
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
||||||
|
#include FT_INTERNAL_CFF_TYPES_H
|
||||||
|
#include FT_TYPE1_DRIVER_H
|
||||||
|
|
||||||
#include "t1errors.h"
|
#include "t1errors.h"
|
||||||
|
|
||||||
|
@ -37,37 +39,26 @@
|
||||||
#define FT_COMPONENT trace_t1gload
|
#define FT_COMPONENT trace_t1gload
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/*************************************************************************/
|
|
||||||
/*************************************************************************/
|
|
||||||
/********** *********/
|
|
||||||
/********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
|
|
||||||
/********** *********/
|
|
||||||
/********** The following code is in charge of computing *********/
|
|
||||||
/********** the maximum advance width of the font. It *********/
|
|
||||||
/********** quickly processes each glyph charstring to *********/
|
|
||||||
/********** extract the value from either a `sbw' or `seac' *********/
|
|
||||||
/********** operator. *********/
|
|
||||||
/********** *********/
|
|
||||||
/*************************************************************************/
|
|
||||||
/*************************************************************************/
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
static FT_Error
|
static FT_Error
|
||||||
T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
|
T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
|
||||||
FT_UInt glyph_index,
|
FT_UInt glyph_index,
|
||||||
FT_Data* char_string )
|
FT_Data* char_string,
|
||||||
|
FT_Bool* force_scaling )
|
||||||
{
|
{
|
||||||
T1_Face face = (T1_Face)decoder->builder.face;
|
T1_Face face = (T1_Face)decoder->builder.face;
|
||||||
T1_Font type1 = &face->type1;
|
T1_Font type1 = &face->type1;
|
||||||
FT_Error error = FT_Err_Ok;
|
FT_Error error = FT_Err_Ok;
|
||||||
|
|
||||||
|
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
||||||
|
const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
|
||||||
|
PS_Decoder psdecoder;
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
FT_Incremental_InterfaceRec *inc =
|
FT_Incremental_InterfaceRec *inc =
|
||||||
face->root.internal->incremental_interface;
|
face->root.internal->incremental_interface;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
|
||||||
|
|
||||||
decoder->font_matrix = type1->font_matrix;
|
decoder->font_matrix = type1->font_matrix;
|
||||||
decoder->font_offset = type1->font_offset;
|
decoder->font_offset = type1->font_offset;
|
||||||
|
@ -90,9 +81,45 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !error )
|
if ( !error )
|
||||||
error = decoder->funcs.parse_charstrings(
|
{
|
||||||
decoder, (FT_Byte*)char_string->pointer,
|
/* choose which renderer to use */
|
||||||
(FT_UInt)char_string->length );
|
if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE ||
|
||||||
|
decoder->builder.metrics_only )
|
||||||
|
error = decoder_funcs->parse_charstrings_old( decoder,
|
||||||
|
(FT_Byte*)char_string->pointer,
|
||||||
|
(FT_UInt)char_string->length );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CFF_SubFontRec subfont;
|
||||||
|
|
||||||
|
|
||||||
|
psaux->ps_decoder_init( &psdecoder, decoder, TRUE );
|
||||||
|
|
||||||
|
psaux->t1_make_subfont( FT_FACE( face ), &face->type1.private_dict, &subfont );
|
||||||
|
psdecoder.current_subfont = &subfont;
|
||||||
|
|
||||||
|
error = decoder_funcs->parse_charstrings( &psdecoder,
|
||||||
|
(FT_Byte*)char_string->pointer,
|
||||||
|
(FT_ULong)char_string->length );
|
||||||
|
|
||||||
|
/* Adobe's engine uses 16.16 numbers everywhere; */
|
||||||
|
/* as a consequence, glyphs larger than 2000ppem get rejected */
|
||||||
|
if ( FT_ERR_EQ( error, Glyph_Too_Big ) )
|
||||||
|
{
|
||||||
|
/* this time, we retry unhinted and scale up the glyph later on */
|
||||||
|
/* (the engine uses and sets the hardcoded value 0x10000 / 64 = */
|
||||||
|
/* 0x400 for both `x_scale' and `y_scale' in this case) */
|
||||||
|
((T1_GlyphSlot)decoder->builder.glyph)->hint = FALSE;
|
||||||
|
|
||||||
|
*force_scaling = TRUE;
|
||||||
|
|
||||||
|
error = decoder_funcs->parse_charstrings( &psdecoder,
|
||||||
|
(FT_Byte*)char_string->pointer,
|
||||||
|
(FT_ULong)char_string->length );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
|
|
||||||
|
@ -126,8 +153,10 @@
|
||||||
FT_UInt glyph_index )
|
FT_UInt glyph_index )
|
||||||
{
|
{
|
||||||
FT_Data glyph_data;
|
FT_Data glyph_data;
|
||||||
|
FT_Bool force_scaling = FALSE;
|
||||||
FT_Error error = T1_Parse_Glyph_And_Get_Char_String(
|
FT_Error error = T1_Parse_Glyph_And_Get_Char_String(
|
||||||
decoder, glyph_index, &glyph_data );
|
decoder, glyph_index, &glyph_data,
|
||||||
|
&force_scaling );
|
||||||
|
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
|
@ -149,6 +178,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/********** *********/
|
||||||
|
/********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
|
||||||
|
/********** *********/
|
||||||
|
/********** The following code is in charge of computing *********/
|
||||||
|
/********** the maximum advance width of the font. It *********/
|
||||||
|
/********** quickly processes each glyph charstring to *********/
|
||||||
|
/********** extract the value from either a `sbw' or `seac' *********/
|
||||||
|
/********** operator. *********/
|
||||||
|
/********** *********/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
/*************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
T1_Compute_Max_Advance( T1_Face face,
|
T1_Compute_Max_Advance( T1_Face face,
|
||||||
FT_Pos* max_advance )
|
FT_Pos* max_advance )
|
||||||
|
@ -278,6 +324,8 @@
|
||||||
T1_DecoderRec decoder;
|
T1_DecoderRec decoder;
|
||||||
T1_Face face = (T1_Face)t1glyph->face;
|
T1_Face face = (T1_Face)t1glyph->face;
|
||||||
FT_Bool hinting;
|
FT_Bool hinting;
|
||||||
|
FT_Bool scaled;
|
||||||
|
FT_Bool force_scaling = FALSE;
|
||||||
T1_Font type1 = &face->type1;
|
T1_Font type1 = &face->type1;
|
||||||
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
||||||
const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
|
const T1_Decoder_Funcs decoder_funcs = psaux->t1_decoder_funcs;
|
||||||
|
@ -325,7 +373,10 @@
|
||||||
|
|
||||||
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
|
hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
|
||||||
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
|
( load_flags & FT_LOAD_NO_HINTING ) == 0 );
|
||||||
|
scaled = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 );
|
||||||
|
|
||||||
|
glyph->hint = hinting;
|
||||||
|
glyph->scaled = scaled;
|
||||||
t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
t1glyph->format = FT_GLYPH_FORMAT_OUTLINE;
|
||||||
|
|
||||||
error = decoder_funcs->init( &decoder,
|
error = decoder_funcs->init( &decoder,
|
||||||
|
@ -355,13 +406,15 @@
|
||||||
|
|
||||||
/* now load the unscaled outline */
|
/* now load the unscaled outline */
|
||||||
error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index,
|
error = T1_Parse_Glyph_And_Get_Char_String( &decoder, glyph_index,
|
||||||
&glyph_data );
|
&glyph_data,
|
||||||
|
&force_scaling );
|
||||||
if ( error )
|
if ( error )
|
||||||
goto Exit;
|
goto Exit;
|
||||||
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
||||||
glyph_data_loaded = 1;
|
glyph_data_loaded = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
hinting = glyph->hint;
|
||||||
font_matrix = decoder.font_matrix;
|
font_matrix = decoder.font_matrix;
|
||||||
font_offset = decoder.font_offset;
|
font_offset = decoder.font_offset;
|
||||||
|
|
||||||
|
@ -451,7 +504,7 @@
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 || force_scaling )
|
||||||
{
|
{
|
||||||
/* scale the outline and the metrics */
|
/* scale the outline and the metrics */
|
||||||
FT_Int n;
|
FT_Int n;
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include FT_INTERNAL_DEBUG_H
|
#include FT_INTERNAL_DEBUG_H
|
||||||
#include FT_INTERNAL_STREAM_H
|
#include FT_INTERNAL_STREAM_H
|
||||||
#include FT_TRUETYPE_IDS_H
|
#include FT_TRUETYPE_IDS_H
|
||||||
|
#include FT_TYPE1_DRIVER_H
|
||||||
|
|
||||||
#include "t1gload.h"
|
#include "t1gload.h"
|
||||||
#include "t1load.h"
|
#include "t1load.h"
|
||||||
|
@ -578,9 +579,38 @@
|
||||||
/* FreeType error code. 0 means success. */
|
/* FreeType error code. 0 means success. */
|
||||||
/* */
|
/* */
|
||||||
FT_LOCAL_DEF( FT_Error )
|
FT_LOCAL_DEF( FT_Error )
|
||||||
T1_Driver_Init( FT_Module driver )
|
T1_Driver_Init( FT_Module module )
|
||||||
{
|
{
|
||||||
FT_UNUSED( driver );
|
PS_Driver driver = (PS_Driver)module;
|
||||||
|
|
||||||
|
FT_UInt32 seed;
|
||||||
|
|
||||||
|
|
||||||
|
/* set default property values, cf. `ftt1drv.h' */
|
||||||
|
driver->hinting_engine = FT_T1_HINTING_ADOBE;
|
||||||
|
|
||||||
|
driver->no_stem_darkening = TRUE;
|
||||||
|
|
||||||
|
driver->darken_params[0] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1;
|
||||||
|
driver->darken_params[1] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1;
|
||||||
|
driver->darken_params[2] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2;
|
||||||
|
driver->darken_params[3] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2;
|
||||||
|
driver->darken_params[4] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3;
|
||||||
|
driver->darken_params[5] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3;
|
||||||
|
driver->darken_params[6] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4;
|
||||||
|
driver->darken_params[7] = CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4;
|
||||||
|
|
||||||
|
/* compute random seed from some memory addresses */
|
||||||
|
seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
|
||||||
|
(FT_Offset)(char*)&module ^
|
||||||
|
(FT_Offset)(char*)module->memory );
|
||||||
|
seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
|
||||||
|
|
||||||
|
driver->random_seed = (FT_Int32)seed;
|
||||||
|
if ( driver->random_seed < 0 )
|
||||||
|
driver->random_seed = -driver->random_seed;
|
||||||
|
else if ( driver->random_seed == 0 )
|
||||||
|
driver->random_seed = 123456789;
|
||||||
|
|
||||||
return FT_Err_Ok;
|
return FT_Err_Ok;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,12 +120,12 @@ FT_BEGIN_HEADER
|
||||||
FT_Bool hint;
|
FT_Bool hint;
|
||||||
FT_Bool scaled;
|
FT_Bool scaled;
|
||||||
|
|
||||||
FT_Int max_points;
|
|
||||||
FT_Int max_contours;
|
|
||||||
|
|
||||||
FT_Fixed x_scale;
|
FT_Fixed x_scale;
|
||||||
FT_Fixed y_scale;
|
FT_Fixed y_scale;
|
||||||
|
|
||||||
|
FT_Int max_points;
|
||||||
|
FT_Int max_contours;
|
||||||
|
|
||||||
} T1_GlyphSlotRec;
|
} T1_GlyphSlotRec;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue