* src/type1/t1gload.c (T1_Load_Glyph): enable font matrix transform

on hinted glyphs..

        * src/cid/cidgload.c, src/cid/cidobjs.c, src/cid/cidobjs.h,
        src/cid/cidriver.c, include/freetype/internal/t1types.h: added
        Postscript hinter support to the CID font driver !!
This commit is contained in:
David Turner 2001-12-20 09:36:21 +00:00
parent eed63c3f60
commit 6ae4d20687
7 changed files with 203 additions and 32 deletions

View File

@ -1,3 +1,13 @@
2001-12-20 David Turner <david@freetype.org>
* src/type1/t1gload.c (T1_Load_Glyph): enable font matrix transform
on hinted glyphs..
* src/cid/cidgload.c, src/cid/cidobjs.c, src/cid/cidobjs.h,
src/cid/cidriver.c, include/freetype/internal/t1types.h: added
Postscript hinter support to the CID font driver !!
2001-12-19 David Turner <david@freetype.org>
* include/freetype/cache/ftcache.h: Added comments to indicate that

View File

@ -188,6 +188,9 @@ FT_BEGIN_HEADER
CID_Info cid;
void* afm_data;
CID_Subrs* subrs;
/* since FT 2.1 - interface to PostScript hinter */
void* pshinter;
} CID_FaceRec;

View File

@ -238,7 +238,7 @@
(FT_GlyphSlot)glyph,
0, /* glyph names -- XXX */
0, /* blend == 0 */
0, /* hinting == 0 */
hinting,
cid_load_glyph );
/* set up the decoder */
@ -316,11 +316,12 @@
/* First of all, scale the points */
for ( n = cur->n_points; n > 0; n--, vec++ )
{
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
if ( !hinting )
for ( n = cur->n_points; n > 0; n--, vec++ )
{
vec->x = FT_MulFix( vec->x, x_scale );
vec->y = FT_MulFix( vec->y, y_scale );
}
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );

View File

@ -23,6 +23,7 @@
#include "cidload.h"
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
#include FT_INTERNAL_POSTSCRIPT_AUX_H
#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include "ciderrs.h"
@ -37,6 +38,127 @@
#define FT_COMPONENT trace_cidobjs
/*************************************************************************/
/* */
/* SLOT FUNCTIONS */
/* */
/*************************************************************************/
FT_LOCAL_DEF void
CID_GlyphSlot_Done( CID_GlyphSlot slot )
{
slot->root.internal->glyph_hints = 0;
}
FT_LOCAL_DEF FT_Error
CID_GlyphSlot_Init( CID_GlyphSlot slot )
{
CID_Face face;
PSHinter_Interface* pshinter;
face = (CID_Face) slot->root.face;
pshinter = face->pshinter;
if (pshinter)
{
FT_Module module;
module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" );
if (module)
{
T1_Hints_Funcs funcs;
funcs = pshinter->get_t1_funcs( module );
slot->root.internal->glyph_hints = (void*)funcs;
}
}
return 0;
}
/*************************************************************************/
/* */
/* SIZE FUNCTIONS */
/* */
/*************************************************************************/
static PSH_Globals_Funcs
CID_Size_Get_Globals_Funcs( CID_Size size )
{
CID_Face face = (CID_Face) size->root.face;
PSHinter_Interface* pshinter = face->pshinter;
FT_Module module;
module = FT_Get_Module( size->root.face->driver->root.library,
"pshinter" );
return ( module && pshinter && pshinter->get_globals_funcs )
? pshinter->get_globals_funcs( module )
: 0 ;
}
FT_LOCAL_DEF void
CID_Size_Done( CID_Size size )
{
if ( size->root.internal )
{
PSH_Globals_Funcs funcs;
funcs = CID_Size_Get_Globals_Funcs( size );
if ( funcs )
funcs->destroy( (PSH_Globals)size->root.internal );
size->root.internal = 0;
}
}
FT_LOCAL_DEF FT_Error
CID_Size_Init( CID_Size size )
{
FT_Error error = 0;
PSH_Globals_Funcs funcs = CID_Size_Get_Globals_Funcs( size );
if ( funcs )
{
PSH_Globals globals;
CID_Face face = (CID_Face)size->root.face;
CID_FontDict* dict = face->cid.font_dicts + face->root.face_index;
T1_Private* priv = &dict->private_dict;
error = funcs->create( size->root.face->memory, priv, &globals );
if ( !error )
size->root.internal = (FT_Size_Internal)(void*)globals;
}
return error;
}
FT_LOCAL_DEF FT_Error
CID_Size_Reset( CID_Size size )
{
PSH_Globals_Funcs funcs = CID_Size_Get_Globals_Funcs( size );
FT_Error error = 0;
if ( funcs )
error = funcs->set_scale( (PSH_Globals)size->root.internal,
size->root.metrics.x_scale,
size->root.metrics.y_scale,
0, 0 );
return error;
}
/*************************************************************************/
/* */
/* FACE FUNCTIONS */
@ -47,7 +169,7 @@
/*************************************************************************/
/* */
/* <Function> */
/* CID_Done_Face */
/* CID_Face_Done */
/* */
/* <Description> */
/* Finalizes a given face object. */
@ -56,7 +178,7 @@
/* face :: A pointer to the face object to destroy. */
/* */
FT_LOCAL_DEF void
CID_Done_Face( CID_Face face )
CID_Face_Done( CID_Face face )
{
FT_Memory memory;
@ -94,7 +216,7 @@
/*************************************************************************/
/* */
/* <Function> */
/* CID_Init_Face */
/* CID_Face_Init */
/* */
/* <Description> */
/* Initializes a given CID face object. */
@ -115,7 +237,7 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF FT_Error
CID_Init_Face( FT_Stream stream,
CID_Face_Init( FT_Stream stream,
CID_Face face,
FT_Int face_index,
FT_Int num_params,
@ -124,6 +246,7 @@
FT_Error error;
PSNames_Interface* psnames;
PSAux_Interface* psaux;
PSHinter_Interface* pshinter;
FT_UNUSED( num_params );
FT_UNUSED( params );
@ -151,6 +274,17 @@
face->psaux = psaux;
}
pshinter = (PSHinter_Interface*)face->pshinter;
if ( !pshinter )
{
pshinter = (PSHinter_Interface*)
FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" );
face->pshinter = pshinter;
}
/* open the tokenizer; this will also check the font format */
if ( FILE_Seek( 0 ) )
goto Exit;
@ -166,7 +300,7 @@
/* check the face index */
if ( face_index != 0 )
{
FT_ERROR(( "CID_Init_Face: invalid face index\n" ));
FT_ERROR(( "CID_Face_Init: invalid face index\n" ));
error = CID_Err_Invalid_Argument;
goto Exit;
}
@ -342,7 +476,7 @@
/*************************************************************************/
/* */
/* <Function> */
/* CID_Init_Driver */
/* CID_Driver_Init */
/* */
/* <Description> */
/* Initializes a given CID driver object. */
@ -354,7 +488,7 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF FT_Error
CID_Init_Driver( CID_Driver driver )
CID_Driver_Init( CID_Driver driver )
{
FT_UNUSED( driver );
@ -365,7 +499,7 @@
/*************************************************************************/
/* */
/* <Function> */
/* CID_Done_Driver */
/* CID_Driver_Done */
/* */
/* <Description> */
/* Finalizes a given CID driver. */
@ -374,7 +508,7 @@
/* driver :: A handle to the target CID driver. */
/* */
FT_LOCAL_DEF void
CID_Done_Driver( CID_Driver driver )
CID_Driver_Done( CID_Driver driver )
{
FT_UNUSED( driver );
}

View File

@ -111,22 +111,43 @@ FT_BEGIN_HEADER
} CID_GlyphSlotRec;
FT_LOCAL void
CID_GlyphSlot_Done( CID_GlyphSlot slot );
FT_LOCAL FT_Error
CID_Init_Face( FT_Stream stream,
CID_GlyphSlot_Init( CID_GlyphSlot slot );
FT_LOCAL void
CID_Size_Done( CID_Size size );
FT_LOCAL FT_Error
CID_Size_Init( CID_Size size );
FT_LOCAL FT_Error
CID_Size_Reset( CID_Size size );
FT_LOCAL FT_Error
CID_Face_Init( FT_Stream stream,
CID_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
FT_LOCAL void
CID_Done_Face( CID_Face face );
CID_Face_Done( CID_Face face );
FT_LOCAL FT_Error
CID_Init_Driver( CID_Driver driver );
CID_Driver_Init( CID_Driver driver );
FT_LOCAL void
CID_Done_Driver( CID_Driver driver );
CID_Driver_Done( CID_Driver driver );
FT_END_HEADER

View File

@ -190,7 +190,10 @@
{
/* first of all, the FT_Module_Class fields */
{
ft_module_font_driver | ft_module_driver_scalable,
ft_module_font_driver |
ft_module_driver_scalable |
ft_module_driver_has_hinter ,
sizeof( FT_DriverRec ),
"t1cid", /* module name */
0x10000L, /* version 1.0 of driver */
@ -198,8 +201,8 @@
0,
(FT_Module_Constructor)CID_Init_Driver,
(FT_Module_Destructor) CID_Done_Driver,
(FT_Module_Constructor)CID_Driver_Init,
(FT_Module_Destructor) CID_Driver_Done,
(FT_Module_Requester) CID_Get_Interface
},
@ -208,16 +211,16 @@
sizeof( CID_SizeRec ),
sizeof( CID_GlyphSlotRec ),
(FTDriver_initFace) CID_Init_Face,
(FTDriver_doneFace) CID_Done_Face,
(FTDriver_initFace) CID_Face_Init,
(FTDriver_doneFace) CID_Face_Done,
(FTDriver_initSize) 0,
(FTDriver_doneSize) 0,
(FTDriver_initGlyphSlot)0,
(FTDriver_doneGlyphSlot)0,
(FTDriver_initSize) CID_Size_Init,
(FTDriver_doneSize) CID_Size_Done,
(FTDriver_initGlyphSlot)CID_GlyphSlot_Init,
(FTDriver_doneGlyphSlot)CID_GlyphSlot_Done,
(FTDriver_setCharSizes) 0,
(FTDriver_setPixelSizes)0,
(FTDriver_setCharSizes) CID_Size_Reset,
(FTDriver_setPixelSizes)CID_Size_Reset,
(FTDriver_loadGlyph) CID_Load_Glyph,
(FTDriver_getCharIndex) CID_Get_Char_Index,

View File

@ -241,8 +241,7 @@
if ( size && size->root.metrics.y_ppem < 24 )
glyph->root.outline.flags |= ft_outline_high_precision;
/* XXX: the following needs serious work to work properly with hinting! */
#if 0
#if 1
/* apply the font matrix, if any */
FT_Outline_Transform( &glyph->root.outline, &font_matrix );