implemented FT_Select_Charmap and FT_Set_Charmap

(at last :-)
This commit is contained in:
David Turner 2000-05-12 17:09:38 +00:00
parent c91cfe1100
commit 0a29c6979d
2 changed files with 116 additions and 5 deletions

View File

@ -1990,15 +1990,52 @@
/* XXX : Not implemented yet, but should come soon */
#if 0
/*************************************************************************/
/* */
/* <Function> */
/* FT_Select_Charmap */
/* */
/* <Description> */
/* Selects a given charmap by its encoding tag. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* encoding :: handle to the selected charmap */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* This function will return an error if no charmap in the face */
/* corresponds to the encoding queried here */
/* */
EXPORT_DEF(FT_Error) FT_Select_Charmap( FT_Face face,
FT_Encoding encoding );
EXPORT_DEF(FT_Error) FT_Error FT_Set_Charmap( FT_Face face,
FT_CharMap charmap );
#endif
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Charmap */
/* */
/* <Description> */
/* Selects a given charmap for character code to glyph index */
/* decoding. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* charmap :: handle to the selected charmap */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* this function will return an error when the charmap is not part */
/* of the face (i.e. if it is not listed in the face->charmaps[] */
/* table). */
/* */
EXPORT_DEF(FT_Error) FT_Set_Charmap( FT_Face face,
FT_CharMap charmap );
/*************************************************************************/
/* */

View File

@ -1916,6 +1916,80 @@
return error;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Select_Charmap */
/* */
/* <Description> */
/* Selects a given charmap by its encoding tag. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* encoding :: handle to the selected charmap */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* This function will return an error if no charmap in the face */
/* corresponds to the encoding queried here */
/* */
EXPORT_FUNC(FT_Error) FT_Select_Charmap( FT_Face face,
FT_Encoding encoding )
{
FT_CharMap* cur = face->charmaps;
FT_CharMap* limit = cur + face->num_charmaps;
for ( ; cur < limit; cur++ )
{
if ( cur[0]->encoding == encoding )
{
face->charmap = cur[0];
return 0;
}
}
return FT_Err_Invalid_Argument;
}
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Charmap */
/* */
/* <Description> */
/* Selects a given charmap for character code to glyph index */
/* decoding. */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
/* charmap :: handle to the selected charmap */
/* */
/* <Return> */
/* Error code. 0 means success. */
/* */
/* <Note> */
/* this function will return an error when the charmap is not part */
/* of the face (i.e. if it is not listed in the face->charmaps[] */
/* table). */
/* */
EXPORT_FUNC(FT_Error) FT_Set_Charmap( FT_Face face,
FT_CharMap charmap )
{
FT_CharMap* cur = face->charmaps;
FT_CharMap* limit = cur + face->num_charmaps;
for ( ; cur < limit; cur++ )
{
if ( cur[0] == charmap )
{
face->charmap = cur[0];
return 0;
}
}
return FT_Err_Invalid_Argument;
}
/*************************************************************************/
/* */