1 /***************************************************************************/ |
1 /**************************************************************************** |
2 /* */ |
2 * |
3 /* cffload.c */ |
3 * cffload.c |
4 /* */ |
4 * |
5 /* OpenType and CFF data/program tables loader (body). */ |
5 * OpenType and CFF data/program tables loader (body). |
6 /* */ |
6 * |
7 /* Copyright 1996-2018 by */ |
7 * Copyright (C) 1996-2019 by |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
8 * David Turner, Robert Wilhelm, and Werner Lemberg. |
9 /* */ |
9 * |
10 /* This file is part of the FreeType project, and may only be used, */ |
10 * This file is part of the FreeType project, and may only be used, |
11 /* modified, and distributed under the terms of the FreeType project */ |
11 * modified, and distributed under the terms of the FreeType project |
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
12 * license, LICENSE.TXT. By continuing to use, modify, or distribute |
13 /* this file you indicate that you have read the license and */ |
13 * this file you indicate that you have read the license and |
14 /* understand and accept it fully. */ |
14 * understand and accept it fully. |
15 /* */ |
15 * |
16 /***************************************************************************/ |
16 */ |
17 |
17 |
18 |
18 |
19 #include <ft2build.h> |
19 #include <ft2build.h> |
20 #include FT_INTERNAL_DEBUG_H |
20 #include FT_INTERNAL_DEBUG_H |
21 #include FT_INTERNAL_OBJECTS_H |
21 #include FT_INTERNAL_OBJECTS_H |
194 return (FT_UShort)( charcode < 256 ? cff_standard_encoding[charcode] |
194 return (FT_UShort)( charcode < 256 ? cff_standard_encoding[charcode] |
195 : 0 ); |
195 : 0 ); |
196 } |
196 } |
197 |
197 |
198 |
198 |
199 /*************************************************************************/ |
199 /************************************************************************** |
200 /* */ |
200 * |
201 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
201 * The macro FT_COMPONENT is used in trace mode. It is an implicit |
202 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
202 * parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log |
203 /* messages during execution. */ |
203 * messages during execution. |
204 /* */ |
204 */ |
205 #undef FT_COMPONENT |
205 #undef FT_COMPONENT |
206 #define FT_COMPONENT trace_cffload |
206 #define FT_COMPONENT cffload |
207 |
207 |
208 |
208 |
209 /* read an offset from the index's stream current position */ |
209 /* read an offset from the index's stream current position */ |
210 static FT_ULong |
210 static FT_ULong |
211 cff_index_read_offset( CFF_Index idx, |
211 cff_index_read_offset( CFF_Index idx, |
1396 CFF_VStore vs; |
1396 CFF_VStore vs; |
1397 CFF_VarData* varData; |
1397 CFF_VarData* varData; |
1398 FT_UInt master; |
1398 FT_UInt master; |
1399 |
1399 |
1400 |
1400 |
1401 FT_ASSERT( lenNDV == 0 || NDV ); |
1401 /* protect against malformed fonts */ |
|
1402 if ( !( lenNDV == 0 || NDV ) ) |
|
1403 { |
|
1404 FT_TRACE4(( " cff_blend_build_vector:" |
|
1405 " Malformed Normalize Design Vector data\n" )); |
|
1406 error = FT_THROW( Invalid_File_Format ); |
|
1407 goto Exit; |
|
1408 } |
1402 |
1409 |
1403 blend->builtBV = FALSE; |
1410 blend->builtBV = FALSE; |
1404 |
1411 |
1405 vs = &blend->font->vstore; |
1412 vs = &blend->font->vstore; |
1406 |
1413 |
2078 if ( !cff2 ) |
2085 if ( !cff2 ) |
2079 { |
2086 { |
2080 /* |
2087 /* |
2081 * Initialize the random number generator. |
2088 * Initialize the random number generator. |
2082 * |
2089 * |
2083 * . If we have a face-specific seed, use it. |
2090 * - If we have a face-specific seed, use it. |
2084 * If non-zero, update it to a positive value. |
2091 * If non-zero, update it to a positive value. |
2085 * |
2092 * |
2086 * . Otherwise, use the seed from the CFF driver. |
2093 * - Otherwise, use the seed from the CFF driver. |
2087 * If non-zero, update it to a positive value. |
2094 * If non-zero, update it to a positive value. |
2088 * |
2095 * |
2089 * . If the random value is zero, use the seed given by the subfont's |
2096 * - If the random value is zero, use the seed given by the subfont's |
2090 * `initialRandomSeed' value. |
2097 * `initialRandomSeed' value. |
2091 * |
2098 * |
2092 */ |
2099 */ |
2093 if ( face->root.internal->random_seed == -1 ) |
2100 if ( face->root.internal->random_seed == -1 ) |
2094 { |
2101 { |