Prepare for Type 1 mode. Add some checks for Type 1 data passing through. * src/psaux/psfont.h (CF2_Font): Add `isT1' flag. * src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend code which is not applicable for Type 1. * src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing `decoder->cff' in Type 1 mode. Copy `is_t1' flag to `CF2_Font'.
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 a215fa4..1264e38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2017-09-25 Ewald Hew <ewaldhew@gmail.com>
+ [psaux] Prepare for Type 1 mode.
+
+ Add some checks for Type 1 data passing through.
+
+ * src/psaux/psfont.h (CF2_Font): Add `isT1' flag.
+ * src/psaux/psfont.c (cf2_font_setup): Skip the variations and blend
+ code which is not applicable for Type 1.
+
+ * src/psaux/psft.c (cf2_decoder_parse_charstrings): Avoid accessing
+ `decoder->cff' in Type 1 mode.
+ Copy `is_t1' flag to `CF2_Font'.
+
+2017-09-25 Ewald Hew <ewaldhew@gmail.com>
+
[psaux, cff] Use the new objects.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c: Fix
diff --git a/src/psaux/psfont.c b/src/psaux/psfont.c
index bdcc356..093e66e 100644
--- a/src/psaux/psfont.c
+++ b/src/psaux/psfont.c
@@ -260,8 +260,6 @@
CF2_UInt lenNormalizedV = 0;
FT_Fixed* normalizedV = NULL;
- FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload;
-
/* clear previous error */
font->error = FT_Err_Ok;
@@ -274,46 +272,50 @@
needExtraSetup = TRUE;
}
- /* check for variation vectors */
- vstore = cf2_getVStore( decoder );
- hasVariations = ( vstore->dataCount != 0 );
-
- if ( hasVariations )
+ if ( !font->isT1 )
{
-#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- /* check whether Private DICT in this subfont needs to be reparsed */
- font->error = cf2_getNormalizedVector( decoder,
- &lenNormalizedV,
- &normalizedV );
- if ( font->error )
- return;
+ FT_Service_CFFLoad cffload = (FT_Service_CFFLoad)font->cffload;
+ /* check for variation vectors */
+ vstore = cf2_getVStore( decoder );
+ hasVariations = ( vstore->dataCount != 0 );
- if ( cffload->blend_check_vector( &subFont->blend,
- subFont->private_dict.vsindex,
- lenNormalizedV,
- normalizedV ) )
+ if ( hasVariations )
{
- /* blend has changed, reparse */
- cffload->load_private_dict( decoder->cff,
- subFont,
- lenNormalizedV,
- normalizedV );
- needExtraSetup = TRUE;
- }
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+ /* check whether Private DICT in this subfont needs to be reparsed */
+ font->error = cf2_getNormalizedVector( decoder,
+ &lenNormalizedV,
+ &normalizedV );
+ if ( font->error )
+ return;
+
+ if ( cffload->blend_check_vector( &subFont->blend,
+ subFont->private_dict.vsindex,
+ lenNormalizedV,
+ normalizedV ) )
+ {
+ /* blend has changed, reparse */
+ cffload->load_private_dict( decoder->cff,
+ subFont,
+ lenNormalizedV,
+ normalizedV );
+ needExtraSetup = TRUE;
+ }
#endif
- /* copy from subfont */
- font->blend.font = subFont->blend.font;
+ /* copy from subfont */
+ font->blend.font = subFont->blend.font;
- /* clear state of charstring blend */
- font->blend.usedBV = FALSE;
+ /* clear state of charstring blend */
+ font->blend.usedBV = FALSE;
- /* initialize value for charstring */
- font->vsindex = subFont->private_dict.vsindex;
+ /* initialize value for charstring */
+ font->vsindex = subFont->private_dict.vsindex;
- /* store vector inputs for blends in charstring */
- font->lenNDV = lenNormalizedV;
- font->NDV = normalizedV;
+ /* store vector inputs for blends in charstring */
+ font->lenNDV = lenNormalizedV;
+ font->NDV = normalizedV;
+ }
}
/* if ppem has changed, we need to recompute some cached data */
diff --git a/src/psaux/psfont.h b/src/psaux/psfont.h
index f88b131..fc86f80 100644
--- a/src/psaux/psfont.h
+++ b/src/psaux/psfont.h
@@ -65,6 +65,7 @@ FT_BEGIN_HEADER
FT_Memory memory;
FT_Error error; /* shared error for this instance */
+ FT_Bool isT1;
FT_Bool isCFF2;
CF2_RenderingFlags renderingFlags;
diff --git a/src/psaux/psft.c b/src/psaux/psft.c
index a05f1f2..34ac0b6 100644
--- a/src/psaux/psft.c
+++ b/src/psaux/psft.c
@@ -309,8 +309,11 @@
FT_Error error = FT_Err_Ok;
CF2_Font font;
+ FT_Bool is_t1 = decoder->builder.is_t1;
- FT_ASSERT( decoder && decoder->cff );
+
+ FT_ASSERT( decoder &&
+ ( is_t1 || decoder->cff ) );
memory = decoder->builder.memory;
@@ -330,7 +333,9 @@
font = (CF2_Font)decoder->cff->cf2_instance.data;
font->memory = memory;
- font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload;
+
+ if ( !is_t1 )
+ font->cffload = (FT_Service_CFFLoad)decoder->cff->cffload;
/* initialize a client outline, to be shared by each glyph rendered */
cf2_outline_init( &font->outline, font->memory, &font->error );
@@ -381,6 +386,7 @@
/* copy isCFF2 boolean from TT_Face to CF2_Font */
font->isCFF2 = builder->face->is_cff2;
+ font->isT1 = is_t1;
font->renderingFlags = 0;
if ( hinted )