[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] ewaldhew-wip 863037a 2/7: move t1 subfont synthesis to psaux
From: |
Hew Yih Shiuan Ewald |
Subject: |
[freetype2] ewaldhew-wip 863037a 2/7: move t1 subfont synthesis to psaux svc |
Date: |
Wed, 19 Jul 2017 05:20:57 -0400 (EDT) |
branch: ewaldhew-wip
commit 863037a67b31694f9b42437e2532d5cf44567698
Author: Ewald Hew <address@hidden>
Commit: Ewald Hew <address@hidden>
move t1 subfont synthesis to psaux svc
---
include/freetype/internal/psaux.h | 4 ++
src/psaux/psauxmod.c | 1 +
src/psaux/psobjs.c | 85 +++++++++++++++++++++++++++++++++++++++
src/psaux/psobjs.h | 4 ++
src/type1/t1gload.c | 84 +-------------------------------------
5 files changed, 95 insertions(+), 83 deletions(-)
diff --git a/include/freetype/internal/psaux.h
b/include/freetype/internal/psaux.h
index 947a39c..05fdb98 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -1337,6 +1337,10 @@ FT_BEGIN_HEADER
FT_Bool is_t1,
PS_Decoder* ps_decoder );
+ void
+ (*t1_make_subfont)( T1_Face face,
+ CFF_SubFont subfont );
+
T1_CMap_Classes t1_cmap_classes;
diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c
index 69e70ac..2e7e3d1 100644
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -156,6 +156,7 @@
t1_decrypt,
cff_random,
ps_decoder_init,
+ t1_make_subfont,
(const T1_CMap_ClassesRec*) &t1_cmap_classes,
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index b9f4e16..fd6a0bd 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -2334,6 +2334,91 @@
/*************************************************************************/
/*************************************************************************/
+
+ FT_LOCAL_DEF( void )
+ t1_make_subfont( T1_Face face,
+ CFF_SubFont subfont )
+ {
+ PS_Private priv = &face->type1.private_dict;
+ CFF_Private cpriv = &subfont->private_dict;
+ FT_UInt n, count;
+
+ FT_ZERO( subfont );
+ FT_ZERO( cpriv );
+
+ count = cpriv->num_blue_values = priv->num_blue_values;
+ for ( n = 0; n < count; n++ )
+ cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
+
+ count = cpriv->num_other_blues = priv->num_other_blues;
+ for ( n = 0; n < count; n++ )
+ cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
+
+ count = cpriv->num_family_blues = priv->num_family_blues;
+ for ( n = 0; n < count; n++ )
+ cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
+
+ count = cpriv->num_family_other_blues = priv->num_family_other_blues;
+ for ( n = 0; n < count; n++ )
+ cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n];
+
+ cpriv->blue_scale = priv->blue_scale;
+ cpriv->blue_shift = (FT_Pos)priv->blue_shift;
+ cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz;
+
+ cpriv->standard_width = (FT_Pos)priv->standard_width[0];
+ cpriv->standard_height = (FT_Pos)priv->standard_height[0];
+
+ count = cpriv->num_snap_widths = priv->num_snap_widths;
+ for ( n = 0; n < count; n++ )
+ cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n];
+
+ count = cpriv->num_snap_heights = priv->num_snap_heights;
+ for ( n = 0; n < count; n++ )
+ cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n];
+
+ cpriv->force_bold = priv->force_bold;
+ cpriv->lenIV = priv->lenIV;
+ cpriv->language_group = priv->language_group;
+ cpriv->expansion_factor = priv->expansion_factor;
+
+ cpriv->subfont = subfont;
+
+
+ /* Initialize the random number generator. */
+ if ( face->root.internal->random_seed != -1 )
+ {
+ /* . If we have a face-specific seed, use it. */
+ /* If non-zero, update it to a positive value. */
+ subfont->random = (FT_UInt32)face->root.internal->random_seed;
+ if ( face->root.internal->random_seed )
+ {
+ do
+ {
+ face->root.internal->random_seed =
+ (FT_Int32)((PSAux_Service)face->psaux)->cff_random(
+ (FT_UInt32)face->root.internal->random_seed );
+
+ } while ( face->root.internal->random_seed < 0 );
+ }
+ }
+ if ( !subfont->random )
+ {
+ FT_UInt32 seed;
+
+ /* compute random seed from some memory addresses */
+ seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
+ (FT_Offset)(char*)&face ^
+ (FT_Offset)(char*)&subfont );
+ seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
+ if ( seed == 0 )
+ seed = 0x7384;
+
+ subfont->random = seed;
+ }
+ }
+
+
FT_LOCAL_DEF( void )
t1_decrypt( FT_Byte* buffer,
FT_Offset length,
diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h
index 1f68419..2fed988 100644
--- a/src/psaux/psobjs.h
+++ b/src/psaux/psobjs.h
@@ -285,6 +285,10 @@ FT_BEGIN_HEADER
/*************************************************************************/
FT_LOCAL( void )
+ t1_make_subfont( T1_Face face,
+ CFF_SubFont subfont );
+
+ FT_LOCAL( void )
t1_decrypt( FT_Byte* buffer,
FT_Offset length,
FT_UShort seed );
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 4e4b936..89dbd71 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -39,55 +39,6 @@
#define FT_COMPONENT trace_t1gload
- static void
- t1_make_private_dict( CFF_SubFont subfont,
- PS_Private priv )
- {
- CFF_Private cpriv = &subfont->private_dict;
- FT_UInt n, count;
-
-
- FT_ZERO( cpriv );
-
- count = cpriv->num_blue_values = priv->num_blue_values;
- for ( n = 0; n < count; n++ )
- cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
-
- count = cpriv->num_other_blues = priv->num_other_blues;
- for ( n = 0; n < count; n++ )
- cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
-
- count = cpriv->num_family_blues = priv->num_family_blues;
- for ( n = 0; n < count; n++ )
- cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
-
- count = cpriv->num_family_other_blues = priv->num_family_other_blues;
- for ( n = 0; n < count; n++ )
- cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n];
-
- cpriv->blue_scale = priv->blue_scale;
- cpriv->blue_shift = (FT_Pos)priv->blue_shift;
- cpriv->blue_fuzz = (FT_Pos)priv->blue_fuzz;
-
- cpriv->standard_width = (FT_Pos)priv->standard_width[0];
- cpriv->standard_height = (FT_Pos)priv->standard_height[0];
-
- count = cpriv->num_snap_widths = priv->num_snap_widths;
- for ( n = 0; n < count; n++ )
- cpriv->snap_widths[n] = (FT_Pos)priv->snap_widths[n];
-
- count = cpriv->num_snap_heights = priv->num_snap_heights;
- for ( n = 0; n < count; n++ )
- cpriv->snap_heights[n] = (FT_Pos)priv->snap_heights[n];
-
- cpriv->force_bold = priv->force_bold;
- cpriv->lenIV = priv->lenIV;
- cpriv->language_group = priv->language_group;
- cpriv->expansion_factor = priv->expansion_factor;
-
- cpriv->subfont = subfont;
- }
-
static FT_Error
T1_Parse_Glyph_And_Get_Char_String( T1_Decoder decoder,
FT_UInt glyph_index,
@@ -144,43 +95,10 @@
{
CFF_SubFontRec subfont;
- FT_ZERO( &subfont );
-
- t1_make_private_dict( &subfont, &type1->private_dict );
-
- /* Initialize the random number generator. */
- if ( face->root.internal->random_seed != -1 )
- {
- /* . If we have a face-specific seed, use it. */
- /* If non-zero, update it to a positive value. */
- subfont.random = (FT_UInt32)face->root.internal->random_seed;
- if ( face->root.internal->random_seed )
- {
- do
- {
- face->root.internal->random_seed =
- (FT_Int32)psaux->cff_random(
(FT_UInt32)face->root.internal->random_seed );
-
- } while ( face->root.internal->random_seed < 0 );
- }
- }
- if ( !subfont.random )
- {
- FT_UInt32 seed;
-
- /* compute random seed from some memory addresses */
- seed = (FT_UInt32)( (FT_Offset)(char*)&seed ^
- (FT_Offset)(char*)&decoder ^
- (FT_Offset)(char*)&char_string );
- seed = seed ^ ( seed >> 10 ) ^ ( seed >> 20 );
- if ( seed == 0 )
- seed = 0x7384;
-
- subfont.random = seed;
- }
psaux->ps_decoder_init( decoder, TRUE, &psdecoder );
+ psaux->t1_make_subfont( face, &subfont );
psdecoder.current_subfont = &subfont;
error = decoder_funcs->parse_charstrings( &psdecoder,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] ewaldhew-wip 863037a 2/7: move t1 subfont synthesis to psaux svc,
Hew Yih Shiuan Ewald <=