Commit 2c454d29 authored by David Turner's avatar David Turner
Browse files

font drivers working with "fake" pshinter module,

now, the real hinting engine is going to be connected
parent 65c39c2b
......@@ -30,6 +30,7 @@ SubDirHdr += $(FT2_INCLUDE) ;
# record these definitions.
#
HDRMACRO [ FT2_SubDir include freetype config ftheader.h ] ;
HDRMACRO [ FT2_SubDir include freetype internal internal.h ] ;
# Now include the Jamfile in "freetype2/src", used to drive the compilation
# of each FreeType 2 component and/or module.
......
......@@ -4,9 +4,11 @@ FT_USE_MODULE(t1cid_driver_class)
FT_USE_MODULE(pcf_driver_class)
FT_USE_MODULE(psaux_module_class)
FT_USE_MODULE(psnames_module_class)
FT_USE_MODULE(pshinter_module_class)
FT_USE_MODULE(ft_raster1_renderer_class)
FT_USE_MODULE(sfnt_module_class)
FT_USE_MODULE(ft_smooth_renderer_class)
FT_USE_MODULE(tt_driver_class)
FT_USE_MODULE(t1_driver_class)
FT_USE_MODULE(winfnt_driver_class)
......@@ -406,7 +406,8 @@ FT_BEGIN_HEADER
void (*init)( T1_Builder* builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot );
FT_GlyphSlot slot,
FT_Bool hinting );
void (*done)( T1_Builder* builder );
......@@ -506,7 +507,8 @@ FT_BEGIN_HEADER
FT_Error error; /* only used for memory errors */
FT_Bool metrics_only;
T1_Hints_Funcs hints_funcs;
void* hints_funcs; /* hinter-specific */
void* hints_globals; /* hinter-specific */
T1_Builder_Funcs funcs;
};
......@@ -565,6 +567,7 @@ FT_BEGIN_HEADER
FT_GlyphSlot slot,
FT_Byte** glyph_names,
T1_Blend* blend,
FT_Bool hinting,
T1_Decoder_Callback callback );
void (*done) ( T1_Decoder* decoder );
......
......@@ -21,7 +21,7 @@
#define __PSHINTS_H__
#include <ft2build.h>
#include FT_TYPES_H
#include FT_FREETYPE_H
#include FT_INTERNAL_POSTSCRIPT_GLOBALS_H
FT_BEGIN_HEADER
......@@ -287,7 +287,7 @@ FT_BEGIN_HEADER
*/
typedef void (*T1_Hints_SetStemFunc) ( T1_Hints hints,
FT_UInt dimension,
FT_Int* coords );
FT_Long* coords );
/************************************************************************
*
......@@ -311,7 +311,7 @@ FT_BEGIN_HEADER
*/
typedef void (*T1_Hints_SetStem3Func) ( T1_Hints hints,
FT_UInt dimension,
FT_Int* coords );
FT_Long* coords );
/************************************************************************
*
......
......@@ -107,6 +107,9 @@
if ( !Q )
goto Fail;
if ( size > current )
memset( (char*)Q + current, 0, size - current );
*P = Q;
return FT_Err_Ok;
......
......@@ -158,6 +158,7 @@
0, /* glyph slot */
0, /* glyph names! XXX */
0, /* blend == 0 */
0, /* hinting == FALSE */
cid_load_glyph );
if ( error )
return error;
......@@ -237,6 +238,7 @@
(FT_GlyphSlot)glyph,
0, /* glyph names -- XXX */
0, /* blend == 0 */
0, /* hinting == 0 */
cid_load_glyph );
/* set up the decoder */
......
......@@ -23,7 +23,6 @@
#include FT_INTERNAL_TYPE1_TYPES_H
#include "cidload.h"
#include "ciderrs.h"
#include <stdio.h>
......
......@@ -53,10 +53,10 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF
FT_Error PS_Table_New( PS_Table* table,
FT_Int count,
FT_Memory memory )
FT_LOCAL_DEF FT_Error
PS_Table_New( PS_Table* table,
FT_Int count,
FT_Memory memory )
{
FT_Error error;
......@@ -82,9 +82,9 @@
}
static
void shift_elements( PS_Table* table,
FT_Byte* old_base )
static void
shift_elements( PS_Table* table,
FT_Byte* old_base )
{
FT_Long delta = (FT_Long)( table->block - old_base );
FT_Byte** offset = table->elements;
......@@ -99,9 +99,9 @@
}
static
FT_Error reallocate_t1_table( PS_Table* table,
FT_Int new_size )
static FT_Error
reallocate_t1_table( PS_Table* table,
FT_Int new_size )
{
FT_Memory memory = table->memory;
FT_Byte* old_base = table->block;
......@@ -148,11 +148,11 @@
/* FreeType error code. 0 means success. An error is returned if a */
/* reallocation fails. */
/* */
FT_LOCAL_DEF
FT_Error PS_Table_Add( PS_Table* table,
FT_Int index,
void* object,
FT_Int length )
FT_LOCAL_DEF FT_Error
PS_Table_Add( PS_Table* table,
FT_Int index,
void* object,
FT_Int length )
{
if ( index < 0 || index > table->max_elems )
{
......@@ -200,8 +200,8 @@
/* This function does NOT release the heap's memory block. It is up */
/* to the caller to clean it, or reference it in its own structures. */
/* */
FT_LOCAL_DEF
void PS_Table_Done( PS_Table* table )
FT_LOCAL_DEF void
PS_Table_Done( PS_Table* table )
{
FT_Memory memory = table->memory;
FT_Error error;
......@@ -222,8 +222,8 @@
}
FT_LOCAL_DEF
void PS_Table_Release( PS_Table* table )
FT_LOCAL_DEF void
PS_Table_Release( PS_Table* table )
{
FT_Memory memory = table->memory;
......@@ -253,8 +253,8 @@
#define IS_T1_SPACE( c ) ( IS_T1_WHITESPACE( c ) || IS_T1_LINESPACE( c ) )
FT_LOCAL_DEF
void T1_Skip_Spaces( T1_Parser* parser )
FT_LOCAL_DEF void
T1_Skip_Spaces( T1_Parser* parser )
{
FT_Byte* cur = parser->cursor;
FT_Byte* limit = parser->limit;
......@@ -273,8 +273,8 @@
}
FT_LOCAL_DEF
void T1_Skip_Alpha( T1_Parser* parser )
FT_LOCAL_DEF void
T1_Skip_Alpha( T1_Parser* parser )
{
FT_Byte* cur = parser->cursor;
FT_Byte* limit = parser->limit;
......@@ -293,9 +293,9 @@
}
FT_LOCAL_DEF
void T1_ToToken( T1_Parser* parser,
T1_Token* token )
FT_LOCAL_DEF void
T1_ToToken( T1_Parser* parser,
T1_Token* token )
{
FT_Byte* cur;
FT_Byte* limit;
......@@ -376,11 +376,11 @@
}
FT_LOCAL_DEF
void T1_ToTokenArray( T1_Parser* parser,
T1_Token* tokens,
FT_UInt max_tokens,
FT_Int* pnum_tokens )
FT_LOCAL_DEF void
T1_ToTokenArray( T1_Parser* parser,
T1_Token* tokens,
FT_UInt max_tokens,
FT_Int* pnum_tokens )
{
T1_Token master;
......@@ -422,9 +422,9 @@
}
static
FT_Long t1_toint( FT_Byte** cursor,
FT_Byte* limit )
static FT_Long
t1_toint( FT_Byte** cursor,
FT_Byte* limit )
{
FT_Long result = 0;
FT_Byte* cur = *cursor;
......@@ -467,10 +467,10 @@
}
static
FT_Long t1_tofixed( FT_Byte** cursor,
FT_Byte* limit,
FT_Long power_ten )
static FT_Long
t1_tofixed( FT_Byte** cursor,
FT_Byte* limit,
FT_Long power_ten )
{
FT_Byte* cur = *cursor;
FT_Long num, divider, result;
......@@ -557,11 +557,11 @@
}
static
FT_Int t1_tocoordarray( FT_Byte** cursor,
FT_Byte* limit,
FT_Int max_coords,
FT_Short* coords )
static FT_Int
t1_tocoordarray( FT_Byte** cursor,
FT_Byte* limit,
FT_Int max_coords,
FT_Short* coords )
{
FT_Byte* cur = *cursor;
FT_Int count = 0;
......@@ -616,12 +616,12 @@
}
static
FT_Int t1_tofixedarray( FT_Byte** cursor,
FT_Byte* limit,
FT_Int max_values,
FT_Fixed* values,
FT_Int power_ten )
static FT_Int
t1_tofixedarray( FT_Byte** cursor,
FT_Byte* limit,
FT_Int max_values,
FT_Fixed* values,
FT_Int power_ten )
{
FT_Byte* cur = *cursor;
FT_Int count = 0;
......@@ -677,10 +677,10 @@
#if 0
static
FT_String* t1_tostring( FT_Byte** cursor,
FT_Byte* limit,
FT_Memory memory )
static FT_String*
t1_tostring( FT_Byte** cursor,
FT_Byte* limit,
FT_Memory memory )
{
FT_Byte* cur = *cursor;
FT_Int len = 0;
......@@ -772,12 +772,12 @@
/* Load a simple field (i.e. non-table) into the current list of objects */
FT_LOCAL_DEF
FT_Error T1_Load_Field( T1_Parser* parser,
const T1_Field* field,
void** objects,
FT_UInt max_objects,
FT_ULong* pflags )
FT_LOCAL_DEF FT_Error
T1_Load_Field( T1_Parser* parser,
const T1_Field* field,
void** objects,
FT_UInt max_objects,
FT_ULong* pflags )
{
T1_Token token;
FT_Byte* cur;
......@@ -893,12 +893,12 @@
#define T1_MAX_TABLE_ELEMENTS 32
FT_LOCAL_DEF
FT_Error T1_Load_Field_Table( T1_Parser* parser,
const T1_Field* field,
void** objects,
FT_UInt max_objects,
FT_ULong* pflags )
FT_LOCAL_DEF FT_Error
T1_Load_Field_Table( T1_Parser* parser,
const T1_Field* field,
void** objects,
FT_UInt max_objects,
FT_ULong* pflags )
{
T1_Token elements[T1_MAX_TABLE_ELEMENTS];
T1_Token* token;
......@@ -957,36 +957,36 @@
}
FT_LOCAL_DEF
FT_Long T1_ToInt( T1_Parser* parser )
FT_LOCAL_DEF FT_Long
T1_ToInt( T1_Parser* parser )
{
return t1_toint( &parser->cursor, parser->limit );
}
FT_LOCAL_DEF
FT_Fixed T1_ToFixed( T1_Parser* parser,
FT_Int power_ten )
FT_LOCAL_DEF FT_Fixed
T1_ToFixed( T1_Parser* parser,
FT_Int power_ten )
{
return t1_tofixed( &parser->cursor, parser->limit, power_ten );
}
FT_LOCAL_DEF
FT_Int T1_ToCoordArray( T1_Parser* parser,
FT_Int max_coords,
FT_Short* coords )
FT_LOCAL_DEF FT_Int
T1_ToCoordArray( T1_Parser* parser,
FT_Int max_coords,
FT_Short* coords )
{
return t1_tocoordarray( &parser->cursor, parser->limit,
max_coords, coords );
}
FT_LOCAL_DEF
FT_Int T1_ToFixedArray( T1_Parser* parser,
FT_Int max_values,
FT_Fixed* values,
FT_Int power_ten )
FT_LOCAL_DEF FT_Int
T1_ToFixedArray( T1_Parser* parser,
FT_Int max_values,
FT_Fixed* values,
FT_Int power_ten )
{
return t1_tofixedarray( &parser->cursor, parser->limit,
max_values, values, power_ten );
......@@ -995,15 +995,15 @@
#if 0
FT_LOCAL_DEF
FT_String* T1_ToString( T1_Parser* parser )
FT_LOCAL_DEF FT_String*
T1_ToString( T1_Parser* parser )
{
return t1_tostring( &parser->cursor, parser->limit, parser->memory );
}
FT_LOCAL_DEF
FT_Bool T1_ToBool( T1_Parser* parser )
FT_LOCAL_DEF FT_Bool
T1_ToBool( T1_Parser* parser )
{
return t1_tobool( &parser->cursor, parser->limit );
}
......@@ -1011,11 +1011,11 @@
#endif /* 0 */
FT_LOCAL_DEF
void T1_Init_Parser( T1_Parser* parser,
FT_Byte* base,
FT_Byte* limit,
FT_Memory memory )
FT_LOCAL_DEF void
T1_Init_Parser( T1_Parser* parser,
FT_Byte* base,
FT_Byte* limit,
FT_Memory memory )
{
parser->error = 0;
parser->base = base;
......@@ -1026,8 +1026,8 @@
}
FT_LOCAL_DEF
void T1_Done_Parser( T1_Parser* parser )
FT_LOCAL_DEF void
T1_Done_Parser( T1_Parser* parser )
{
FT_UNUSED( parser );
}
......@@ -1059,11 +1059,12 @@
/* */
/* glyph :: The current glyph object. */
/* */
FT_LOCAL_DEF
void T1_Builder_Init( T1_Builder* builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot glyph )
FT_LOCAL_DEF void
T1_Builder_Init( T1_Builder* builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot glyph,
FT_Bool hinting )
{
builder->path_begun = 0;
builder->load_points = 1;
......@@ -1081,8 +1082,12 @@
builder->base = &loader->base.outline;
builder->current = &loader->current.outline;
FT_GlyphLoader_Rewind( loader );
builder->hints_func = (T1_Hints_Funcs) glyph->internal->glyph_hints;
builder->hints_globals = size->internal;
builder->hints_funcs = 0;
if (hinting)
builder->hints_funcs = glyph->internal->glyph_hints;
}
if ( size )
......@@ -1116,8 +1121,8 @@
/* <Input> */
/* builder :: A pointer to the glyph builder to finalize. */
/* */
FT_LOCAL_DEF
void T1_Builder_Done( T1_Builder* builder )
FT_LOCAL_DEF void
T1_Builder_Done( T1_Builder* builder )
{
FT_GlyphSlot glyph = builder->glyph;
......@@ -1128,20 +1133,20 @@
/* check that there is enough room for `count' more points */
FT_LOCAL_DEF
FT_Error T1_Builder_Check_Points( T1_Builder* builder,
FT_Int count )
FT_LOCAL_DEF FT_Error
T1_Builder_Check_Points( T1_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 T1_Builder_Add_Point( T1_Builder* builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag )
FT_LOCAL_DEF void
T1_Builder_Add_Point( T1_Builder* builder,
FT_Pos x,
FT_Pos y,
FT_Byte flag )
{
FT_Outline* outline = builder->current;
......@@ -1168,10 +1173,10 @@
/* check space for a new on-curve point, then add it */
FT_LOCAL_DEF
FT_Error T1_Builder_Add_Point1( T1_Builder* builder,
FT_Pos x,
FT_Pos y )
FT_LOCAL_DEF FT_Error
T1_Builder_Add_Point1( T1_Builder* builder,
FT_Pos x,
FT_Pos y )
{
FT_Error error;
......@@ -1185,8 +1190,8 @@
/* check room for a new contour, then add it */
FT_LOCAL_DEF
FT_Error T1_Builder_Add_Contour( T1_Builder* builder )
FT_LOCAL_DEF FT_Error
T1_Builder_Add_Contour( T1_Builder* builder )
{
FT_Outline* outline = builder->current;
FT_Error error;
......@@ -1213,10 +1218,10 @@
/* if a path was begun, add its first on-curve point */
FT_LOCAL_DEF
FT_Error T1_Builder_Start_Point( T1_Builder* builder,
FT_Pos x,
FT_Pos y )
FT_LOCAL_DEF FT_Error
T1_Builder_Start_Point( T1_Builder* builder,
FT_Pos x,
FT_Pos y )
{
FT_Error error = 0;
......@@ -1234,8 +1239,8 @@
/* close the current contour */
FT_LOCAL_DEF
void T1_Builder_Close_Contour( T1_Builder* builder )
FT_LOCAL_DEF void
T1_Builder_Close_Contour( T1_Builder* builder )
{
FT_Outline* outline = builder->current;
......@@ -1277,10 +1282,10 @@
/*************************************************************************/
/*************************************************************************/
FT_LOCAL_DEF
void T1_Decrypt( FT_Byte* buffer,
FT_Int length,
FT_UShort seed )
FT_LOCAL_DEF void
T1_Decrypt( FT_Byte* buffer,
FT_Int length,
FT_UShort seed )
{
while ( length > 0 )
{
......
......@@ -147,7 +147,8 @@ FT_BEGIN_HEADER
void T1_Builder_Init( T1_Builder* builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot glyph );
FT_GlyphSlot glyph,
FT_Bool hinting );
FT_LOCAL
void T1_Builder_Done( T1_Builder* builder );
......
......@@ -267,6 +267,9 @@
decoder->builder.left_bearing.x = 0;
decoder->builder.left_bearing.y = 0;
decoder->builder.pos_x = adx - asb;
decoder->builder.pos_y = ady;
/* Now load `achar' on top of */
/* the base outline */
error = T1_Decoder_Parse_Glyph( decoder, achar_index );
......@@ -279,17 +282,8 @@
decoder->builder.left_bearing = left_bearing;
decoder->builder.advance = advance;
/* Finally, move the accent */
if ( decoder->builder.load_points )
{
FT_Outline dummy;
dummy.n_points = (short)( base->n_points - n_base_points );
dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx - asb, ady );
}
decoder->builder.pos_x = 0;
decoder->builder.pos_y = 0;
Exit:
return error;
......@@ -343,7 +337,7 @@
builder->path_begun = 0;
hinter = builder->hints_funcs;
hinter = (T1_Hints_Funcs) builder->hints_funcs;
zone->base = charstring_base;
limit = zone->limit = charstring_base + charstring_len;
......@@ -722,7 +716,15 @@