2158 {
2160 {
2161#undef FT_STRUCTURE
2162#define FT_STRUCTURE CFF_FontRec
2163
2169 };
2170
2177
2178
2181
2182 dict = &
font->top_font.font_dict;
2184
2189 font->base_offset = base_offset;
2190
2191
2194
2195 if ( cff2 )
2196 {
2197 if (
font->version_major != 2 ||
2198 font->header_size < 5 )
2199 {
2200 FT_TRACE2((
" not a CFF2 font header\n" ));
2203 }
2204
2207 }
2208 else
2209 {
2211
2212
2215
2216 if (
font->version_major != 1 ||
2217 font->header_size < 4 ||
2218 absolute_offset > 4 )
2219 {
2220 FT_TRACE2((
" not a CFF font header\n" ));
2223 }
2224 }
2225
2226
2228 {
2229
2230
2231
2232 if ( pure_cff )
2233 {
2236 }
2238 }
2239
2240 if ( cff2 )
2241 {
2242
2243
2244
2245
2246
2247
2249
2251 font->font_dict_index.data_size =
font->top_dict_length;
2252
2253
2256
2257
2261 }
2262 else
2263 {
2264
2267 {
2268 if ( pure_cff )
2269 {
2272 }
2274 }
2275
2276
2277
2278 if (
font->name_index.count > 1 &&
2279 font->name_index.data_size <
font->name_index.count )
2280 {
2281
2282
2286 }
2287
2297 &
font->string_pool_size ) ) )
2299
2300
2301 if (
font->name_index.count >
font->font_dict_index.count )
2302 {
2304 " not enough entries in Top DICT index\n" ));
2307 }
2308 }
2309
2311
2312 if ( pure_cff )
2313 {
2314
2315 subfont_index = (
FT_UInt)( face_index & 0xFFFF );
2316
2317 if ( face_index > 0 && subfont_index >=
font->name_index.count )
2318 {
2320 " invalid subfont index for pure CFF font (%d)\n",
2321 subfont_index ));
2324 }
2325
2326 font->num_faces =
font->name_index.count;
2327 }
2328 else
2329 {
2330 subfont_index = 0;
2331
2332 if (
font->name_index.count > 1 )
2333 {
2335 " invalid CFF font with multiple subfonts\n"
2336 " "
2337 " in SFNT wrapper\n" ));
2340 }
2341 }
2342
2343
2344 if ( face_index < 0 )
2346
2347
2350 &
font->font_dict_index,
2351 subfont_index,
2353 base_offset,
2359
2362
2366
2367
2369 cff2 )
2370 {
2374
2375
2376
2377
2380 base_offset,
2384
2385
2386
2389
2393
2394
2395
2397 {
2398 FT_TRACE0((
"cff_font_load: FD array too large in CID font\n" ));
2399 goto Fail_CID;
2400 }
2401
2402
2403 font->num_subfonts = fd_index.count;
2405 goto Fail_CID;
2406
2407
2408 for (
idx = 0;
idx < fd_index.count;
idx++ )
2410
2411
2413 {
2417 &fd_index,
2420 base_offset,
2426 goto Fail_CID;
2427 }
2428
2429
2430
2431 if ( !cff2 || fd_index.count > 1 )
2433 font->charstrings_index.count,
2436
2437 Fail_CID:
2439
2442 }
2443 else
2444 font->num_subfonts = 0;
2445
2446
2448 {
2449 FT_ERROR((
"cff_font_load: no charstrings offset\n" ));
2452 }
2453
2454 font->num_glyphs =
font->charstrings_index.count;
2455
2458
2461
2462
2463 if ( !cff2 &&
font->num_glyphs > 0 )
2464 {
2466
2467
2472
2473
2475 {
2480 base_offset,
2484 }
2485 }
2486
2487
2488
2490
2493
2495 }
static FT_Error cff_charset_load(CFF_Charset charset, FT_UInt num_glyphs, FT_Stream stream, FT_ULong base_offset, FT_ULong offset, FT_Bool invert)
static FT_Error cff_encoding_load(CFF_Encoding encoding, CFF_Charset charset, FT_UInt num_glyphs, FT_Stream stream, FT_ULong base_offset, FT_ULong offset)
static FT_Error cff_subfont_load(CFF_SubFont subfont, CFF_Index idx, FT_UInt font_index, FT_Stream stream, FT_ULong base_offset, FT_UInt code, CFF_Font font, CFF_Face face)
static FT_Error cff_index_init(CFF_Index idx, FT_Stream stream, FT_Bool load, FT_Bool cff2)
static FT_Error CFF_Load_FD_Select(CFF_FDSelect fdselect, FT_UInt num_glyphs, FT_Stream stream, FT_ULong offset)
static FT_Error cff_vstore_load(CFF_VStoreRec *vstore, FT_Stream stream, FT_ULong base_offset, FT_ULong offset)
cff_index_get_name(CFF_Font font, FT_UInt element)
static FT_Error cff_index_get_pointers(CFF_Index idx, FT_Byte ***table, FT_Byte **pool, FT_ULong *pool_size)
#define CFF2_CODE_FONTDICT
#define CFF2_CODE_TOPDICT
FT_BEGIN_HEADER struct CFF_IndexRec_ CFF_IndexRec
#define CFF_MAX_CID_FONTS
#define FT_TRACE0(varformat)
#define FT_ERROR(varformat)
#define FT_TRACE2(varformat)
#define FT_NEW_ARRAY(ptr, count)
#define FT_SET_ERROR(expression)
#define FT_READ_USHORT(var)
#define FT_STREAM_SEEK(position)
#define FT_READ_BYTE(var)
#define FT_STREAM_READ_FIELDS(fields, object)
#define FT_STREAM_SKIP(distance)
#define FT_FRAME_START(size)
FT_BEGIN_HEADER typedef unsigned char FT_Bool
GLenum GLuint GLint GLenum face
FT_ULong cid_fd_array_offset
FT_ULong cid_fd_select_offset
FT_ULong charstrings_offset