这篇教程C++ FT_ERROR函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FT_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_ERROR函数的具体用法?C++ FT_ERROR怎么用?C++ FT_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FT_ERROR函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: FT_Stream_EnterFrame FT_Stream_EnterFrame( FT_Stream stream, FT_ULong count ) { FT_Error error = FT_Err_Ok; FT_ULong read_bytes; /* check for nested frame access */ FT_ASSERT( stream && stream->cursor == 0 ); if ( stream->read ) { /* allocate the frame in memory */ FT_Memory memory = stream->memory;#ifdef FT_DEBUG_MEMORY /* assume _ft_debug_file and _ft_debug_lineno are already set */ stream->base = (unsigned char*)ft_mem_qalloc( memory, count, &error ); if ( error ) goto Exit;#else if ( FT_QALLOC( stream->base, count ) ) goto Exit;#endif /* read it */ read_bytes = stream->read( stream, stream->pos, stream->base, count ); if ( read_bytes < count ) { FT_ERROR(( "FT_Stream_EnterFrame:" )); FT_ERROR(( " invalid read; expected %lu bytes, got %lu/n", count, read_bytes )); FT_FREE( stream->base ); error = FT_Err_Invalid_Stream_Operation; } stream->cursor = stream->base; stream->limit = stream->cursor + count; stream->pos += read_bytes; } else { /* check current and new position */ if ( stream->pos >= stream->size || stream->pos + count > stream->size ) { FT_ERROR(( "FT_Stream_EnterFrame:" )); FT_ERROR(( " invalid i/o; pos = 0x%lx, count = %lu, size = 0x%lx/n", stream->pos, count, stream->size )); error = FT_Err_Invalid_Stream_Operation; goto Exit; } /* set cursor */ stream->cursor = stream->base + stream->pos; stream->limit = stream->cursor + count; stream->pos += count; } Exit: return error; }
开发者ID:sloopdoom,项目名称:ftgles-gles2,代码行数:63,
示例2: ftc_snode_load /* * This function tries to load a small bitmap within a given FTC_SNode. * Note that it returns a non-zero error code _only_ in the case of * out-of-memory condition. For all other errors (e.g., corresponding * to a bad font file), this function will mark the sbit as `unavailable' * and return a value of 0. * * You should also read the comment within the @ftc_snode_compare * function below to see how out-of-memory is handled during a lookup. */ static FT_Error ftc_snode_load( FTC_SNode snode, FTC_Manager manager, FT_UInt gindex, FT_ULong *asize ) { FT_Error error; FTC_GNode gnode = FTC_GNODE( snode ); FTC_Family family = gnode->family; FT_Memory memory = manager->memory; FT_Face face; FTC_SBit sbit; FTC_SFamilyClass clazz; if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count ) { FT_ERROR(( "ftc_snode_load: invalid glyph index" )); return FTC_Err_Invalid_Argument; } sbit = snode->sbits + ( gindex - gnode->gindex ); clazz = (FTC_SFamilyClass)family->clazz; sbit->buffer = 0; error = clazz->family_load_glyph( family, gindex, manager, &face ); if ( error ) goto BadGlyph; { FT_Int temp; FT_GlyphSlot slot = face->glyph; FT_Bitmap* bitmap = &slot->bitmap; FT_Int xadvance, yadvance; if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) { FT_ERROR(( "%s: glyph loaded didn't return a bitmap!/n", "ftc_snode_load" )); goto BadGlyph; } /* Check that our values fit into 8-bit containers! */ /* If this is not the case, our bitmap is too large */ /* and we will leave it as `missing' with sbit.buffer = 0 */#define CHECK_CHAR( d ) ( temp = (FT_Char)d, temp == d )#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, temp == d ) /* horizontal advance in pixels */ xadvance = ( slot->advance.x + 32 ) >> 6; yadvance = ( slot->advance.y + 32 ) >> 6; if ( !CHECK_BYTE( bitmap->rows ) || !CHECK_BYTE( bitmap->width ) || !CHECK_CHAR( bitmap->pitch ) || !CHECK_CHAR( slot->bitmap_left ) || !CHECK_CHAR( slot->bitmap_top ) || !CHECK_CHAR( xadvance ) || !CHECK_CHAR( yadvance ) ) goto BadGlyph; sbit->width = (FT_Byte)bitmap->width; sbit->height = (FT_Byte)bitmap->rows; sbit->pitch = (FT_Char)bitmap->pitch; sbit->left = (FT_Char)slot->bitmap_left; sbit->top = (FT_Char)slot->bitmap_top; sbit->xadvance = (FT_Char)xadvance; sbit->yadvance = (FT_Char)yadvance; sbit->format = (FT_Byte)bitmap->pixel_mode; sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1); /* copy the bitmap into a new buffer -- ignore error */ error = ftc_sbit_copy_bitmap( sbit, bitmap, memory ); /* now, compute size */ if ( asize ) *asize = FT_ABS( sbit->pitch ) * sbit->height; } /* glyph loading successful */ /* ignore the errors that might have occurred -- */ /* we mark unloaded glyphs with `sbit.buffer == 0' */ /* and `width == 255', `height == 0' */ /* */ if ( error && error != FTC_Err_Out_Of_Memory ) { BadGlyph://.........这里部分代码省略.........
开发者ID:0uyangsheng,项目名称:xbmc,代码行数:101,
示例3: t42_parse_encoding static void t42_parse_encoding( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; FT_Byte* cur; FT_Byte* limit = parser->root.limit; PSAux_Service psaux = (PSAux_Service)face->psaux; T1_Skip_Spaces( parser ); cur = parser->root.cursor; if ( cur >= limit ) { FT_ERROR(( "t42_parse_encoding: out of bounds/n" )); parser->root.error = FT_THROW( Invalid_File_Format ); return; } /* if we have a number or `[', the encoding is an array, */ /* and we must load it now */ if ( ft_isdigit( *cur ) || *cur == '[' ) { T1_Encoding encode = &face->type1.encoding; FT_Int count, n; PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; FT_Error error; FT_Bool only_immediates = 0; /* read the number of entries in the encoding; should be 256 */ if ( *cur == '[' ) { count = 256; only_immediates = 1; parser->root.cursor++; } else count = (FT_Int)T1_ToInt( parser ); T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit ) return; /* we use a T1_Table to store our charnames */ loader->num_chars = encode->num_chars = count; if ( FT_NEW_ARRAY( encode->char_index, count ) || FT_NEW_ARRAY( encode->char_name, count ) || FT_SET_ERROR( psaux->ps_table_funcs->init( char_table, count, memory ) ) ) { parser->root.error = error; return; } /* We need to `zero' out encoding_table.elements */ for ( n = 0; n < count; n++ ) { char* notdef = (char *)".notdef"; (void)T1_Add_Table( char_table, n, notdef, 8 ); } /* Now we need to read records of the form */ /* */ /* ... charcode /charname ... */ /* */ /* for each entry in our table. */ /* */ /* We simply look for a number followed by an immediate */ /* name. Note that this ignores correctly the sequence */ /* that is often seen in type42 fonts: */ /* */ /* 0 1 255 { 1 index exch /.notdef put } for dup */ /* */ /* used to clean the encoding array before anything else. */ /* */ /* Alternatively, if the array is directly given as */ /* */ /* /Encoding [ ... ] */ /* */ /* we only read immediates. */ n = 0; T1_Skip_Spaces( parser ); while ( parser->root.cursor < limit ) { cur = parser->root.cursor; /* we stop when we encounter `def' or `]' */ if ( *cur == 'd' && cur + 3 < limit ) { if ( cur[1] == 'e' && cur[2] == 'f' && t42_is_space( cur[3] ) ) {//.........这里部分代码省略.........
开发者ID:theqvd,项目名称:vcxsrv,代码行数:101,
示例4: t42_parse_charstrings static void t42_parse_charstrings( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; PS_Table code_table = &loader->charstrings; PS_Table name_table = &loader->glyph_names; PS_Table swap_table = &loader->swap_table; FT_Memory memory = parser->root.memory; FT_Error error; PSAux_Service psaux = (PSAux_Service)face->psaux; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_Int n; FT_Int notdef_index = 0; FT_Byte notdef_found = 0; T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit ) { FT_ERROR(( "t42_parse_charstrings: out of bounds/n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( ft_isdigit( *parser->root.cursor ) ) { loader->num_glyphs = T1_ToInt( parser ); if ( parser->root.error ) return; if ( loader->num_glyphs < 0 ) { FT_ERROR(( "t42_parse_encoding: invalid number of glyphs/n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } } else if ( *parser->root.cursor == '<' ) { /* We have `<< ... >>'. Count the number of `/' in the dictionary */ /* to get its size. */ FT_Int count = 0; T1_Skip_PS_Token( parser ); if ( parser->root.error ) return; T1_Skip_Spaces( parser ); cur = parser->root.cursor; while ( parser->root.cursor < limit ) { if ( *parser->root.cursor == '/' ) count++; else if ( *parser->root.cursor == '>' ) { loader->num_glyphs = count; parser->root.cursor = cur; /* rewind */ break; } T1_Skip_PS_Token( parser ); if ( parser->root.error ) return; T1_Skip_Spaces( parser ); } } else { FT_ERROR(( "t42_parse_charstrings: invalid token/n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( parser->root.cursor >= limit ) { FT_ERROR(( "t42_parse_charstrings: out of bounds/n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* initialize tables */ error = psaux->ps_table_funcs->init( code_table, loader->num_glyphs, memory ); if ( error ) goto Fail; error = psaux->ps_table_funcs->init( name_table, loader->num_glyphs, memory ); if ( error ) goto Fail; /* Initialize table for swapping index notdef_index and */ /* index 0 names and codes (if necessary). *///.........这里部分代码省略.........
开发者ID:theqvd,项目名称:vcxsrv,代码行数:101,
示例5: cid_load_keyword static FT_Error cid_load_keyword( CID_Face face, CID_Loader* loader, const T1_Field keyword ) { FT_Error error; CID_Parser* parser = &loader->parser; FT_Byte* object; void* dummy_object; CID_FaceInfo cid = &face->cid; /* if the keyword has a dedicated callback, call it */ if ( keyword->type == T1_FIELD_TYPE_CALLBACK ) { keyword->reader( (FT_Face)face, parser ); error = parser->root.error; goto Exit; } /* we must now compute the address of our target object */ switch ( keyword->location ) { case T1_FIELD_LOCATION_CID_INFO: object = (FT_Byte*)cid; break; case T1_FIELD_LOCATION_FONT_INFO: object = (FT_Byte*)&cid->font_info; break; case T1_FIELD_LOCATION_FONT_EXTRA: object = (FT_Byte*)&face->font_extra; break; case T1_FIELD_LOCATION_BBOX: object = (FT_Byte*)&cid->font_bbox; break; default: { CID_FaceDict dict; if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts ) { FT_ERROR(( "cid_load_keyword: invalid use of `%s'/n", keyword->ident )); error = FT_THROW( Syntax_Error ); goto Exit; } dict = cid->font_dicts + parser->num_dict; switch ( keyword->location ) { case T1_FIELD_LOCATION_PRIVATE: object = (FT_Byte*)&dict->private_dict; break; default: object = (FT_Byte*)dict; } } } dummy_object = object; /* now, load the keyword data in the object's field(s) */ if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY || keyword->type == T1_FIELD_TYPE_FIXED_ARRAY ) error = cid_parser_load_field_table( &loader->parser, keyword, &dummy_object ); else error = cid_parser_load_field( &loader->parser, keyword, &dummy_object ); Exit: return error; }
开发者ID:antoineL,项目名称:freetype2,代码行数:78,
示例6: FT_Stream_Open FT_Stream_Open( FT_Stream stream, const char* filepathname ) { int file; struct stat stat_buf; if ( !stream ) return FT_Err_Invalid_Stream_Handle; /* open the file */ file = open( filepathname, O_RDONLY ); if ( file < 0 ) { FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not open `%s'/n", filepathname )); return FT_Err_Cannot_Open_Resource; } /* Here we ensure that a "fork" will _not_ duplicate */ /* our opened input streams on Unix. This is critical */ /* since it avoids some (possible) access control */ /* issues and cleans up the kernel file table a bit. */ /* */#ifdef F_SETFD#ifdef FD_CLOEXEC (void)fcntl( file, F_SETFD, FD_CLOEXEC );#else (void)fcntl( file, F_SETFD, 1 );#endif /* FD_CLOEXEC */#endif /* F_SETFD */ if ( fstat( file, &stat_buf ) < 0 ) { FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not `fstat' file `%s'/n", filepathname )); goto Fail_Map; } /* XXX: TODO -- real 64bit platform support */ /* */ /* `stream->size' is typedef'd to unsigned long (in */ /* freetype/ftsystem.h); `stat_buf.st_size', however, is usually */ /* typedef'd to off_t (in sys/stat.h). */ /* On some platforms, the former is 32bit and the latter is 64bit. */ /* To avoid overflow caused by fonts in huge files larger than */ /* 2GB, do a test. Temporary fix proposed by Sean McBride. */ /* */ if ( stat_buf.st_size > LONG_MAX ) { FT_ERROR(( "FT_Stream_Open: file is too big" )); goto Fail_Map; } else if ( stat_buf.st_size == 0 ) { FT_ERROR(( "FT_Stream_Open: zero-length file" )); goto Fail_Map; } /* This cast potentially truncates a 64bit to 32bit! */ stream->size = (unsigned long)stat_buf.st_size; stream->pos = 0; stream->base = (unsigned char *)mmap( NULL, stream->size, PROT_READ, MAP_FILE | MAP_PRIVATE, file, 0 ); /* on some RTOS, mmap might return 0 */ if ( (long)stream->base != -1 && stream->base != NULL ) stream->close = ft_close_stream_by_munmap; else { ssize_t total_read_count; FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not `mmap' file `%s'/n", filepathname )); stream->base = (unsigned char*)ft_alloc( NULL, stream->size ); if ( !stream->base ) { FT_ERROR(( "FT_Stream_Open:" )); FT_ERROR(( " could not `alloc' memory/n" )); goto Fail_Map; } total_read_count = 0; do { ssize_t read_count; read_count = read( file, stream->base + total_read_count, stream->size - total_read_count ); if ( read_count <= 0 ) {//.........这里部分代码省略.........
开发者ID:guozanhua,项目名称:OgreKit,代码行数:101,
示例7: sprintfint vrpn_Tracker_Isotrak::get_report(void){ char errmsg[512]; // Error message to send to VRPN int ret; // Return value from function call to be checked // The first byte of a binary record has the high order bit set if (status == vrpn_TRACKER_SYNCING) { // Try to get a character. If none, just return. if (vrpn_read_available_characters(serial_fd, buffer, 1) != 1) { return 0; } // The first byte of a record has the high order bit set if(!(buffer[0] & 0x80)) { sprintf(errmsg,"While syncing (looking for byte with high order bit set, " "got '%x')", buffer[0]); FT_WARNING(errmsg); vrpn_flush_input_buffer(serial_fd); return 0; } // Got the first byte of a report -- go into TRACKER_PARTIAL mode // and record that we got one character at this time. bufcount = 1; vrpn_gettimeofday(×tamp, NULL); status = vrpn_TRACKER_PARTIAL; } //-------------------------------------------------------------------- // Read as many bytes of this report as we can, storing them // in the buffer. We keep track of how many have been read so far // and only try to read the rest. The routine that calls this one // makes sure we get a full reading often enough (ie, it is responsible // for doing the watchdog timing to make sure the tracker hasn't simply // stopped sending characters). //-------------------------------------------------------------------- ret = vrpn_read_available_characters(serial_fd, &buffer[bufcount], BINARY_RECORD_SIZE - bufcount); if (ret == -1) { FT_ERROR("Error reading report"); status = vrpn_TRACKER_FAIL; return 0; } bufcount += ret; if (bufcount < BINARY_RECORD_SIZE) { // Not done -- go back for more return 0; } // We now have enough characters for a full report // Check it to ensure we do not have a high bit set other // than on the first byte for(int i=1; i<BINARY_RECORD_SIZE; i++) { if (buffer[i] & 0x80) { status = vrpn_TRACKER_SYNCING; sprintf(errmsg,"Unexpected sync character in record"); FT_WARNING(errmsg); //FT_WARNING("Not '0' in record, re-syncing"); vrpn_flush_input_buffer(serial_fd); return 0; } } // Create a buffer for the decoded message unsigned char decoded[BINARY_RECORD_SIZE]; int d = 0; int fullgroups = BINARY_RECORD_SIZE / 8; // The following decodes the Isotrak binary format. It consists of // 7 byte values plus an extra byte of the high bit for these // 7 bytes. First, loop over the 7 byte ranges (8 bytes in binary) int i; for(i = 0; i<fullgroups; i++) { vrpn_uint8 *group = &buffer[i * 8]; vrpn_uint8 high = buffer[i * 8 + 7]; for(int j=0; j<7; j++) { decoded[d] = *group++; if(high & 1) decoded[d] |= 0x80; d++; high >>= 1; } } // We'll have X bytes left at the end int left = BINARY_RECORD_SIZE - fullgroups * 8; vrpn_uint8 *group = &buffer[fullgroups * 8]; vrpn_uint8 high = buffer[fullgroups * 8 + left - 1];//.........这里部分代码省略.........
开发者ID:jeraldamo,项目名称:vrpn_ovr,代码行数:101,
示例8: polledvoid vrpn_Tracker_Isotrak::reset(){ static int numResets = 0; // How many resets have we tried? int i,resetLen,ret; unsigned char reset[10]; char errmsg[512]; //-------------------------------------------------------------------- // This section deals with resetting the tracker to its default state. // Multiple attempts are made to reset, getting more aggressive each // time. This section completes when the tracker reports a valid status // message after the reset has completed. //-------------------------------------------------------------------- // Send the tracker a string that should reset it. The first time we // try this, just do the normal 'c' command to put it into polled mode. // After a few tries with this, use a [return] character, and then use the ^Y to reset. resetLen = 0; numResets++; // We're trying another reset if (numResets > 1) { // Try to get it out of a query loop if its in one reset[resetLen++] = (unsigned char) (13); // Return key -> get ready } if (numResets > 2) { reset[resetLen++] = (unsigned char) (25); // Ctrl + Y -> reset the tracker } reset[resetLen++] = 'c'; // Put it into polled (not continuous) mode sprintf(errmsg, "Resetting the tracker (attempt %d)", numResets); FT_WARNING(errmsg); for (i = 0; i < resetLen; i++) { if (vrpn_write_characters(serial_fd, &reset[i], 1) == 1) { fprintf(stderr,"."); vrpn_SleepMsecs(1000.0*2); // Wait after each character to give it time to respond } else { perror("Isotrack: Failed writing to tracker"); status = vrpn_TRACKER_FAIL; return; } } //XXX Take out the sleep and make it keep spinning quickly if (numResets > 2) { vrpn_SleepMsecs(1000.0*20); // Sleep to let the reset happen, if we're doing ^Y } fprintf(stderr,"/n"); // Get rid of the characters left over from before the reset vrpn_flush_input_buffer(serial_fd); // Make sure that the tracker has stopped sending characters vrpn_SleepMsecs(1000.0*2); unsigned char scrap[80]; if ( (ret = vrpn_read_available_characters(serial_fd, scrap, 80)) != 0) { sprintf(errmsg,"Got >=%d characters after reset",ret); FT_WARNING(errmsg); for (i = 0; i < ret; i++) { if (isprint(scrap[i])) { fprintf(stderr,"%c",scrap[i]); } else { fprintf(stderr,"[0x%02X]",scrap[i]); } } fprintf(stderr, "/n"); vrpn_flush_input_buffer(serial_fd); // Flush what's left } // Asking for tracker status if (vrpn_write_characters(serial_fd, (const unsigned char *) "S", 1) == 1) { vrpn_SleepMsecs(1000.0*1); // Sleep for a second to let it respond } else { perror(" Isotrack write failed"); status = vrpn_TRACKER_FAIL; return; } // Read Status unsigned char statusmsg[22]; // Attempt to read 21 characters. ret = vrpn_read_available_characters(serial_fd, statusmsg, 21); if ( (ret != 21) ) { fprintf(stderr, " Got %d of 21 characters for status/n",ret); FT_ERROR("Bad status report from Isotrack, retrying reset"); return; } else if ( (statusmsg[0]!='2') ) { int i; statusmsg[sizeof(statusmsg) - 1] = '/0'; // Null-terminate the string fprintf(stderr, " Isotrack: bad status ("); for (i = 0; i < ret; i++) { if (isprint(statusmsg[i])) {//.........这里部分代码省略.........
开发者ID:jeraldamo,项目名称:vrpn_ovr,代码行数:101,
示例9: cid_parser_new//.........这里部分代码省略......... FT_TRACE2(( "cid_parser_new: no `StartData' keyword found/n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } FT_MEM_MOVE( buffer, buffer + read_offset + read_len - STARTDATA_LEN, STARTDATA_LEN ); /* values for the next loop */ read_len = 256; read_offset = STARTDATA_LEN; p = buffer + read_offset; } } Found: /* We have found the start of the binary data or the `/sfnts' token. */ /* Now rewind and extract the frame corresponding to this PostScript */ /* section. */ ps_len = offset - base_offset; if ( FT_STREAM_SEEK( base_offset ) || FT_FRAME_EXTRACT( ps_len, parser->postscript ) ) goto Exit; parser->data_offset = offset; parser->postscript_len = ps_len; parser->root.base = parser->postscript; parser->root.cursor = parser->postscript; parser->root.limit = parser->root.cursor + ps_len; parser->num_dict = -1; /* Finally, we check whether `StartData' or `/sfnts' was real -- */ /* it could be in a comment or string. We also get the arguments */ /* of `StartData' to find out whether the data is represented in */ /* binary or hex format. */ arg1 = parser->root.cursor; cid_parser_skip_PS_token( parser ); cid_parser_skip_spaces ( parser ); arg2 = parser->root.cursor; cid_parser_skip_PS_token( parser ); cid_parser_skip_spaces ( parser ); limit = parser->root.limit; cur = parser->root.cursor; while ( cur <= limit - SFNTS_LEN ) { if ( parser->root.error ) { error = parser->root.error; goto Exit; } if ( cur[0] == 'S' && cur <= limit - STARTDATA_LEN && ft_strncmp( (char*)cur, STARTDATA, STARTDATA_LEN ) == 0 ) { if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 ) { FT_Long tmp = ft_strtol( (const char *)arg2, NULL, 10 ); if ( tmp < 0 ) { FT_ERROR(( "cid_parser_new: invalid length of hex data/n" )); error = FT_THROW( Invalid_File_Format ); } else parser->binary_length = (FT_ULong)tmp; } goto Exit; } else if ( cur[1] == 's' && ft_strncmp( (char*)cur, SFNTS, SFNTS_LEN ) == 0 ) { FT_TRACE2(( "cid_parser_new: cannot handle Type 11 fonts/n" )); error = FT_THROW( Unknown_File_Format ); goto Exit; } cid_parser_skip_PS_token( parser ); cid_parser_skip_spaces ( parser ); arg1 = arg2; arg2 = cur; cur = parser->root.cursor; } /* we haven't found the correct `StartData'; go back and continue */ /* searching */ FT_FRAME_RELEASE( parser->postscript ); if ( !FT_STREAM_SEEK( offset ) ) goto Again; Exit: return error; }
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:101,
示例10: cff_face_init cff_face_init( FT_Stream stream, FT_Face cffface, /* CFF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { CFF_Face face = (CFF_Face)cffface; FT_Error error; SFNT_Service sfnt; FT_Service_PsCMaps psnames; PSHinter_Service pshinter; FT_Bool pure_cff = 1; FT_Bool sfnt_format = 0; FT_Library library = cffface->driver->root.library; sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) { FT_ERROR(( "cff_face_init: cannot access `sfnt' module/n" )); error = FT_THROW( Missing_Module ); goto Exit; } FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); pshinter = (PSHinter_Service)FT_Get_Module_Interface( library, "pshinter" ); FT_TRACE2(( "CFF driver/n" )); /* create input stream from resource */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; /* check whether we have a valid OpenType file */ error = sfnt->init_face( stream, face, face_index, num_params, params ); if ( !error ) { if ( face->format_tag != TTAG_OTTO ) /* `OTTO'; OpenType/CFF font */ { FT_TRACE2(( " not an OpenType/CFF font/n" )); error = FT_THROW( Unknown_File_Format ); goto Exit; } /* if we are performing a simple font format check, exit immediately */ if ( face_index < 0 ) return FT_Err_Ok; sfnt_format = 1; /* now, the font can be either an OpenType/CFF font, or an SVG CEF */ /* font; in the latter case it doesn't have a `head' table */ error = face->goto_table( face, TTAG_head, stream, 0 ); if ( !error ) { pure_cff = 0; /* load font directory */ error = sfnt->load_face( stream, face, face_index, num_params, params ); if ( error ) goto Exit; } else { /* load the `cmap' table explicitly */ error = sfnt->load_cmap( face, stream ); if ( error ) goto Exit; } /* now load the CFF part of the file */ error = face->goto_table( face, TTAG_CFF, stream, 0 ); if ( error ) goto Exit; } else { /* rewind to start of file; we are going to load a pure-CFF font */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; error = FT_Err_Ok; } /* now load and parse the CFF table in the file */ { CFF_Font cff = NULL; CFF_FontRecDict dict; FT_Memory memory = cffface->memory; FT_Int32 flags; FT_UInt i; if ( FT_NEW( cff ) ) goto Exit; face->extra.data = cff;//.........这里部分代码省略.........
开发者ID:ONLYOFFICE,项目名称:core,代码行数:101,
示例11: cff_encoding_load//.........这里部分代码省略......... /* Read the number of codes in the range. */ if ( FT_READ_BYTE( nleft ) ) goto Exit; /* Increment nleft, so we read `nleft + 1' codes/sids. */ nleft++; /* compute max number of character codes */ if ( (FT_UInt)nleft > encoding->count ) encoding->count = nleft; /* Fill in the range of codes/sids. */ for ( k = i; k < nleft + i; k++, glyph_code++ ) { /* Make sure k is not too big. */ if ( k < num_glyphs && glyph_code < 256 ) { /* Assign code to GID mapping. */ encoding->codes[glyph_code] = (FT_UShort)k; /* Assign code to SID mapping. */ encoding->sids[glyph_code] = charset->sids[k]; } } } /* simple check; one never knows what can be found in a font */ if ( encoding->count > 256 ) encoding->count = 256; } break; default: FT_ERROR(( "cff_encoding_load: invalid table format!/n" )); error = CFF_Err_Invalid_File_Format; goto Exit; } /* Parse supplemental encodings, if any. */ if ( encoding->format & 0x80 ) { FT_UInt gindex; /* count supplements */ if ( FT_READ_BYTE( count ) ) goto Exit; for ( j = 0; j < count; j++ ) { /* Read supplemental glyph code. */ if ( FT_READ_BYTE( glyph_code ) ) goto Exit; /* Read the SID associated with this glyph code. */ if ( FT_READ_USHORT( glyph_sid ) ) goto Exit; /* Assign code to SID mapping. */ encoding->sids[glyph_code] = glyph_sid; /* First, look up GID which has been assigned to */ /* SID glyph_sid. */ for ( gindex = 0; gindex < num_glyphs; gindex++ ) { if ( charset->sids[gindex] == glyph_sid )
开发者ID:4nakin,项目名称:Aquaria_clean,代码行数:67,
示例12: cff_charset_load 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 ) { FT_Memory memory = stream->memory; FT_Error error = CFF_Err_Ok; FT_UShort glyph_sid; /* If the the offset is greater than 2, we have to parse the */ /* charset table. */ if ( offset > 2 ) { FT_UInt j; charset->offset = base_offset + offset; /* Get the format of the table. */ if ( FT_STREAM_SEEK( charset->offset ) || FT_READ_BYTE( charset->format ) ) goto Exit; /* Allocate memory for sids. */ if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) ) goto Exit; /* assign the .notdef glyph */ charset->sids[0] = 0; switch ( charset->format ) { case 0: if ( num_glyphs > 0 ) { if ( FT_FRAME_ENTER( ( num_glyphs - 1 ) * 2 ) ) goto Exit; for ( j = 1; j < num_glyphs; j++ ) charset->sids[j] = FT_GET_USHORT(); FT_FRAME_EXIT(); } break; case 1: case 2: { FT_UInt nleft; FT_UInt i; j = 1; while ( j < num_glyphs ) { /* Read the first glyph sid of the range. */ if ( FT_READ_USHORT( glyph_sid ) ) goto Exit; /* Read the number of glyphs in the range. */ if ( charset->format == 2 ) { if ( FT_READ_USHORT( nleft ) ) goto Exit; } else { if ( FT_READ_BYTE( nleft ) ) goto Exit; } /* Fill in the range of sids -- `nleft + 1' glyphs. */ for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ ) charset->sids[j] = glyph_sid; } } break; default: FT_ERROR(( "cff_charset_load: invalid table format!/n" )); error = CFF_Err_Invalid_File_Format; goto Exit; } } else { /* Parse default tables corresponding to offset == 0, 1, or 2. */ /* CFF specification intimates the following: */ /* */ /* In order to use a predefined charset, the following must be */ /* true: The charset constructed for the glyphs in the font's */ /* charstrings dictionary must match the predefined charset in */ /* the first num_glyphs. */ charset->offset = offset; /* record charset type *///.........这里部分代码省略.........
开发者ID:4nakin,项目名称:Aquaria_clean,代码行数:101,
示例13: cff_font_load cff_font_load( FT_Stream stream, FT_Int face_index, CFF_Font font, FT_Bool pure_cff ) { static const FT_Frame_Field cff_header_fields[] = {#undef FT_STRUCTURE#define FT_STRUCTURE CFF_FontRec FT_FRAME_START( 4 ), FT_FRAME_BYTE( version_major ), FT_FRAME_BYTE( version_minor ), FT_FRAME_BYTE( header_size ), FT_FRAME_BYTE( absolute_offsize ), FT_FRAME_END }; FT_Error error; FT_Memory memory = stream->memory; FT_ULong base_offset; CFF_FontRecDict dict; FT_ZERO( font ); font->stream = stream; font->memory = memory; dict = &font->top_font.font_dict; base_offset = FT_STREAM_POS(); /* read CFF font header */ if ( FT_STREAM_READ_FIELDS( cff_header_fields, font ) ) goto Exit; /* check format */ if ( font->version_major != 1 || font->header_size < 4 || font->absolute_offsize > 4 ) { FT_TRACE2(( "[not a CFF font header!]/n" )); error = CFF_Err_Unknown_File_Format; goto Exit; } /* skip the rest of the header */ if ( FT_STREAM_SKIP( font->header_size - 4 ) ) goto Exit; /* read the name, top dict, string and global subrs index */ if ( FT_SET_ERROR( cff_index_init( &font->name_index, stream, 0 ) ) || FT_SET_ERROR( cff_index_init( &font->font_dict_index, stream, 0 ) ) || FT_SET_ERROR( cff_index_init( &font->string_index, stream, 0 ) ) || FT_SET_ERROR( cff_index_init( &font->global_subrs_index, stream, 1 ) ) ) goto Exit; /* well, we don't really forget the `disabled' fonts... */ font->num_faces = font->name_index.count; if ( face_index >= (FT_Int)font->num_faces ) { FT_ERROR(( "cff_font_load: incorrect face index = %d/n", face_index )); error = CFF_Err_Invalid_Argument; } /* in case of a font format check, simply exit now */ if ( face_index < 0 ) goto Exit; /* now, parse the top-level font dictionary */ error = cff_subfont_load( &font->top_font, &font->font_dict_index, face_index, stream, base_offset ); if ( error ) goto Exit; if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) ) goto Exit; error = cff_index_init( &font->charstrings_index, stream, 0 ); if ( error ) goto Exit; /* now, check for a CID font */ if ( dict->cid_registry != 0xFFFFU ) { CFF_IndexRec fd_index; CFF_SubFont sub; FT_UInt idx; /* this is a CID-keyed font, we must now allocate a table of */ /* sub-fonts, then load each of them separately */ if ( FT_STREAM_SEEK( base_offset + dict->cid_fd_array_offset ) )//.........这里部分代码省略.........
开发者ID:4nakin,项目名称:Aquaria_clean,代码行数:101,
示例14: T1_Get_Private_Dict T1_Get_Private_Dict( T1_Parser parser, PSAux_Service psaux ) { FT_Stream stream = parser->stream; FT_Memory memory = parser->root.memory; FT_Error error = T1_Err_Ok; FT_Long size; if ( parser->in_pfb ) { /* in the case of the PFB format, the private dictionary can be */ /* made of several segments. We thus first read the number of */ /* segments to compute the total size of the private dictionary */ /* then re-read them into memory. */ FT_Long start_pos = FT_STREAM_POS(); FT_UShort tag; parser->private_len = 0; for (;;) { error = read_pfb_tag( stream, &tag, &size ); if ( error ) goto Fail; if ( tag != 0x8002U ) break; parser->private_len += size; if ( FT_STREAM_SKIP( size ) ) goto Fail; } /* Check that we have a private dictionary there */ /* and allocate private dictionary buffer */ if ( parser->private_len == 0 ) { FT_ERROR(( "T1_Get_Private_Dict:" )); FT_ERROR(( " invalid private dictionary section/n" )); error = T1_Err_Invalid_File_Format; goto Fail; } if ( FT_STREAM_SEEK( start_pos ) || FT_ALLOC( parser->private_dict, parser->private_len ) ) goto Fail; parser->private_len = 0; for (;;) { error = read_pfb_tag( stream, &tag, &size ); if ( error || tag != 0x8002U ) { error = T1_Err_Ok; break; } if ( FT_STREAM_READ( parser->private_dict + parser->private_len, size ) ) goto Fail; parser->private_len += size; } } else { /* We have already `loaded' the whole PFA font file into memory; */ /* if this is a memory resource, allocate a new block to hold */ /* the private dict. Otherwise, simply overwrite into the base */ /* dictionary block in the heap. */ /* first of all, look at the `eexec' keyword */ FT_Byte* cur = parser->base_dict; FT_Byte* limit = cur + parser->base_len; FT_Byte c; Again: for (;;) { c = cur[0]; if ( c == 'e' && cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */ /* newline + 4 chars */ { if ( cur[1] == 'e' && cur[2] == 'x' && cur[3] == 'e' && cur[4] == 'c' ) break; } cur++; if ( cur >= limit ) { FT_ERROR(( "T1_Get_Private_Dict:" )); FT_ERROR(( " could not find `eexec' keyword/n" )); error = T1_Err_Invalid_File_Format; goto Exit; }//.........这里部分代码省略.........
开发者ID:Bracket-,项目名称:psp-ports,代码行数:101,
示例15: tt_face_load_kern tt_face_load_kern( TT_Face face, FT_Stream stream ) { FT_Error error; FT_ULong table_size; FT_Byte* p; FT_Byte* p_limit; FT_UInt nn, num_tables; FT_UInt32 avail = 0, ordered = 0; /* the kern table is optional; exit silently if it is missing */ error = face->goto_table( face, TTAG_kern, stream, &table_size ); if ( error ) goto Exit; if ( table_size < 4 ) /* the case of a malformed table */ { FT_ERROR(( "tt_face_load_kern:" " kerning table is too small - ignored/n" )); error = FT_THROW( Table_Missing ); goto Exit; } if ( FT_FRAME_EXTRACT( table_size, face->kern_table ) ) { FT_ERROR(( "tt_face_load_kern:" " could not extract kerning table/n" )); goto Exit; } face->kern_table_size = table_size; p = face->kern_table; p_limit = p + table_size; p += 2; /* skip version */ num_tables = FT_NEXT_USHORT( p ); if ( num_tables > 32 ) /* we only support up to 32 sub-tables */ num_tables = 32; for ( nn = 0; nn < num_tables; nn++ ) { FT_UInt num_pairs, length, coverage, format; FT_Byte* p_next; FT_UInt32 mask = (FT_UInt32)1UL << nn; if ( p + 6 > p_limit ) break; p_next = p; p += 2; /* skip version */ length = FT_NEXT_USHORT( p ); coverage = FT_NEXT_USHORT( p ); if ( length <= 6 + 8 ) break; p_next += length; if ( p_next > p_limit ) /* handle broken table */ p_next = p_limit; format = coverage >> 8; /* we currently only support format 0 kerning tables */ if ( format != 0 ) goto NextTable; /* only use horizontal kerning tables */ if ( ( coverage & 3U ) != 0x0001 || p + 8 > p_next ) goto NextTable; num_pairs = FT_NEXT_USHORT( p ); p += 6; if ( ( p_next - p ) < 6 * (int)num_pairs ) /* handle broken count */ num_pairs = (FT_UInt)( ( p_next - p ) / 6 ); avail |= mask; /* * Now check whether the pairs in this table are ordered. * We then can use binary search. */ if ( num_pairs > 0 ) { FT_ULong count; FT_ULong old_pair; old_pair = FT_NEXT_ULONG( p ); p += 2; for ( count = num_pairs - 1; count > 0; count-- ) {//.........这里部分代码省略.........
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:101,
示例16: T1_Face_Init T1_Face_Init( FT_Stream stream, T1_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { FT_Error error; FT_Service_PsCMaps psnames; PSAux_Service psaux; T1_Font type1 = &face->type1; PS_FontInfo info = &type1->font_info; FT_UNUSED( num_params ); FT_UNUSED( params ); FT_UNUSED( stream ); face->root.num_faces = 1; FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); face->psnames = psnames; face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "psaux" ); psaux = (PSAux_Service)face->psaux; face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" ); /* open the tokenizer; this will also check the font format */ error = T1_Open_Face( face ); if ( error ) goto Exit; /* if we just wanted to check the format, leave successfully now */ if ( face_index < 0 ) goto Exit; /* check the face index */ if ( face_index > 0 ) { FT_ERROR(( "T1_Face_Init: invalid face index/n" )); error = T1_Err_Invalid_Argument; goto Exit; } /* now load the font program into the face object */ /* initialize the face object fields */ /* set up root face fields */ { FT_Face root = (FT_Face)&face->root; root->num_glyphs = type1->num_glyphs; root->face_index = 0; root->face_flags = FT_FACE_FLAG_SCALABLE | FT_FACE_FLAG_HORIZONTAL | FT_FACE_FLAG_GLYPH_NAMES | FT_FACE_FLAG_HINTER; if ( info->is_fixed_pitch ) root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; if ( face->blend ) root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS; /* XXX: TODO -- add kerning with .afm support */ /* The following code to extract the family and the style is very */ /* simplistic and might get some things wrong. For a full-featured */ /* algorithm you might have a look at the whitepaper given at */ /* */ /* http://blogs.msdn.com/text/archive/2007/04/23/wpf-font-selection-model.aspx */ /* get style name -- be careful, some broken fonts only */ /* have a `/FontName' dictionary entry! */ root->family_name = info->family_name; root->style_name = NULL; if ( root->family_name ) { char* full = info->full_name; char* family = root->family_name; if ( full ) { FT_Bool the_same = TRUE; while ( *full ) { if ( *full == *family ) { family++; full++;//.........这里部分代码省略.........
开发者ID:CarloMaker,项目名称:Urho3D,代码行数:101,
示例17: load_format_20 static FT_Error load_format_20( TT_Face face, FT_Stream stream, FT_Long post_limit ) { FT_Memory memory = stream->memory; FT_Error error; FT_Int num_glyphs; FT_UShort num_names; FT_UShort* glyph_indices = 0; FT_Char** name_strings = 0; if ( FT_READ_USHORT( num_glyphs ) ) goto Exit; /* UNDOCUMENTED! The number of glyphs in this table can be smaller */ /* than the value in the maxp table (cf. cyberbit.ttf). */ /* There already exist fonts which have more than 32768 glyph names */ /* in this table, so the test for this threshold has been dropped. */ if ( num_glyphs > face->max_profile.numGlyphs ) { error = FT_THROW( Invalid_File_Format ); goto Exit; } /* load the indices */ { FT_Int n; if ( FT_NEW_ARRAY ( glyph_indices, num_glyphs ) || FT_FRAME_ENTER( num_glyphs * 2L ) ) goto Fail; for ( n = 0; n < num_glyphs; n++ ) glyph_indices[n] = FT_GET_USHORT(); FT_FRAME_EXIT(); } /* compute number of names stored in table */ { FT_Int n; num_names = 0; for ( n = 0; n < num_glyphs; n++ ) { FT_Int idx; idx = glyph_indices[n]; if ( idx >= 258 ) { idx -= 257; if ( idx > num_names ) num_names = (FT_UShort)idx; } } } /* now load the name strings */ { FT_UShort n; if ( FT_NEW_ARRAY( name_strings, num_names ) ) goto Fail; for ( n = 0; n < num_names; n++ ) { FT_UInt len; if ( FT_STREAM_POS() >= post_limit ) break; else { FT_TRACE6(( "load_format_20: %d byte left in post table/n", post_limit - FT_STREAM_POS() )); if ( FT_READ_BYTE( len ) ) goto Fail1; } if ( (FT_Int)len > post_limit || FT_STREAM_POS() > post_limit - (FT_Int)len ) { FT_ERROR(( "load_format_20:" " exceeding string length (%d)," " truncating at end of post table (%d byte left)/n", len, post_limit - FT_STREAM_POS() )); len = FT_MAX( 0, post_limit - FT_STREAM_POS() ); }//.........这里部分代码省略.........
开发者ID:151706061,项目名称:PDFium,代码行数:101,
示例18: tt_face_init tt_face_init( FT_Stream stream, FT_Face ttface, /* TT_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { FT_Error error; FT_Library library; SFNT_Service sfnt; TT_Face face = (TT_Face)ttface; FT_TRACE2(( "TTF driver/n" )); library = ttface->driver->root.library; sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) { FT_ERROR(( "tt_face_init: cannot access `sfnt' module/n" )); error = FT_THROW( Missing_Module ); goto Exit; } /* create input stream from resource */ if ( FT_STREAM_SEEK( 0 ) ) goto Exit; /* check that we have a valid TrueType file */ error = sfnt->init_face( stream, face, face_index, num_params, params ); /* Stream may have changed. */ stream = face->root.stream; if ( error ) goto Exit; /* We must also be able to accept Mac/GX fonts, as well as OT ones. */ /* The 0x00020000 tag is completely undocumented; some fonts from */ /* Arphic made for Chinese Windows 3.1 have this. */ if ( face->format_tag != 0x00010000L && /* MS fonts */ face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ face->format_tag != TTAG_true ) /* Mac fonts */ { FT_TRACE2(( " not a TTF font/n" )); goto Bad_Format; }#ifdef TT_USE_BYTECODE_INTERPRETER ttface->face_flags |= FT_FACE_FLAG_HINTER;#endif /* If we are performing a simple font format check, exit immediately. */ if ( face_index < 0 ) return FT_Err_Ok; /* Load font directory */ error = sfnt->load_face( stream, face, face_index, num_params, params ); if ( error ) goto Exit; if ( tt_check_trickyness( ttface ) ) ttface->face_flags |= FT_FACE_FLAG_TRICKY; error = tt_face_load_hdmx( face, stream ); if ( error ) goto Exit; if ( FT_IS_SCALABLE( ttface ) ) {#ifdef FT_CONFIG_OPTION_INCREMENTAL if ( !ttface->internal->incremental_interface ) error = tt_face_load_loca( face, stream ); if ( !error ) error = tt_face_load_cvt( face, stream ); if ( !error ) error = tt_face_load_fpgm( face, stream ); if ( !error ) error = tt_face_load_prep( face, stream ); /* Check the scalable flag based on `loca'. */ if ( !ttface->internal->incremental_interface && ttface->num_fixed_sizes && face->glyph_locations && tt_check_single_notdef( ttface ) ) { FT_TRACE5(( "tt_face_init:" " Only the `.notdef' glyph has an outline./n" " " " Resetting scalable flag to FALSE./n" )); ttface->face_flags &= ~FT_FACE_FLAG_SCALABLE; }#else /* !FT_CONFIG_OPTION_INCREMENTAL */ if ( !error ) error = tt_face_load_loca( face, stream );//.........这里部分代码省略.........
开发者ID:erdincay,项目名称:vcxsrv-linux2windows,代码行数:101,
示例19: pfr_log_font_load//.........这里部分代码省略......... FT_READ_USHORT( num_log_fonts ) ) goto Exit; if ( idx >= num_log_fonts ) return PFR_Err_Invalid_Argument; if ( FT_STREAM_SKIP( idx * 5 ) || FT_READ_USHORT( size ) || FT_READ_UOFF3 ( offset ) ) goto Exit; /* save logical font size and offset */ log_font->size = size; log_font->offset = offset; /* now, check the rest of the table before loading it */ { FT_Byte* p; FT_Byte* limit; FT_UInt local; if ( FT_STREAM_SEEK( offset ) || FT_FRAME_ENTER( size ) ) goto Exit; p = stream->cursor; limit = p + size; PFR_CHECK(13); log_font->matrix[0] = PFR_NEXT_LONG( p ); log_font->matrix[1] = PFR_NEXT_LONG( p ); log_font->matrix[2] = PFR_NEXT_LONG( p ); log_font->matrix[3] = PFR_NEXT_LONG( p ); flags = PFR_NEXT_BYTE( p ); local = 0; if ( flags & PFR_LOG_STROKE ) { local++; if ( flags & PFR_LOG_2BYTE_STROKE ) local++; if ( (flags & PFR_LINE_JOIN_MASK) == PFR_LINE_JOIN_MITER ) local += 3; } if ( flags & PFR_LOG_BOLD ) { local++; if ( flags & PFR_LOG_2BYTE_BOLD ) local++; } PFR_CHECK( local ); if ( flags & PFR_LOG_STROKE ) { log_font->stroke_thickness = ( flags & PFR_LOG_2BYTE_STROKE ) ? PFR_NEXT_SHORT( p ) : PFR_NEXT_BYTE( p ); if ( ( flags & PFR_LINE_JOIN_MASK ) == PFR_LINE_JOIN_MITER ) log_font->miter_limit = PFR_NEXT_LONG( p ); } if ( flags & PFR_LOG_BOLD ) { log_font->bold_thickness = ( flags & PFR_LOG_2BYTE_BOLD ) ? PFR_NEXT_SHORT( p ) : PFR_NEXT_BYTE( p ); } if ( flags & PFR_LOG_EXTRA_ITEMS ) { error = pfr_extra_items_skip( &p, limit ); if (error) goto Fail; } PFR_CHECK(5); log_font->phys_size = PFR_NEXT_USHORT( p ); log_font->phys_offset = PFR_NEXT_ULONG( p ); if ( size_increment ) { PFR_CHECK( 1 ); log_font->phys_size += (FT_UInt32)PFR_NEXT_BYTE( p ) << 16; } } Fail: FT_FRAME_EXIT(); Exit: return error; Too_Short: FT_ERROR(( "pfr_log_font_load: invalid logical font table/n" )); error = PFR_Err_Invalid_Table; goto Fail; }
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:101,
示例20: FT_New_StreamFT_New_Stream( const char* filepathname, FT_Stream stream ){ int file; struct stat stat_buf; if ( !stream ) return FT_Err_Invalid_Stream_Handle; /* open the file */ file = open( filepathname, O_RDONLY ); if ( file < 0 ) { FT_ERROR(( "FT_New_Stream:" )); FT_ERROR(( " could not open `%s'/n", filepathname )); return FT_Err_Cannot_Open_Resource; } if ( fstat( file, &stat_buf ) < 0 ) { FT_ERROR(( "FT_New_Stream:" )); FT_ERROR(( " could not `fstat' file `%s'/n", filepathname )); goto Fail_Map; } stream->size = stat_buf.st_size; stream->pos = 0; stream->base = (unsigned char *)mmap( NULL, stream->size, PROT_READ, MAP_FILE | MAP_PRIVATE, file, 0 ); if ( (long)stream->base == -1 ) { FT_ERROR(( "FT_New_Stream:" )); FT_ERROR(( " could not `mmap' file `%s'/n", filepathname )); goto Fail_Map; } close( file ); stream->descriptor.pointer = stream->base; stream->pathname.pointer = (char*)filepathname; stream->close = ft_close_stream; stream->read = 0; FT_TRACE1(( "FT_New_Stream:" )); FT_TRACE1(( " opened `%s' (%d bytes) successfully/n", filepathname, stream->size )); return FT_Err_Ok;Fail_Map: close( file ); stream->base = NULL; stream->size = 0; stream->pos = 0; return FT_Err_Cannot_Open_Stream;}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:65,
示例21: pfr_extra_item_load_bitmap_info pfr_extra_item_load_bitmap_info( FT_Byte* p, FT_Byte* limit, PFR_PhyFont phy_font ) { FT_Memory memory = phy_font->memory; PFR_Strike strike; FT_UInt flags0; FT_UInt n, count, size1; FT_Error error = PFR_Err_Ok; PFR_CHECK( 5 ); p += 3; /* skip bctSize */ flags0 = PFR_NEXT_BYTE( p ); count = PFR_NEXT_BYTE( p ); /* re-allocate when needed */ if ( phy_font->num_strikes + count > phy_font->max_strikes ) { FT_UInt new_max = FT_PAD_CEIL( phy_font->num_strikes + count, 4 ); if ( FT_RENEW_ARRAY( phy_font->strikes, phy_font->num_strikes, new_max ) ) goto Exit; phy_font->max_strikes = new_max; } size1 = 1 + 1 + 1 + 2 + 2 + 1; if ( flags0 & PFR_STRIKE_2BYTE_XPPM ) size1++; if ( flags0 & PFR_STRIKE_2BYTE_YPPM ) size1++; if ( flags0 & PFR_STRIKE_3BYTE_SIZE ) size1++; if ( flags0 & PFR_STRIKE_3BYTE_OFFSET ) size1++; if ( flags0 & PFR_STRIKE_2BYTE_COUNT ) size1++; strike = phy_font->strikes + phy_font->num_strikes; PFR_CHECK( count * size1 ); for ( n = 0; n < count; n++, strike++ ) { strike->x_ppm = ( flags0 & PFR_STRIKE_2BYTE_XPPM ) ? PFR_NEXT_USHORT( p ) : PFR_NEXT_BYTE( p ); strike->y_ppm = ( flags0 & PFR_STRIKE_2BYTE_YPPM ) ? PFR_NEXT_USHORT( p ) : PFR_NEXT_BYTE( p ); strike->flags = PFR_NEXT_BYTE( p ); strike->bct_size = ( flags0 & PFR_STRIKE_3BYTE_SIZE ) ? PFR_NEXT_ULONG( p ) : PFR_NEXT_USHORT( p ); strike->bct_offset = ( flags0 & PFR_STRIKE_3BYTE_OFFSET ) ? PFR_NEXT_ULONG( p ) : PFR_NEXT_USHORT( p ); strike->num_bitmaps = ( flags0 & PFR_STRIKE_2BYTE_COUNT ) ? PFR_NEXT_USHORT( p ) : PFR_NEXT_BYTE( p ); } phy_font->num_strikes += count; Exit: return error; Too_Short: error = PFR_Err_Invalid_Table; FT_ERROR(( "pfr_extra_item_load_bitmap_info:" " invalid bitmap info table/n" )); goto Exit; }
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:87,
示例22: t42_parse_sfnts static void t42_parse_sfnts( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; FT_Memory memory = parser->root.memory; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_Error error; FT_Int num_tables = 0; FT_Long count; FT_ULong n, string_size, old_string_size, real_size; FT_Byte* string_buf = NULL; FT_Bool allocated = 0; T42_Load_Status status; /* The format is */ /* */ /* /sfnts [ <hexstring> <hexstring> ... ] def */ /* */ /* or */ /* */ /* /sfnts [ */ /* <num_bin_bytes> RD <binary data> */ /* <num_bin_bytes> RD <binary data> */ /* ... */ /* ] def */ /* */ /* with exactly one space after the `RD' token. */ T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' ) { FT_ERROR(( "t42_parse_sfnts: can't find begin of sfnts vector/n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_Spaces( parser ); status = BEFORE_START; string_size = 0; old_string_size = 0; count = 0; while ( parser->root.cursor < limit ) { cur = parser->root.cursor; if ( *cur == ']' ) { parser->root.cursor++; goto Exit; } else if ( *cur == '<' ) { T1_Skip_PS_Token( parser ); if ( parser->root.error ) goto Exit; /* don't include delimiters */ string_size = (FT_ULong)( ( parser->root.cursor - cur - 2 + 1 ) / 2 ); if ( !string_size ) { FT_ERROR(( "t42_parse_sfnts: invalid data in sfnts array/n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } if ( FT_REALLOC( string_buf, old_string_size, string_size ) ) goto Fail; allocated = 1; parser->root.cursor = cur; (void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 ); old_string_size = string_size; string_size = real_size; } else if ( ft_isdigit( *cur ) ) { FT_Long tmp; if ( allocated ) { FT_ERROR(( "t42_parse_sfnts: " "can't handle mixed binary and hex strings/n" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } tmp = T1_ToInt( parser ); if ( tmp < 0 ) { FT_ERROR(( "t42_parse_sfnts: invalid string size/n" ));//.........这里部分代码省略.........
开发者ID:theqvd,项目名称:vcxsrv,代码行数:101,
示例23: pfr_extra_item_load_kerning_pairs pfr_extra_item_load_kerning_pairs( FT_Byte* p, FT_Byte* limit, PFR_PhyFont phy_font ) { PFR_KernItem item = NULL; FT_Error error = PFR_Err_Ok; FT_Memory memory = phy_font->memory; FT_TRACE2(( "pfr_extra_item_load_kerning_pairs()/n" )); if ( FT_NEW( item ) ) goto Exit; PFR_CHECK( 4 ); item->pair_count = PFR_NEXT_BYTE( p ); item->base_adj = PFR_NEXT_SHORT( p ); item->flags = PFR_NEXT_BYTE( p ); item->offset = phy_font->offset + ( p - phy_font->cursor );#ifndef PFR_CONFIG_NO_CHECKS item->pair_size = 3; if ( item->flags & PFR_KERN_2BYTE_CHAR ) item->pair_size += 2; if ( item->flags & PFR_KERN_2BYTE_ADJ ) item->pair_size += 1; PFR_CHECK( item->pair_count * item->pair_size );#endif /* load first and last pairs into the item to speed up */ /* lookup later... */ if ( item->pair_count > 0 ) { FT_UInt char1, char2; FT_Byte* q; if ( item->flags & PFR_KERN_2BYTE_CHAR ) { q = p; char1 = PFR_NEXT_USHORT( q ); char2 = PFR_NEXT_USHORT( q ); item->pair1 = PFR_KERN_INDEX( char1, char2 ); q = p + item->pair_size * ( item->pair_count - 1 ); char1 = PFR_NEXT_USHORT( q ); char2 = PFR_NEXT_USHORT( q ); item->pair2 = PFR_KERN_INDEX( char1, char2 ); } else { q = p; char1 = PFR_NEXT_BYTE( q ); char2 = PFR_NEXT_BYTE( q ); item->pair1 = PFR_KERN_INDEX( char1, char2 ); q = p + item->pair_size * ( item->pair_count - 1 ); char1 = PFR_NEXT_BYTE( q ); char2 = PFR_NEXT_BYTE( q ); item->pair2 = PFR_KERN_INDEX( char1, char2 ); } /* add new item to the current list */ item->next = NULL; *phy_font->kern_items_tail = item; phy_font->kern_items_tail = &item->next; phy_font->num_kern_pairs += item->pair_count; } else { /* empty item! */ FT_FREE( item ); } Exit: return error; Too_Short: FT_FREE( item ); error = PFR_Err_Invalid_Table; FT_ERROR(( "pfr_extra_item_load_kerning_pairs:" " invalid kerning pairs table/n" )); goto Exit; }
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:93,
示例24: T1_Get_Private_Dict T1_Get_Private_Dict( T1_Parser parser, PSAux_Service psaux ) { FT_Stream stream = parser->stream; FT_Memory memory = parser->root.memory; FT_Error error = 0; FT_Long size; if ( parser->in_pfb ) { /* in the case of the PFB format, the private dictionary can be */ /* made of several segments. We thus first read the number of */ /* segments to compute the total size of the private dictionary */ /* then re-read them into memory. */ FT_Long start_pos = FT_STREAM_POS(); FT_UShort tag; parser->private_len = 0; for (;;) { error = read_pfb_tag( stream, &tag, &size ); if ( error ) goto Fail; if ( tag != 0x8002U ) break; parser->private_len += size; if ( FT_STREAM_SKIP( size ) ) goto Fail; } /* Check that we have a private dictionary there */ /* and allocate private dictionary buffer */ if ( parser->private_len == 0 ) { FT_ERROR(( "T1_Get_Private_Dict:" )); FT_ERROR(( " invalid private dictionary section/n" )); error = T1_Err_Invalid_File_Format; goto Fail; } if ( FT_STREAM_SEEK( start_pos ) || FT_ALLOC( parser->private_dict, parser->private_len ) ) goto Fail; parser->private_len = 0; for (;;) { error = read_pfb_tag( stream, &tag, &size ); if ( error || tag != 0x8002U ) { error = T1_Err_Ok; break; } if ( FT_STREAM_READ( parser->private_dict + parser->private_len, size ) ) goto Fail; parser->private_len += size; } } else { /* we have already `loaded' the whole PFA font file into memory; */ /* if this is a memory resource, allocate a new block to hold */ /* the private dict. Otherwise, simply overwrite into the base */ /* dictionary block in the heap. */ /* first of all, look at the `eexec' keyword */ FT_Byte* cur = parser->base_dict; FT_Byte* limit = cur + parser->base_len; FT_Byte c; for (;;) { c = cur[0]; if ( c == 'e' && cur + 9 < limit ) /* 9 = 5 letters for `eexec' + */ /* newline + 4 chars */ { if ( cur[1] == 'e' && cur[2] == 'x' && cur[3] == 'e' && cur[4] == 'c' ) { cur += 6; /* we skip the newling after the `eexec' */ /* XXX: Some fonts use DOS-linefeeds, i.e. /r/n; we need to */ /* skip the extra /n if we find it */ if ( cur[0] == '/n' ) cur++; break; } } cur++; if ( cur >= limit ) {//.........这里部分代码省略.........
开发者ID:8l,项目名称:inferno,代码行数:101,
示例25: pfr_phy_font_load//.........这里部分代码省略......... { FT_UInt n, count; PFR_CHECK( 1 ); phy_font->num_blue_values = count = PFR_NEXT_BYTE( p ); PFR_CHECK( count * 2 ); if ( FT_NEW_ARRAY( phy_font->blue_values, count ) ) goto Fail; for ( n = 0; n < count; n++ ) phy_font->blue_values[n] = PFR_NEXT_SHORT( p ); } PFR_CHECK( 8 ); phy_font->blue_fuzz = PFR_NEXT_BYTE( p ); phy_font->blue_scale = PFR_NEXT_BYTE( p ); phy_font->vertical.standard = PFR_NEXT_USHORT( p ); phy_font->horizontal.standard = PFR_NEXT_USHORT( p ); /* read the character descriptors */ { FT_UInt n, count, Size; phy_font->num_chars = count = PFR_NEXT_USHORT( p ); phy_font->chars_offset = offset + ( p - stream->cursor ); if ( FT_NEW_ARRAY( phy_font->chars, count ) ) goto Fail; Size = 1 + 1 + 2; if ( flags & PFR_PHY_2BYTE_CHARCODE ) Size += 1; if ( flags & PFR_PHY_PROPORTIONAL ) Size += 2; if ( flags & PFR_PHY_ASCII_CODE ) Size += 1; if ( flags & PFR_PHY_2BYTE_GPS_SIZE ) Size += 1; if ( flags & PFR_PHY_3BYTE_GPS_OFFSET ) Size += 1; PFR_CHECK( count * Size ); for ( n = 0; n < count; n++ ) { PFR_Char cur = &phy_font->chars[n]; cur->char_code = ( flags & PFR_PHY_2BYTE_CHARCODE ) ? PFR_NEXT_USHORT( p ) : PFR_NEXT_BYTE( p ); cur->advance = ( flags & PFR_PHY_PROPORTIONAL ) ? PFR_NEXT_SHORT( p ) : (FT_Int) phy_font->standard_advance;#if 0 cur->ascii = ( flags & PFR_PHY_ASCII_CODE ) ? PFR_NEXT_BYTE( p ) : 0;#else if ( flags & PFR_PHY_ASCII_CODE ) p += 1;#endif cur->gps_size = ( flags & PFR_PHY_2BYTE_GPS_SIZE ) ? PFR_NEXT_USHORT( p ) : PFR_NEXT_BYTE( p ); cur->gps_offset = ( flags & PFR_PHY_3BYTE_GPS_OFFSET ) ? PFR_NEXT_ULONG( p ) : PFR_NEXT_USHORT( p ); } } /* that's it! */ Fail: FT_FRAME_EXIT(); /* save position of bitmap info */ phy_font->bct_offset = FT_STREAM_POS(); phy_font->cursor = NULL; Exit: return error; Too_Short: error = PFR_Err_Invalid_Table; FT_ERROR(( "pfr_phy_font_load: invalid physical font table/n" )); goto Fail; }
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:101,
示例26: sfnt_init_face sfnt_init_face( FT_Stream stream, TT_Face face, FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { FT_Error error; FT_Library library = face->root.driver->root.library; SFNT_Service sfnt; /* for now, parameters are unused */ FT_UNUSED( num_params ); FT_UNUSED( params ); sfnt = (SFNT_Service)face->sfnt; if ( !sfnt ) { sfnt = (SFNT_Service)FT_Get_Module_Interface( library, "sfnt" ); if ( !sfnt ) { FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module/n" )); return FT_THROW( Missing_Module ); } face->sfnt = sfnt; face->goto_table = sfnt->goto_table; } FT_FACE_FIND_GLOBAL_SERVICE( face, face->psnames, POSTSCRIPT_CMAPS ); FT_TRACE2(( "SFNT driver/n" )); error = sfnt_open_font( stream, face ); if ( error ) return error; /* Stream may have changed in sfnt_open_font. */ stream = face->root.stream; FT_TRACE2(( "sfnt_init_face: %08p, %ld/n", face, face_index )); if ( face_index < 0 ) face_index = 0; if ( face_index >= face->ttc_header.count ) return FT_THROW( Invalid_Argument ); if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) ) return error; /* check that we have a valid TrueType file */ error = sfnt->load_font_dir( face, stream ); if ( error ) return error; face->root.num_faces = face->ttc_header.count; face->root.face_index = face_index; return error; }
开发者ID:johndpope,项目名称:Medusa,代码行数:62,
示例27: FT_Get_Glyph FT_Get_Glyph( FT_GlyphSlot slot, FT_Glyph *aglyph ) { FT_Library library; FT_Error error; FT_Glyph glyph; const FT_Glyph_Class* clazz = NULL; if ( !slot ) return FT_THROW( Invalid_Slot_Handle ); library = slot->library; if ( !aglyph ) return FT_THROW( Invalid_Argument ); /* if it is a bitmap, that's easy :-) */ if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) clazz = FT_BITMAP_GLYPH_CLASS_GET; /* if it is an outline */ else if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) clazz = FT_OUTLINE_GLYPH_CLASS_GET; else { /* try to find a renderer that supports the glyph image format */ FT_Renderer render = FT_Lookup_Renderer( library, slot->format, 0 ); if ( render ) clazz = &render->glyph_class; } if ( !clazz ) { error = FT_THROW( Invalid_Glyph_Format ); goto Exit; } /* create FT_Glyph object */ error = ft_new_glyph( library, clazz, &glyph ); if ( error ) goto Exit; /* copy advance while converting 26.6 to 16.16 format */ if ( slot->advance.x >= 0x8000L * 64 || slot->advance.x <= -0x8000L * 64 ) { FT_ERROR(( "FT_Get_Glyph: advance width too large/n" )); error = FT_THROW( Invalid_Argument ); goto Exit2; } if ( slot->advance.y >= 0x8000L * 64 || slot->advance.y <= -0x8000L * 64 ) { FT_ERROR(( "FT_Get_Glyph: advance height too large/n" )); error = FT_THROW( Invalid_Argument ); goto Exit2; } glyph->advance.x = slot->advance.x * 1024; glyph->advance.y = slot->advance.y * 1024; /* now import the image from the glyph slot */ error = clazz->glyph_init( glyph, slot ); Exit2: /* if an error occurred, destroy the glyph */ if ( error ) FT_Done_Glyph( glyph ); else *aglyph = glyph; Exit: return error; }
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:79,
示例28: tt_face_load_namett_face_load_name( TT_Face face, FT_Stream stream ){ FT_Error error; FT_Memory memory = stream->memory; FT_ULong table_pos, table_len; FT_ULong storage_start, storage_limit; FT_UInt count; TT_NameTable table; static const FT_Frame_Field name_table_fields[] = {#undef FT_STRUCTURE#define FT_STRUCTURE TT_NameTableRec FT_FRAME_START( 6 ), FT_FRAME_USHORT( format ), FT_FRAME_USHORT( numNameRecords ), FT_FRAME_USHORT( storageOffset ), FT_FRAME_END }; static const FT_Frame_Field name_record_fields[] = {#undef FT_STRUCTURE#define FT_STRUCTURE TT_NameEntryRec /* no FT_FRAME_START */ FT_FRAME_USHORT( platformID ), FT_FRAME_USHORT( encodingID ), FT_FRAME_USHORT( languageID ), FT_FRAME_USHORT( nameID ), FT_FRAME_USHORT( stringLength ), FT_FRAME_USHORT( stringOffset ), FT_FRAME_END }; table = &face->name_table; table->stream = stream; error = face->goto_table( face, TTAG_name, stream, &table_len ); if ( error ) goto Exit; table_pos = FT_STREAM_POS(); if ( FT_STREAM_READ_FIELDS( name_table_fields, table ) ) goto Exit; /* Some popular Asian fonts have an invalid `storageOffset' value */ /* (it should be at least "6 + 12*num_names"). However, the string */ /* offsets, computed as "storageOffset + entry->stringOffset", are */ /* valid pointers within the name table... */ /* */ /* We thus can't check `storageOffset' right now. */ /* */ storage_start = table_pos + 6 + 12*table->numNameRecords; storage_limit = table_pos + table_len; if ( storage_start > storage_limit ) { FT_ERROR(( "tt_face_load_name: invalid `name' table/n" )); error = SFNT_Err_Name_Table_Missing; goto Exit; } /* Allocate the array of name records. */ count = table->numNameRecords; table->numNameRecords = 0; if ( FT_NEW_ARRAY( table->names, count ) || FT_FRAME_ENTER( count * 12 ) ) goto Exit; /* Load the name records and determine how much storage is needed */ /* to hold the strings themselves. */ { TT_NameEntryRec* entry = table->names; for ( ; count > 0; count-- ) { if ( FT_STREAM_READ_FIELDS( name_record_fields, entry ) ) continue; /* check that the name is not empty */ if ( entry->stringLength == 0 ) continue; /* check that the name string is within the table */ entry->stringOffset += table_pos + table->storageOffset; if ( entry->stringOffset < storage_start || entry->stringOffset + entry->stringLength > storage_limit ) { /* invalid entry - ignore it */ entry->stringOffset = 0; entry->stringLength = 0; continue;//.........这里部分代码省略.........
开发者ID:histone,项目名称:sumatrapdf,代码行数:101,
示例29: pcf_get_bitmaps static FT_Error pcf_get_bitmaps( FT_Stream stream, PCF_Face face ) { FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_Long* offsets; FT_Long bitmapSizes[GLYPHPADOPTIONS]; FT_ULong format, size; int nbitmaps, i, sizebitmaps = 0; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_BITMAPS, &format, &size ); if ( error ) return error; error = FT_Stream_EnterFrame( stream, 8 ); if ( error ) return error; format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) nbitmaps = FT_GET_ULONG(); else nbitmaps = FT_GET_ULONG_LE(); FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return PCF_Err_Invalid_File_Format; FT_TRACE4(( "pcf_get_bitmaps:/n" )); FT_TRACE4(( " number of bitmaps: %d/n", nbitmaps )); if ( nbitmaps != face->nmetrics ) return PCF_Err_Invalid_File_Format; if ( FT_NEW_ARRAY( offsets, nbitmaps ) ) return error; for ( i = 0; i < nbitmaps; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_LONG( offsets[i] ); else (void)FT_READ_LONG_LE( offsets[i] ); FT_TRACE5(( " bitmap %d: offset %ld (0x%lX)/n", i, offsets[i], offsets[i] )); } if ( error ) goto Bail; for ( i = 0; i < GLYPHPADOPTIONS; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_LONG( bitmapSizes[i] ); else (void)FT_READ_LONG_LE( bitmapSizes[i] ); if ( error ) goto Bail; sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )]; FT_TRACE4(( " padding %d implies a size of %ld/n", i, bitmapSizes[i] )); } FT_TRACE4(( " %d bitmaps, padding index %ld/n", nbitmaps, PCF_GLYPH_PAD_INDEX( format ) )); FT_TRACE4(( " bitmap size = %d/n", sizebitmaps )); FT_UNUSED( sizebitmaps ); /* only used for debugging */ for ( i = 0; i < nbitmaps; i++ ) { /* rough estimate */ if ( ( offsets[i] < 0 ) || ( (FT_ULong)offsets[i] > size ) ) { FT_ERROR(( "pcf_get_bitmaps:")); FT_ERROR(( " invalid offset to bitmap data of glyph %d/n", i )); } else face->metrics[i].bits = stream->pos + offsets[i]; } face->bitmapsFormat = format; Bail: FT_FREE( offsets ); return error; }
开发者ID:BlairArchibald,项目名称:Alexandria,代码行数:99,
注:本文中的FT_ERROR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FT_FACE函数代码示例 C++ FT_ERR函数代码示例 |