您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ FT_NEW_ARRAY函数代码示例

51自学网 2021-06-01 20:44:26
  C++
这篇教程C++ FT_NEW_ARRAY函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中FT_NEW_ARRAY函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_NEW_ARRAY函数的具体用法?C++ FT_NEW_ARRAY怎么用?C++ FT_NEW_ARRAY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了FT_NEW_ARRAY函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tt_size_init

  tt_size_init( FT_Size  ttsize )           /* TT_Size */  {    TT_Size   size  = (TT_Size)ttsize;    FT_Error  error = TT_Err_Ok;#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER    TT_Face    face   = (TT_Face)size->root.face;    FT_Memory  memory = face->root.memory;    FT_Int     i;    FT_UShort       n_twilight;    TT_MaxProfile*  maxp = &face->max_profile;    size->max_function_defs    = maxp->maxFunctionDefs;    size->max_instruction_defs = maxp->maxInstructionDefs;    size->num_function_defs    = 0;    size->num_instruction_defs = 0;    size->max_func = 0;    size->max_ins  = 0;    size->cvt_size     = face->cvt_size;    size->storage_size = maxp->maxStorage;    /* Set default metrics */    {      FT_Size_Metrics*  metrics  = &size->root.metrics;      TT_Size_Metrics*  metrics2 = &size->ttmetrics;      metrics->x_ppem = 0;      metrics->y_ppem = 0;      metrics2->rotated   = FALSE;      metrics2->stretched = FALSE;      /* set default compensation (all 0) */      for ( i = 0; i < 4; i++ )        metrics2->compensations[i] = 0;    }    /* allocate function defs, instruction defs, cvt, and storage area */    if ( FT_NEW_ARRAY( size->function_defs,    size->max_function_defs    ) ||         FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||         FT_NEW_ARRAY( size->cvt,              size->cvt_size             ) ||         FT_NEW_ARRAY( size->storage,          size->storage_size         ) )    {      tt_size_done( ttsize );      return error;    }    /* reserve twilight zone */    n_twilight = maxp->maxTwilightPoints;    /* there are 4 phantom points (do we need this?) */    n_twilight += 4;    error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );    if ( error )    {      tt_size_done( ttsize );      return error;    }    size->twilight.n_points = n_twilight;    size->GS = tt_default_graphics_state;    /* set `face->interpreter' according to the debug hook present */    {      FT_Library  library = face->root.driver->root.library;      face->interpreter = (TT_Interpreter)                            library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];      if ( !face->interpreter )        face->interpreter = (TT_Interpreter)TT_RunIns;    }    /* Fine, now run the font program! */    error = tt_size_run_fpgm( size );    if ( error )      tt_size_done( ttsize );#endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */    size->ttmetrics.valid = FALSE;    size->strike_index    = 0xFFFFFFFFUL;    return error;  }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:97,


示例2: 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 = T42_Err_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_UInt      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_UInt)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";        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:MagistrAVSH,项目名称:node3d,代码行数:101,


示例3: ps_unicodes_init

  /* Builds a table that maps Unicode values to glyph indices */  static FT_Error  ps_unicodes_init( FT_Memory     memory,                    FT_UInt       num_glyphs,                    const char**  glyph_names,                    PS_Unicodes*  table )  {    FT_Error  error;    /* we first allocate the table */    table->num_maps = 0;    table->maps     = 0;    if ( !FT_NEW_ARRAY( table->maps, num_glyphs ) )    {      FT_UInt     n;      FT_UInt     count;      PS_UniMap*  map;      FT_UInt32   uni_char;      map = table->maps;      for ( n = 0; n < num_glyphs; n++ )      {        const char*  gname = glyph_names[n];        if ( gname )        {          uni_char = ps_unicode_value( gname );          if ( uni_char != 0 && uni_char != 0xFFFFL )          {            map->unicode     = (FT_UInt)uni_char;            map->glyph_index = n;            map++;          }        }      }      /* now, compress the table a bit */      count = (FT_UInt)( map - table->maps );      if ( count > 0 && FT_REALLOC( table->maps,                                    num_glyphs * sizeof ( PS_UniMap ),                                    count * sizeof ( PS_UniMap ) ) )        count = 0;      if ( count == 0 )      {        FT_FREE( table->maps );        if ( !error )          error = PSnames_Err_Invalid_Argument;  /* no unicode chars here! */      }      else        /* sort the table in increasing order of unicode values */        ft_qsort( table->maps, count, sizeof ( PS_UniMap ), compare_uni_maps );      table->num_maps = count;    }    return error;  }
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:65,


示例4: pcf_get_metrics

  static FT_Error  pcf_get_metrics( FT_Stream  stream,                   PCF_Face   face )  {    FT_Error    error;    FT_Memory   memory  = FT_FACE( face )->memory;    FT_ULong    format, size;    PCF_Metric  metrics = 0;    FT_ULong    nmetrics, i;    error = pcf_seek_to_table_type( stream,                                    face->toc.tables,                                    face->toc.count,                                    PCF_METRICS,                                    &format,                                    &size );    if ( error )      return error;    if ( FT_READ_ULONG_LE( format ) )      goto Bail;    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT )     &&         !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) )      return FT_THROW( Invalid_File_Format );    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )    {      if ( PCF_BYTE_ORDER( format ) == MSBFirst )        (void)FT_READ_ULONG( nmetrics );      else        (void)FT_READ_ULONG_LE( nmetrics );    }    else    {      if ( PCF_BYTE_ORDER( format ) == MSBFirst )        (void)FT_READ_USHORT( nmetrics );      else        (void)FT_READ_USHORT_LE( nmetrics );    }    if ( error )      return FT_THROW( Invalid_File_Format );    face->nmetrics = nmetrics;    if ( !nmetrics )      return FT_THROW( Invalid_Table );    FT_TRACE4(( "pcf_get_metrics:/n" ));    FT_TRACE4(( "  number of metrics: %d/n", nmetrics ));    /* rough estimate */    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )    {      if ( nmetrics > size / PCF_METRIC_SIZE )        return FT_THROW( Invalid_Table );    }    else    {      if ( nmetrics > size / PCF_COMPRESSED_METRIC_SIZE )        return FT_THROW( Invalid_Table );    }    if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )      return FT_THROW( Out_Of_Memory );    metrics = face->metrics;    for ( i = 0; i < nmetrics; i++, metrics++ )    {      error = pcf_get_metric( stream, format, metrics );      metrics->bits = 0;      FT_TRACE5(( "  idx %d: width=%d, "                  "lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d/n",                  i,                  metrics->characterWidth,                  metrics->leftSideBearing,                  metrics->rightSideBearing,                  metrics->ascent,                  metrics->descent,                  metrics->attributes ));      if ( error )        break;      /* sanity checks -- those values are used in `PCF_Glyph_Load' to     */      /* compute a glyph's bitmap dimensions, thus setting them to zero in */      /* case of an error disables this particular glyph only              */      if ( metrics->rightSideBearing < metrics->leftSideBearing ||           metrics->ascent + metrics->descent < 0               )      {        metrics->characterWidth   = 0;        metrics->leftSideBearing  = 0;        metrics->rightSideBearing = 0;        metrics->ascent           = 0;        metrics->descent          = 0;//.........这里部分代码省略.........
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:101,


示例5: pcf_get_encodings

  static FT_Error  pcf_get_encodings( FT_Stream  stream,                     PCF_Face   face )  {    FT_Error      error;    FT_Memory     memory = FT_FACE( face )->memory;    FT_ULong      format, size;    int           firstCol, lastCol;    int           firstRow, lastRow;    int           nencoding, encodingOffset;    int           i, j, k;    PCF_Encoding  encoding = NULL;    error = pcf_seek_to_table_type( stream,                                    face->toc.tables,                                    face->toc.count,                                    PCF_BDF_ENCODINGS,                                    &format,                                    &size );    if ( error )      return error;    error = FT_Stream_EnterFrame( stream, 14 );    if ( error )      return error;    format = FT_GET_ULONG_LE();    if ( PCF_BYTE_ORDER( format ) == MSBFirst )    {      firstCol          = FT_GET_SHORT();      lastCol           = FT_GET_SHORT();      firstRow          = FT_GET_SHORT();      lastRow           = FT_GET_SHORT();      face->defaultChar = FT_GET_SHORT();    }    else    {      firstCol          = FT_GET_SHORT_LE();      lastCol           = FT_GET_SHORT_LE();      firstRow          = FT_GET_SHORT_LE();      lastRow           = FT_GET_SHORT_LE();      face->defaultChar = FT_GET_SHORT_LE();    }    FT_Stream_ExitFrame( stream );    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )      return FT_THROW( Invalid_File_Format );    /* sanity checks */    if ( firstCol < 0       ||         firstCol > lastCol ||         lastCol  > 0xFF    ||         firstRow < 0       ||         firstRow > lastRow ||         lastRow  > 0xFF    )      return FT_THROW( Invalid_Table );    FT_TRACE4(( "pdf_get_encodings:/n" ));    FT_TRACE4(( "  firstCol %d, lastCol %d, firstRow %d, lastRow %d/n",                firstCol, lastCol, firstRow, lastRow ));    nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 );    if ( FT_NEW_ARRAY( encoding, nencoding ) )      return FT_THROW( Out_Of_Memory );    error = FT_Stream_EnterFrame( stream, 2 * nencoding );    if ( error )      goto Bail;    k = 0;    for ( i = firstRow; i <= lastRow; i++ )    {      for ( j = firstCol; j <= lastCol; j++ )      {        if ( PCF_BYTE_ORDER( format ) == MSBFirst )          encodingOffset = FT_GET_SHORT();        else          encodingOffset = FT_GET_SHORT_LE();        if ( encodingOffset != -1 )        {          encoding[k].enc   = i * 256 + j;          encoding[k].glyph = (FT_Short)encodingOffset;          FT_TRACE5(( "  code %d (0x%04X): idx %d/n",                      encoding[k].enc, encoding[k].enc, encoding[k].glyph ));          k++;        }      }    }    FT_Stream_ExitFrame( stream );    if ( FT_RENEW_ARRAY( encoding, nencoding, k ) )      goto Bail;//.........这里部分代码省略.........
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:101,


示例6: pcf_get_metrics

  static FT_Error  pcf_get_metrics( FT_Stream  stream,                   PCF_Face   face )  {    FT_Error    error    = PCF_Err_Ok;    FT_Memory   memory   = FT_FACE(face)->memory;    FT_ULong    format, size;    PCF_Metric  metrics  = 0;    FT_ULong    nmetrics, i;    error = pcf_seek_to_table_type( stream,                                    face->toc.tables,                                    face->toc.count,                                    PCF_METRICS,                                    &format,                                    &size );    if ( error )      return error;    if ( FT_READ_ULONG_LE( format ) )      goto Bail;    if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT )     &&         !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) )      return PCF_Err_Invalid_File_Format;    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )    {      if ( PCF_BYTE_ORDER( format ) == MSBFirst )        (void)FT_READ_ULONG( nmetrics );      else        (void)FT_READ_ULONG_LE( nmetrics );    }    else    {      if ( PCF_BYTE_ORDER( format ) == MSBFirst )        (void)FT_READ_USHORT( nmetrics );      else        (void)FT_READ_USHORT_LE( nmetrics );    }    if ( error )      return PCF_Err_Invalid_File_Format;    face->nmetrics = nmetrics;    if ( !nmetrics )      return PCF_Err_Invalid_Table;    FT_TRACE4(( "pcf_get_metrics:/n" ));    FT_TRACE4(( "  number of metrics: %d/n", nmetrics ));    /* rough estimate */    if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )    {      if ( nmetrics > size / PCF_METRIC_SIZE )        return PCF_Err_Invalid_Table;    }    else    {      if ( nmetrics > size / PCF_COMPRESSED_METRIC_SIZE )        return PCF_Err_Invalid_Table;    }    if ( FT_NEW_ARRAY( face->metrics, nmetrics ) )      return PCF_Err_Out_Of_Memory;    metrics = face->metrics;    for ( i = 0; i < nmetrics; i++ )    {      error = pcf_get_metric( stream, format, metrics + i );      metrics[i].bits = 0;      FT_TRACE5(( "  idx %d: width=%d, "                  "lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d/n",                  i,                  ( metrics + i )->characterWidth,                  ( metrics + i )->leftSideBearing,                  ( metrics + i )->rightSideBearing,                  ( metrics + i )->ascent,                  ( metrics + i )->descent,                  ( metrics + i )->attributes ));      if ( error )        break;    }    if ( error )      FT_FREE( face->metrics );  Bail:    return error;  }
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:95,


示例7: pcf_read_TOC

  static FT_Error  pcf_read_TOC( FT_Stream  stream,                PCF_Face   face )  {    FT_Error   error;    PCF_Toc    toc = &face->toc;    PCF_Table  tables;    FT_Memory  memory = FT_FACE(face)->memory;    FT_UInt    n;    if ( FT_STREAM_SEEK ( 0 )                          ||         FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) )      return PCF_Err_Cannot_Open_Resource;    if ( toc->version != PCF_FILE_VERSION                 ||         toc->count   >  FT_ARRAY_MAX( face->toc.tables ) ||         toc->count   == 0                                )      return PCF_Err_Invalid_File_Format;    if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )      return PCF_Err_Out_Of_Memory;    tables = face->toc.tables;    for ( n = 0; n < toc->count; n++ )    {      if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) )        goto Exit;      tables++;    }    /* Sort tables and check for overlaps.  Because they are almost      */    /* always ordered already, an in-place bubble sort with simultaneous */    /* boundary checking seems appropriate.                              */    tables = face->toc.tables;    for ( n = 0; n < toc->count - 1; n++ )    {      FT_UInt  i, have_change;      have_change = 0;      for ( i = 0; i < toc->count - 1 - n; i++ )      {        PCF_TableRec  tmp;        if ( tables[i].offset > tables[i + 1].offset )        {          tmp           = tables[i];          tables[i]     = tables[i + 1];          tables[i + 1] = tmp;          have_change = 1;        }        if ( ( tables[i].size   > tables[i + 1].offset )                  ||             ( tables[i].offset > tables[i + 1].offset - tables[i].size ) )          return PCF_Err_Invalid_Offset;      }      if ( !have_change )        break;    }#ifdef FT_DEBUG_LEVEL_TRACE    {      FT_UInt      i, j;      const char*  name = "?";      FT_TRACE4(( "pcf_read_TOC:/n" ));      FT_TRACE4(( "  number of tables: %ld/n", face->toc.count ));      tables = face->toc.tables;      for ( i = 0; i < toc->count; i++ )      {        for ( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] );              j++ )          if ( tables[i].type == (FT_UInt)( 1 << j ) )            name = tableNames[j];        FT_TRACE4(( "  %d: type=%s, format=0x%X, "                    "size=%ld (0x%lX), offset=%ld (0x%lX)/n",                    i, name,                    tables[i].format,                    tables[i].size, tables[i].size,                    tables[i].offset, tables[i].offset ));      }    }#endif    return PCF_Err_Ok;  Exit://.........这里部分代码省略.........
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:101,


示例8: cff_index_get_pointers

  /* entries to C-style strings (this is, NULL-terminated).       */  static FT_Error  cff_index_get_pointers( CFF_Index   idx,                          FT_Byte***  table,                          FT_Byte**   pool )  {    FT_Error   error     = FT_Err_Ok;    FT_Memory  memory    = idx->stream->memory;    FT_Byte**  t         = NULL;    FT_Byte*   new_bytes = NULL;    *table = NULL;    if ( idx->offsets == NULL )    {      error = cff_index_load_offsets( idx );      if ( error )        goto Exit;    }    if ( idx->count > 0                                        &&         !FT_NEW_ARRAY( t, idx->count + 1 )                    &&         ( !pool || !FT_ALLOC( new_bytes,                               idx->data_size + idx->count ) ) )    {      FT_ULong  n, cur_offset;      FT_ULong  extra = 0;      FT_Byte*  org_bytes = idx->bytes;      /* at this point, `idx->offsets' can't be NULL */      cur_offset = idx->offsets[0] - 1;      /* sanity check */      if ( cur_offset != 0 )      {        FT_TRACE0(( "cff_index_get_pointers:"                    " invalid first offset value %d set to zero/n",                    cur_offset ));        cur_offset = 0;      }      if ( !pool )        t[0] = org_bytes + cur_offset;      else        t[0] = new_bytes + cur_offset;      for ( n = 1; n <= idx->count; n++ )      {        FT_ULong  next_offset = idx->offsets[n] - 1;        /* two sanity checks for invalid offset tables */        if ( next_offset < cur_offset )          next_offset = cur_offset;        else if ( next_offset > idx->data_size )          next_offset = idx->data_size;        if ( !pool )          t[n] = org_bytes + next_offset;        else        {          t[n] = new_bytes + next_offset + extra;          if ( next_offset != cur_offset )          {            FT_MEM_COPY( t[n - 1], org_bytes + cur_offset, t[n] - t[n - 1] );            t[n][0] = '/0';            t[n]   += 1;            extra++;          }        }        cur_offset = next_offset;      }      *table = t;      if ( pool )        *pool = new_bytes;    }  Exit:    return error;  }
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:86,


示例9: 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  = FT_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;            }            /* try to rescue some of the SIDs if `nleft' is too large */            if ( glyph_sid > 0xFFFFL - nleft )            {              FT_ERROR(( "cff_charset_load: invalid SID range trimmed"                         " nleft=%d -> %d/n", nleft, 0xFFFFL - glyph_sid ));              nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );            }            /* 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 = FT_THROW( Invalid_File_Format );        goto Exit;      }    }    else    {      /* Parse default tables corresponding to offset == 0, 1, or 2.  *///.........这里部分代码省略.........
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:101,


示例10: FNT_Face_Init

static FT_ErrorFNT_Face_Init( FT_Stream      stream,               FNT_Face       face,               FT_Int         face_index,               FT_Int         num_params,               FT_Parameter*  params ){    FT_Error   error;    FT_Memory  memory = FT_FACE_MEMORY( face );    FT_UNUSED( num_params );    FT_UNUSED( params );    /* try to load font from a DLL */    error = fnt_face_get_dll_font( face, face_index );    if ( error )    {        /* this didn't work; try to load a single FNT font */        FNT_Font  font;        if ( FT_NEW( face->font ) )            goto Exit;        face->root.num_faces = 1;        font           = face->font;        font->offset   = 0;        font->fnt_size = stream->size;        error = fnt_font_load( font, stream );        if ( error )            goto Fail;    }    /* we now need to fill the root FT_Face fields */    /* with relevant information                   */    {        FT_Face   root = FT_FACE( face );        FNT_Font  font = face->font;        root->face_flags = FT_FACE_FLAG_FIXED_SIZES |                           FT_FACE_FLAG_HORIZONTAL;        if ( font->header.avg_width == font->header.max_width )            root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;        if ( font->header.italic )            root->style_flags |= FT_STYLE_FLAG_ITALIC;        if ( font->header.weight >= 800 )            root->style_flags |= FT_STYLE_FLAG_BOLD;        /* set up the `fixed_sizes' array */        if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )            goto Fail;        root->num_fixed_sizes = 1;        {            FT_Bitmap_Size*  bsize = root->available_sizes;            bsize->width  = font->header.avg_width;            bsize->height =                font->header.pixel_height + font->header.external_leading;            bsize->size   = font->header.nominal_point_size << 6;            bsize->x_ppem =                (FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 )                          / 72 );            bsize->y_ppem =                (FT_Pos)( ( font->header.vertical_resolution* bsize->size + 36 )                          / 72 );        }        {            FT_CharMapRec  charmap;            charmap.encoding    = FT_ENCODING_UNICODE;            charmap.platform_id = 3;            charmap.encoding_id = 1;            charmap.face        = root;            error = FT_CMap_New( fnt_cmap_class,                                 NULL,                                 &charmap,                                 NULL );            if ( error )                goto Fail;            /* Select default charmap */            if ( root->num_charmaps )                root->charmap = root->charmaps[0];        }        /* setup remaining flags *///.........这里部分代码省略.........
开发者ID:1tgr,项目名称:mobius,代码行数:101,


示例11: cff_font_load

//.........这里部分代码省略.........    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 = NULL;      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 ) )        goto Exit;      error = cff_index_init( &fd_index, stream, 0 );      if ( error )        goto Exit;      if ( fd_index.count > CFF_MAX_CID_FONTS )      {        FT_TRACE0(( "cff_font_load: FD array too large in CID font/n" ));        goto Fail_CID;      }      /* allocate & read each font dict independently */      font->num_subfonts = fd_index.count;      if ( FT_NEW_ARRAY( sub, fd_index.count ) )        goto Fail_CID;      /* set up pointer table */      for ( idx = 0; idx < fd_index.count; idx++ )        font->subfonts[idx] = sub + idx;      /* now load each subfont independently */      for ( idx = 0; idx < fd_index.count; idx++ )      {        sub = font->subfonts[idx];        FT_TRACE4(( "parsing subfont %u/n", idx ));        error = cff_subfont_load( sub, &fd_index, idx,                                  stream, base_offset, library );        if ( error )          goto Fail_CID;      }      /* now load the FD Select array */      error = CFF_Load_FD_Select( &font->fd_select,                                  font->charstrings_index.count,                                  stream,                                  base_offset + dict->cid_fd_select_offset );    Fail_CID:      cff_index_done( &fd_index );      if ( error )        goto Exit;    }    else      font->num_subfonts = 0;
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:66,


示例12: tt_size_init_bytecode

  /* We do this only if bytecode interpretation is really needed. */  static FT_Error  tt_size_init_bytecode( FT_Size  ftsize,                         FT_Bool  pedantic )  {    FT_Error   error;    TT_Size    size = (TT_Size)ftsize;    TT_Face    face = (TT_Face)ftsize->face;    FT_Memory  memory = face->root.memory;    FT_UShort       n_twilight;    TT_MaxProfile*  maxp = &face->max_profile;    /* clean up bytecode related data */    FT_FREE( size->function_defs );    FT_FREE( size->instruction_defs );    FT_FREE( size->cvt );    FT_FREE( size->storage );    if ( size->context )      TT_Done_Context( size->context );    tt_glyphzone_done( &size->twilight );    size->bytecode_ready = -1;    size->cvt_ready      = -1;    size->context = TT_New_Context( (TT_Driver)face->root.driver );    size->max_function_defs    = maxp->maxFunctionDefs;    size->max_instruction_defs = maxp->maxInstructionDefs;    size->num_function_defs    = 0;    size->num_instruction_defs = 0;    size->max_func = 0;    size->max_ins  = 0;    size->cvt_size     = face->cvt_size;    size->storage_size = maxp->maxStorage;    /* Set default metrics */    {      TT_Size_Metrics*  tt_metrics = &size->ttmetrics;      tt_metrics->rotated   = FALSE;      tt_metrics->stretched = FALSE;      /* set default engine compensation */      tt_metrics->compensations[0] = 0;   /* gray     */      tt_metrics->compensations[1] = 0;   /* black    */      tt_metrics->compensations[2] = 0;   /* white    */      tt_metrics->compensations[3] = 0;   /* reserved */    }    /* allocate function defs, instruction defs, cvt, and storage area */    if ( FT_NEW_ARRAY( size->function_defs,    size->max_function_defs    ) ||         FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||         FT_NEW_ARRAY( size->cvt,              size->cvt_size             ) ||         FT_NEW_ARRAY( size->storage,          size->storage_size         ) )      goto Exit;    /* reserve twilight zone */    n_twilight = maxp->maxTwilightPoints;    /* there are 4 phantom points (do we need this?) */    n_twilight += 4;    error = tt_glyphzone_new( memory, n_twilight, 0, &size->twilight );    if ( error )      goto Exit;    size->twilight.n_points = n_twilight;    size->GS = tt_default_graphics_state;    /* set `face->interpreter' according to the debug hook present */    {      FT_Library  library = face->root.driver->root.library;      face->interpreter = (TT_Interpreter)                            library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];      if ( !face->interpreter )        face->interpreter = (TT_Interpreter)TT_RunIns;    }    /* Fine, now run the font program! */    /* In case of an error while executing `fpgm', we intentionally don't */    /* clean up immediately 
C++ FT_NEXT_ULONG函数代码示例
C++ FT_NEW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。