[psaux, cff] Move CFF decoder components into `psaux' module.

NOTE: Does not compile!

* src/cff/cffgload.c (CFF_Operator,
CFF_COUNT_{CHECK_WIDTH,EXACT,CLEAR_STACK}, cff_argument_counts,
cff_operator_seac, cff_compute_bias, cff_lookup_glyph_by_stdcharcode,
cff_decoder_{parse_charstrings,init,prepare}): Moved to...
* src/psaux/cffdecode.c: This new file.
* src/cff/cffgload.h: Moved corresponding declarations to...
* src/psaux/cffdecode.h: This new file.

* src/cff/cffgload.h (CFF_MAX_{OPERANDS,SUBRS_CALLS,TRANS_ELEMENTS},
CFF_Decoder_Zone, CFF_Decoder): Moved declarations to...
* include/freetype/internal/psaux.h: Here.

* src/psaux/cf2ft.h: Updated include.

* src/psaux/psaux.c, src/psaux/rules.mk: Updated with the new file.
This commit is contained in:
Ewald Hew 2017-06-09 11:46:44 +08:00
parent fc1dd29e0b
commit 75356e79ce
8 changed files with 2429 additions and 2374 deletions

View File

@ -702,6 +702,76 @@ FT_BEGIN_HEADER
} T1_DecoderRec;
/*************************************************************************/
/***** *****/
/***** 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;
/*************************************************************************/
/*************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -28,14 +28,6 @@
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
/*************************************************************************/
@ -131,10 +123,6 @@ FT_BEGIN_HEADER
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 )
cff_get_glyph_data( TT_Face face,
FT_UInt glyph_index,
@ -146,74 +134,6 @@ FT_BEGIN_HEADER
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 */
/* Compute the maximum advance width of a font through quick parsing */
@ -223,13 +143,6 @@ FT_BEGIN_HEADER
#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 )
cff_slot_load( CFF_GlyphSlot glyph,

View File

@ -50,7 +50,7 @@
#include FT_SYSTEM_H
#include "cf2glue.h"
#include "cffgload.h" /* for CFF_Decoder */
#include FT_INTERNAL_POSTSCRIPT_AUX_H /* for CFF_Decoder */
FT_BEGIN_HEADER

2311
src/psaux/cffdecode.c Normal file

File diff suppressed because it is too large Load Diff

44
src/psaux/cffdecode.h Normal file
View File

@ -0,0 +1,44 @@
#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);
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 */

View File

@ -25,6 +25,7 @@
#include "psobjs.c"
#include "t1cmap.c"
#include "t1decode.c"
#include "cffdecode.c"
#include "cf2arrst.c"
#include "cf2blues.c"

View File

@ -42,7 +42,8 @@ PSAUX_DRV_SRC := $(PSAUX_DIR)/psobjs.c \
$(PSAUX_DIR)/cf2hints.c \
$(PSAUX_DIR)/cf2intrp.c \
$(PSAUX_DIR)/cf2read.c \
$(PSAUX_DIR)/cf2stack.c
$(PSAUX_DIR)/cf2stack.c \
$(PSAUX_DIR)/cffdecode.c
# PSAUX driver headers
#