[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master dff40d0 2/3: Add T1_CONFIG_OPTION_OLD_ENGINE configur
From: |
Hew Yih Shiuan Ewald |
Subject: |
[freetype2] master dff40d0 2/3: Add T1_CONFIG_OPTION_OLD_ENGINE configuration option. |
Date: |
Thu, 12 Oct 2017 06:34:14 -0400 (EDT) |
branch: master
commit dff40d03dff05734b8bf026716b780688f89e830
Author: Ewald Hew <address@hidden>
Commit: Ewald Hew <address@hidden>
Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.
This controls whether the old Type 1 engine gets compiled into FreeType.
It is disabled by default.
* devel/ftoption.h, include/freetype/config/ftoption.h
(T1_CONFIG_OPTION_OLD_ENGINE): New macro.
* include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
* include/freetype/internal/psaux.h, src/cid/cidgload.c
(cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
(ps_builder_add_point), src/psaux/t1decode.c
(t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
relevant code with macro.
Minor code changes.
---
ChangeLog | 20 ++++++++++++++++++++
devel/ftoption.h | 10 ++++++++++
include/freetype/config/ftoption.h | 10 ++++++++++
include/freetype/internal/psaux.h | 6 +++---
src/cid/cidgload.c | 5 ++++-
src/psaux/psauxmod.c | 3 +++
src/psaux/psobjs.c | 7 ++++++-
src/psaux/t1decode.c | 21 +++++++++++++--------
src/psaux/t1decode.h | 3 +++
src/type1/t1gload.c | 8 ++++++--
10 files changed, 78 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e973ff8..3a35eed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,25 @@
2017-10-12 Ewald Hew <address@hidden>
+ Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.
+
+ This controls whether the old Type 1 engine gets compiled into FreeType.
+ It is disabled by default.
+
+ * devel/ftoption.h, include/freetype/config/ftoption.h
+ (T1_CONFIG_OPTION_OLD_ENGINE): New macro.
+
+ * include/freetype/internal/psaux.h (PS_Decoder): Remove unused field.
+ * include/freetype/internal/psaux.h, src/cid/cidgload.c
+ (cid_load_glyph), src/psaux/psauxmod.c, src/psaux/psobjs.c
+ (ps_builder_add_point), src/psaux/t1decode.c
+ (t1_lookup_glyph_by_stdcharcode, t1_decoder_parse_glyph,
+ t1operator_seac, t1_decoder_parse_charstrings), src/psaux/t1decode.h,
+ src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Surround
+ relevant code with macro.
+ Minor code changes.
+
+2017-10-12 Ewald Hew <address@hidden>
+
Extract width parsing from Type 1 parser.
Duplicate the fast advance width calculations from the old parser.
diff --git a/devel/ftoption.h b/devel/ftoption.h
index 11a2d1f..fadda13 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -745,6 +745,16 @@ FT_BEGIN_HEADER
/*************************************************************************/
+ /* */
+ /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */
+ /* engine gets compiled into FreeType. If defined, it is possible to */
+ /* switch between the two engines using the `hinting-engine' property of */
+ /* the type1 driver module. */
+ /* */
+/* #define T1_CONFIG_OPTION_OLD_ENGINE */
+
+
+ /*************************************************************************/
/*************************************************************************/
/**** ****/
/**** C F F D R I V E R C O N F I G U R A T I O N ****/
diff --git a/include/freetype/config/ftoption.h
b/include/freetype/config/ftoption.h
index 10b9c64..3d5e5a4 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -754,6 +754,16 @@ FT_BEGIN_HEADER
/*************************************************************************/
+ /* */
+ /* T1_CONFIG_OPTION_OLD_ENGINE controls whether the pre-Adobe Type 1 */
+ /* engine gets compiled into FreeType. If defined, it is possible to */
+ /* switch between the two engines using the `hinting-engine' property of */
+ /* the type1 driver module. */
+ /* */
+/* #define T1_CONFIG_OPTION_OLD_ENGINE */
+
+
+ /*************************************************************************/
/*************************************************************************/
/**** ****/
/**** C F F D R I V E R C O N F I G U R A T I O N ****/
diff --git a/include/freetype/internal/psaux.h
b/include/freetype/internal/psaux.h
index 96b2f1f..26652f8 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -655,8 +655,6 @@ FT_BEGIN_HEADER
FT_Long* buildchar;
FT_UInt len_buildchar;
- void* t1_parse_callback;
-
} PS_Decoder;
@@ -874,15 +872,17 @@ FT_BEGIN_HEADER
void
(*done)( T1_Decoder decoder );
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
FT_Error
(*parse_charstrings_old)( T1_Decoder decoder,
FT_Byte* base,
FT_UInt len );
-
+#else
FT_Error
(*parse_metrics)( T1_Decoder decoder,
FT_Byte* base,
FT_UInt len );
+#endif
FT_Error
(*parse_charstrings)( PS_Decoder* decoder,
diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
index 82be440..086e889 100644
--- a/src/cid/cidgload.c
+++ b/src/cid/cidgload.c
@@ -176,6 +176,7 @@
psaux->t1_decrypt( charstring, glyph_length, 4330 );
/* choose which renderer to use */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
if ( ( (PS_Driver)FT_FACE_DRIVER( face ) )->hinting_engine ==
FT_T1_HINTING_FREETYPE ||
decoder->builder.metrics_only )
@@ -183,11 +184,13 @@
decoder,
charstring + cs_offset,
glyph_length - cs_offset );
- else if ( decoder->builder.metrics_only )
+#else
+ if ( decoder->builder.metrics_only )
error = psaux->t1_decoder_funcs->parse_metrics(
decoder,
charstring + cs_offset,
glyph_length - cs_offset );
+#endif
else
{
PS_Decoder psdecoder;
diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c
index 16e887d..52f9e99 100644
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -89,8 +89,11 @@
{
t1_decoder_init, /* init */
t1_decoder_done, /* done */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
t1_decoder_parse_charstrings, /* parse_charstrings_old */
+#else
t1_decoder_parse_metrics, /* parse_metrics */
+#endif
cf2_decoder_parse_charstrings /* parse_charstrings */
};
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index 7244205..a88bcb7 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -2164,10 +2164,10 @@
FT_Vector* point = outline->points + outline->n_points;
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
+#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
if ( !builder->is_t1 &&
driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
{
@@ -2176,6 +2176,10 @@
}
else
#endif
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
+#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
+ PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( builder->face );
+#endif
if ( builder->is_t1 &&
driver->hinting_engine == FT_T1_HINTING_FREETYPE )
{
@@ -2183,6 +2187,7 @@
point->y = FIXED_TO_INT( y );
}
else
+#endif
{
/* cf2_decoder_parse_charstrings uses 16.16 coordinates */
point->x = x >> 10;
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 61d2462..03183c8 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -158,6 +158,7 @@
}
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
/*************************************************************************/
/* */
/* <Function> */
@@ -207,6 +208,15 @@
}
+ /* parse a single Type 1 glyph */
+ FT_LOCAL_DEF( FT_Error )
+ t1_decoder_parse_glyph( T1_Decoder decoder,
+ FT_UInt glyph )
+ {
+ return decoder->parse_callback( decoder, glyph );
+ }
+
+
/*************************************************************************/
/* */
/* <Function> */
@@ -1628,6 +1638,8 @@
return FT_THROW( Stack_Underflow );
}
+#else /* T1_CONFIG_OPTION_OLD_ENGINE */
+
/*************************************************************************/
/* */
/* <Function> */
@@ -1905,14 +1917,7 @@
Stack_Underflow:
return FT_THROW( Stack_Underflow );
}
-
- /* parse a single Type 1 glyph */
- FT_LOCAL_DEF( FT_Error )
- t1_decoder_parse_glyph( T1_Decoder decoder,
- FT_UInt glyph )
- {
- return decoder->parse_callback( decoder, glyph );
- }
+#endif /* T1_CONFIG_OPTION_OLD_ENGINE */
/* initialize T1 decoder */
diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h
index 420d120..879f8f9 100644
--- a/src/psaux/t1decode.h
+++ b/src/psaux/t1decode.h
@@ -35,6 +35,7 @@ FT_BEGIN_HEADER
t1_lookup_glyph_by_stdcharcode_ps( PS_Decoder* decoder,
FT_Int charcode );
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
FT_LOCAL( FT_Error )
t1_decoder_parse_glyph( T1_Decoder decoder,
FT_UInt glyph_index );
@@ -43,10 +44,12 @@ FT_BEGIN_HEADER
t1_decoder_parse_charstrings( T1_Decoder decoder,
FT_Byte* base,
FT_UInt len );
+#else
FT_LOCAL( FT_Error )
t1_decoder_parse_metrics( T1_Decoder decoder,
FT_Byte* charstring_base,
FT_UInt charstring_len );
+#endif
FT_LOCAL( FT_Error )
t1_decoder_init( T1_Decoder decoder,
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 53f89b2..e50d7a5 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -58,8 +58,9 @@
face->root.internal->incremental_interface;
#endif
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
-
+#endif
decoder->font_matrix = type1->font_matrix;
decoder->font_offset = type1->font_offset;
@@ -84,17 +85,20 @@
if ( !error )
{
/* choose which renderer to use */
+#ifdef T1_CONFIG_OPTION_OLD_ENGINE
if ( driver->hinting_engine == FT_T1_HINTING_FREETYPE ||
decoder->builder.metrics_only )
error = decoder_funcs->parse_charstrings_old(
decoder,
(FT_Byte*)char_string->pointer,
(FT_UInt)char_string->length );
- else if ( decoder->builder.metrics_only )
+#else
+ if ( decoder->builder.metrics_only )
error = decoder_funcs->parse_metrics(
decoder,
(FT_Byte*)char_string->pointer,
(FT_UInt)char_string->length );
+#endif
else
{
CFF_SubFontRec subfont;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master dff40d0 2/3: Add T1_CONFIG_OPTION_OLD_ENGINE configuration option.,
Hew Yih Shiuan Ewald <=