Move `cff_random' into `psaux' service.
NOTE: Does not compile! Minor fix to allow both `cff' and `psaux' to use `cff_random'. * src/cff/cffload.c (cff_random): Move to... * src/psaux/psobjs.c: Here. * src/cff/cffload.h: Move corresponding declaration to `src/psaux/psobjs.h'. * include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the function here... * src/psaux/psauxmod.c: And here. * src/cff/cffload.c, src/psaux/cf2intrp.c: Update code.
This commit is contained in:
parent
df11628b76
commit
b624868b8e
19
ChangeLog
19
ChangeLog
|
@ -1,3 +1,22 @@
|
||||||
|
2017-09-24 Ewald Hew <ewaldhew@gmail.com>
|
||||||
|
|
||||||
|
[psaux, cff] Move `cff_random' into `psaux' service.
|
||||||
|
|
||||||
|
NOTE: Does not compile!
|
||||||
|
|
||||||
|
Minor fix to allow both `cff' and `psaux' to use `cff_random'.
|
||||||
|
|
||||||
|
* src/cff/cffload.c (cff_random): Move to...
|
||||||
|
* src/psaux/psobjs.c: Here.
|
||||||
|
* src/cff/cffload.h: Move corresponding declaration to
|
||||||
|
`src/psaux/psobjs.h'.
|
||||||
|
|
||||||
|
* include/freetype/internal/psaux.h (PSAux_ServiceRec): Register the
|
||||||
|
function here...
|
||||||
|
* src/psaux/psauxmod.c: And here.
|
||||||
|
|
||||||
|
* src/cff/cffload.c, src/psaux/cf2intrp.c: Update code.
|
||||||
|
|
||||||
2017-09-24 Ewald Hew <ewaldhew@gmail.com>
|
2017-09-24 Ewald Hew <ewaldhew@gmail.com>
|
||||||
|
|
||||||
[cff] Move struct declarations to `freetype/internal'.
|
[cff] Move struct declarations to `freetype/internal'.
|
||||||
|
|
|
@ -1067,6 +1067,10 @@ FT_BEGIN_HEADER
|
||||||
FT_Offset length,
|
FT_Offset length,
|
||||||
FT_UShort seed );
|
FT_UShort seed );
|
||||||
|
|
||||||
|
FT_UInt32
|
||||||
|
(*cff_random)( FT_UInt32 r );
|
||||||
|
|
||||||
|
|
||||||
T1_CMap_Classes t1_cmap_classes;
|
T1_CMap_Classes t1_cmap_classes;
|
||||||
|
|
||||||
/* fields after this comment line were added after version 2.1.10 */
|
/* fields after this comment line were added after version 2.1.10 */
|
||||||
|
|
|
@ -1945,18 +1945,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. */
|
/* 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 */
|
/* . CFF_CODE_TOPDICT for either a CFF Top DICT or a CFF Font DICT */
|
||||||
|
@ -1980,6 +1968,8 @@
|
||||||
CFF_FontRecDict top = &subfont->font_dict;
|
CFF_FontRecDict top = &subfont->font_dict;
|
||||||
CFF_Private priv = &subfont->private_dict;
|
CFF_Private priv = &subfont->private_dict;
|
||||||
|
|
||||||
|
PSAux_Service psaux = (PSAux_Service)face->psaux;
|
||||||
|
|
||||||
FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT ||
|
FT_Bool cff2 = FT_BOOL( code == CFF2_CODE_TOPDICT ||
|
||||||
code == CFF2_CODE_FONTDICT );
|
code == CFF2_CODE_FONTDICT );
|
||||||
FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK
|
FT_UInt stackSize = cff2 ? CFF2_DEFAULT_STACK
|
||||||
|
@ -2094,7 +2084,7 @@
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
driver->random_seed =
|
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 );
|
} while ( driver->random_seed < 0 );
|
||||||
}
|
}
|
||||||
|
@ -2107,7 +2097,7 @@
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
face->root.internal->random_seed =
|
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 );
|
} while ( face->root.internal->random_seed < 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,9 +61,6 @@ FT_BEGIN_HEADER
|
||||||
FT_UInt cid );
|
FT_UInt cid );
|
||||||
|
|
||||||
|
|
||||||
FT_LOCAL( FT_UInt32 )
|
|
||||||
cff_random( FT_UInt32 r );
|
|
||||||
|
|
||||||
FT_LOCAL( FT_Error )
|
FT_LOCAL( FT_Error )
|
||||||
cff_font_load( FT_Library library,
|
cff_font_load( FT_Library library,
|
||||||
FT_Stream stream,
|
FT_Stream stream,
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "cf2intrp.h"
|
#include "cf2intrp.h"
|
||||||
|
|
||||||
#include "cf2error.h"
|
#include "cf2error.h"
|
||||||
|
#include "psobjs.h" /* for cff_random */
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
@ -143,6 +143,7 @@
|
||||||
&t1_builder_funcs,
|
&t1_builder_funcs,
|
||||||
&t1_decoder_funcs,
|
&t1_decoder_funcs,
|
||||||
t1_decrypt,
|
t1_decrypt,
|
||||||
|
cff_random,
|
||||||
|
|
||||||
(const T1_CMap_ClassesRec*) &t1_cmap_classes,
|
(const T1_CMap_ClassesRec*) &t1_cmap_classes,
|
||||||
|
|
||||||
|
|
|
@ -2044,4 +2044,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 */
|
/* END */
|
||||||
|
|
|
@ -247,6 +247,10 @@ FT_BEGIN_HEADER
|
||||||
FT_UShort seed );
|
FT_UShort seed );
|
||||||
|
|
||||||
|
|
||||||
|
FT_LOCAL( FT_UInt32 )
|
||||||
|
cff_random( FT_UInt32 r );
|
||||||
|
|
||||||
|
|
||||||
FT_END_HEADER
|
FT_END_HEADER
|
||||||
|
|
||||||
#endif /* PSOBJS_H_ */
|
#endif /* PSOBJS_H_ */
|
||||||
|
|
Loading…
Reference in New Issue