* include/freetype/ftcache.h, src/cache/ftccmap.c:

modify FTC_CMapCache_Lookup to accept a negative cmap index
    to mean "use default cached FT_Face's charmap". This fixes
    Savannah issue #22625
This commit is contained in:
David Turner 2008-09-02 02:34:29 +00:00
parent f47d263f1b
commit 17cd687266
3 changed files with 21 additions and 3 deletions

View File

@ -1,5 +1,10 @@
2008-09-01 david turner <david@freetype.org>
* include/freetype/ftcache.h, src/cache/ftccmap.c:
modify FTC_CMapCache_Lookup to accept a negative cmap index
to mean "use default cached FT_Face's charmap". This fixes
Savannah issue #22625
* include/freetype/ftoption.h, include/freetype/ftconfig.h,
builds/unix/ftconfig.in, include/freetype/freetype.h,
src/base/ftcalc.c:

View File

@ -610,6 +610,7 @@ FT_BEGIN_HEADER
*
* cmap_index ::
* The index of the charmap in the source face.
* Any negative value means to use the cache FT_Face's default charmap.
*
* char_code ::
* The character code (in the corresponding charmap).

18
src/cache/ftccmap.c vendored
View File

@ -288,7 +288,19 @@
FT_Error error;
FT_UInt gindex = 0;
FT_UInt32 hash;
FT_Int no_cmap_change = 0;
if (cmap_index < 0)
{
/* treat a negative cmap index as a special value that
* means you don't want to change the FT_Face's character
* map through this call. this can be useful when the
* face requester callback already set the face's charmap
* to the appropriate value.
*/
no_cmap_change = 1;
cmap_index = 0;
}
if ( !cache )
{
@ -311,7 +323,7 @@
* Adobe Acrobat Reader Pack, named `KozMinProVI-Regular.otf',
* which contains more than 5 charmaps.
*/
if ( cmap_index >= 16 )
if ( cmap_index >= 16 && !no_cmap_change )
{
FTC_OldCMapDesc desc = (FTC_OldCMapDesc) face_id;
@ -393,12 +405,12 @@
old = face->charmap;
cmap = face->charmaps[cmap_index];
if ( old != cmap )
if ( old != cmap && !no_cmap_change )
FT_Set_Charmap( face, cmap );
gindex = FT_Get_Char_Index( face, char_code );
if ( old != cmap )
if ( old != cmap && !no_cmap_change )
FT_Set_Charmap( face, old );
}