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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
diff --git a/ChangeLog b/ChangeLog
index 386b6c9..45fba7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
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>
+
[cff] Move struct declarations to `freetype/internal'.
NOTE: Does not compile!
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index f127a44..258009b 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -1067,6 +1067,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 1242038..5e6839d 100644
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -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. */
/* */
/* . 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_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
@@ -2094,7 +2084,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 );
}
@@ -2107,7 +2097,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 82a0417..ef3c1bd 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 3e7ad57..605b468 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 cd9f525..a880881 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 db268fc..92691db 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -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 */
diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h
index c06bb28..c163794 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_ */