From 01c49b8eecca85a96f0688fa4ee3962b0b9c1775 Mon Sep 17 00:00:00 2001 From: Ewald Hew Date: Mon, 5 Jun 2017 13:44:27 +0800 Subject: Warning: Rebased force pushed Move cff_random to psaux --- include/freetype/internal/psaux.h | 4 ++++ src/cff/cffload.c | 18 ++++-------------- src/cff/cffload.h | 3 --- src/psaux/cf2intrp.c | 1 + src/psaux/psauxmod.c | 1 + src/psaux/psobjs.c | 12 ++++++++++++ src/psaux/psobjs.h | 4 ++++ 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index 3f710ae6f..1c19e18c3 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -1066,6 +1066,10 @@ FT_BEGIN_HEADER FT_Offset length, FT_UShort seed ); + FT_UInt32 + (*cff_random)( FT_UInt32 r ); + + T1_CMap_Classes t1_cmap_classes; /* fields after this comment line were added after version 2.1.10 */ diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 3beaeb1c8..2a9fa1955 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1942,18 +1942,6 @@ } - FT_LOCAL_DEF( FT_UInt32 ) - cff_random( FT_UInt32 r ) - { - /* a 32bit version of the `xorshift' algorithm */ - r ^= r << 13; - r ^= r >> 17; - r ^= r << 5; - - return r; - } - - /* There are 3 ways to call this function, distinguished by code. */ /* */ /* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */ @@ -1977,6 +1965,8 @@ CFF_FontRecDict top = &subfont->font_dict; CFF_Private priv = &subfont->private_dict; + PSAux_Service psaux = (PSAux_Service)face->psaux; + FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT || code == CFF2_CODE_FONTDICT ); FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK @@ -2091,7 +2081,7 @@ do { driver->random_seed = - (FT_Int32)cff_random( (FT_UInt32)driver->random_seed ); + (FT_Int32)psaux->cff_random( (FT_UInt32)driver->random_seed ); } while ( driver->random_seed < 0 ); } @@ -2104,7 +2094,7 @@ do { face->root.internal->random_seed = - (FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed ); + (FT_Int32)psaux->cff_random( (FT_UInt32)face->root.internal->random_seed ); } while ( face->root.internal->random_seed < 0 ); } diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 5e35e4327..5914a086b 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -61,9 +61,6 @@ FT_BEGIN_HEADER FT_UInt cid ); - FT_LOCAL( FT_UInt32 ) - cff_random( FT_UInt32 r ); - FT_LOCAL( FT_Error ) cff_font_load( FT_Library library, FT_Stream stream, diff --git a/src/psaux/cf2intrp.c b/src/psaux/cf2intrp.c index 64edd37f5..2b144d5b3 100644 --- a/src/psaux/cf2intrp.c +++ b/src/psaux/cf2intrp.c @@ -47,6 +47,7 @@ #include "cf2intrp.h" #include "cf2error.h" +#include "psobjs.h" /* for cff_random */ /*************************************************************************/ diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c index 9e6a91557..9720cb365 100644 --- a/src/psaux/psauxmod.c +++ b/src/psaux/psauxmod.c @@ -143,6 +143,7 @@ &t1_builder_funcs, &t1_decoder_funcs, t1_decrypt, + cff_random, (const T1_CMap_ClassesRec*) &t1_cmap_classes, diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 2fe55f88a..561b49fbb 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -2045,4 +2045,16 @@ } + FT_LOCAL_DEF( FT_UInt32 ) + cff_random( FT_UInt32 r ) + { + /* a 32bit version of the `xorshift' algorithm */ + r ^= r << 13; + r ^= r >> 17; + r ^= r << 5; + + return r; + } + + /* END */ diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h index c06bb281c..c16379462 100644 --- a/src/psaux/psobjs.h +++ b/src/psaux/psobjs.h @@ -247,6 +247,10 @@ FT_BEGIN_HEADER FT_UShort seed ); + FT_LOCAL( FT_UInt32 ) + cff_random( FT_UInt32 r ); + + FT_END_HEADER #endif /* PSOBJS_H_ */ -- cgit v1.2.1