2189 {
2191 {
2192#undef FT_STRUCTURE
2193#define FT_STRUCTURE CFF_FontRec
2194
2200 };
2201
2208
2209
2212
2213 dict = &
font->top_font.font_dict;
2215
2220 font->base_offset = base_offset;
2221
2222
2225
2226 if ( cff2 )
2227 {
2228 if (
font->version_major != 2 ||
2229 font->header_size < 5 )
2230 {
2231 FT_TRACE2((
" not a CFF2 font header\n" ));
2234 }
2235
2238 }
2239 else
2240 {
2242
2243
2246
2247 if (
font->version_major != 1 ||
2248 font->header_size < 4 ||
2249 absolute_offset > 4 )
2250 {
2251 FT_TRACE2((
" not a CFF font header\n" ));
2254 }
2255 }
2256
2257
2259 {
2260
2261
2262
2263 if ( pure_cff )
2264 {
2267 }
2269 }
2270
2271 if ( cff2 )
2272 {
2273
2274
2275
2276
2277
2278
2280
2282 font->font_dict_index.data_size =
font->top_dict_length;
2283
2284
2287
2288
2292 }
2293 else
2294 {
2295
2298 {
2299 if ( pure_cff )
2300 {
2303 }
2305 }
2306
2307
2308
2309 if (
font->name_index.count > 1 &&
2310 font->name_index.data_size <
font->name_index.count )
2311 {
2312
2313
2317 }
2318
2328 &
font->string_pool_size ) ) )
2330
2331
2332 if (
font->name_index.count >
font->font_dict_index.count )
2333 {
2335 " not enough entries in Top DICT index\n" ));
2338 }
2339 }
2340
2342
2343 if ( pure_cff )
2344 {
2345
2346 subfont_index = (
FT_UInt)( face_index & 0xFFFF );
2347
2348 if ( face_index > 0 && subfont_index >=
font->name_index.count )
2349 {
2351 " invalid subfont index for pure CFF font (%d)\n",
2352 subfont_index ));
2355 }
2356
2357 font->num_faces =
font->name_index.count;
2358 }
2359 else
2360 {
2361 subfont_index = 0;
2362
2363 if (
font->name_index.count > 1 )
2364 {
2366 " invalid CFF font with multiple subfonts\n"
2367 " "
2368 " in SFNT wrapper\n" ));
2371 }
2372 }
2373
2374
2375 if ( face_index < 0 )
2377
2378
2381 &
font->font_dict_index,
2382 subfont_index,
2384 base_offset,
2390
2393
2397
2398
2400 cff2 )
2401 {
2405
2406
2407
2408
2411 base_offset,
2415
2416
2417
2420
2424
2425
2426
2428 {
2429 FT_TRACE0((
"cff_font_load: FD array too large in CID font\n" ));
2430 goto Fail_CID;
2431 }
2432
2433
2434 font->num_subfonts = fd_index.count;
2436 goto Fail_CID;
2437
2438
2439 for (
idx = 0;
idx < fd_index.count;
idx++ )
2441
2442
2444 {
2448 &fd_index,
2451 base_offset,
2457 goto Fail_CID;
2458 }
2459
2460
2461
2462 if ( !cff2 || fd_index.count > 1 )
2464 font->charstrings_index.count,
2467
2468 Fail_CID:
2470
2473 }
2474 else
2475 font->num_subfonts = 0;
2476
2477
2479 {
2480 FT_ERROR((
"cff_font_load: no charstrings offset\n" ));
2483 }
2484
2485 font->num_glyphs =
font->charstrings_index.count;
2486
2489
2492
2493
2494 if ( !cff2 &&
font->num_glyphs > 0 )
2495 {
2497
2498
2503
2504
2506 {
2511 base_offset,
2515 }
2516 }
2517
2518
2519
2521
2524
2526 }
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