当前位置: 首页>>代码示例>>C++>>正文


C++ FT_MEM_COPY函数代码示例

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


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

示例1: FT_Stream_TryRead

  FT_Stream_TryRead( FT_Stream  stream,
                     FT_Byte*   buffer,
                     FT_ULong   count )
  {
    FT_ULong  read_bytes = 0;


    if ( stream->pos >= stream->size )
      goto Exit;

    if ( stream->read )
      read_bytes = stream->read( stream, stream->pos, buffer, count );
    else
    {
      read_bytes = stream->size - stream->pos;
      if ( read_bytes > count )
        read_bytes = count;

      FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
    }

    stream->pos += read_bytes;

  Exit:
    return read_bytes;
  }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:26,代码来源:ftstream.c

示例2: cff_index_get_name

  cff_index_get_name( CFF_Font  font,
                      FT_UInt   element )
  {
    CFF_Index   idx = &font->name_index;
    FT_Memory   memory = idx->stream->memory;
    FT_Byte*    bytes;
    FT_ULong    byte_len;
    FT_Error    error;
    FT_String*  name = 0;


    error = cff_index_access_element( idx, element, &bytes, &byte_len );
    if ( error )
      goto Exit;

    if ( !FT_ALLOC( name, byte_len + 1 ) )
    {
      FT_MEM_COPY( name, bytes, byte_len );
      name[byte_len] = 0;
    }
    cff_index_forget_element( idx, &bytes );

  Exit:
    return name;
  }
开发者ID:ONLYOFFICE,项目名称:core,代码行数:25,代码来源:cffload.c

示例3: t1_get_glyph_name

  static FT_Error
  t1_get_glyph_name( T1_Face     face,
                     FT_UInt     glyph_index,
                     FT_Pointer  buffer,
                     FT_UInt     buffer_max )
  {
    FT_String*  gname;


    gname = face->type1.glyph_names[glyph_index];

    if ( buffer_max > 0 )
    {
      FT_UInt  len = (FT_UInt)( ft_strlen( gname ) );


      if (len >= buffer_max)
        len = buffer_max - 1;

      FT_MEM_COPY( buffer, gname, len );
      ((FT_Byte*)buffer)[len] = 0;
    }

    return T1_Err_Ok;
  }
开发者ID:stefanhendriks,项目名称:dune2themaker,代码行数:25,代码来源:t1driver.c

示例4: ft_bzip2_file_fill_input

  static FT_Error
  ft_bzip2_file_fill_input( FT_BZip2File  zip )
  {
    bz_stream*  bzstream = &zip->bzstream;
    FT_Stream   stream    = zip->source;
    FT_ULong    size;


    if ( stream->read )
    {
      size = stream->read( stream, stream->pos, zip->input,
                           FT_BZIP2_BUFFER_SIZE );
      if ( size == 0 )
        return FT_THROW( Invalid_Stream_Operation );
    }
    else
    {
      size = stream->size - stream->pos;
      if ( size > FT_BZIP2_BUFFER_SIZE )
        size = FT_BZIP2_BUFFER_SIZE;

      if ( size == 0 )
        return FT_THROW( Invalid_Stream_Operation );

      FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
    }
    stream->pos += size;

    bzstream->next_in  = (char*)zip->input;
    bzstream->avail_in = size;

    return FT_Err_Ok;
  }
开发者ID:03050903,项目名称:Urho3D,代码行数:33,代码来源:ftbzip2.c

示例5: FT_Get_WinFNT_Header

  FT_Get_WinFNT_Header( FT_Face               face,
                        FT_WinFNT_HeaderRec  *header )
  {
    FT_Error  error;


    error = FT_Err_Invalid_Argument;

    if ( face != NULL && face->driver != NULL )
    {
      FT_Module  driver = (FT_Module) face->driver;


      if ( driver->clazz && driver->clazz->module_name              &&
           ft_strcmp( driver->clazz->module_name, "winfonts" ) == 0 )
      {
        FNT_Face  fnt_face = (FNT_Face)face;
        FNT_Font  font     = fnt_face->font;


        if ( font )
        {
          FT_MEM_COPY( header, &font->header, sizeof ( *header ) );
          error = FT_Err_Ok;
        }
      }
    }
    return error;
  }
开发者ID:CliffsDover,项目名称:graphicsmagick,代码行数:29,代码来源:ftwinfnt.c

示例6: ft_gzip_file_fill_input

static FT_Error
ft_gzip_file_fill_input( FT_GZipFile  zip )
{
    z_stream*  zstream = &zip->zstream;
    FT_Stream  stream  = zip->source;
    FT_ULong   size;


    if ( stream->read )
    {
        size = stream->read( stream, stream->pos, zip->input,
                             FT_GZIP_BUFFER_SIZE );
        if ( size == 0 )
            return Gzip_Err_Invalid_Stream_Operation;
    }
    else
    {
        size = stream->size - stream->pos;
        if ( size > FT_GZIP_BUFFER_SIZE )
            size = FT_GZIP_BUFFER_SIZE;

        if ( size == 0 )
            return Gzip_Err_Invalid_Stream_Operation;

        FT_MEM_COPY( zip->input, stream->base + stream->pos, size );
    }
    stream->pos += size;

    zstream->next_in  = zip->input;
    zstream->avail_in = size;

    return Gzip_Err_Ok;
}
开发者ID:bowlofstew,项目名称:Aquaria,代码行数:33,代码来源:ftgzip.c

示例7: reallocate_t1_table

  static FT_Error
  reallocate_t1_table( PS_Table  table,
                       FT_Long   new_size )
  {
    FT_Memory  memory   = table->memory;
    FT_Byte*   old_base = table->block;
    FT_Error   error;


    /* allocate new base block */
    if ( FT_ALLOC( table->block, new_size ) )
    {
      table->block = old_base;
      return error;
    }

    /* copy elements and shift offsets */
    if (old_base )
    {
      FT_MEM_COPY( table->block, old_base, table->capacity );
      shift_elements( table, old_base );
      FT_FREE( old_base );
    }

    table->capacity = new_size;

    return PSaux_Err_Ok;
  }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:28,代码来源:psobjs.c

示例8: cff_index_get_sid_string

  cff_index_get_sid_string( CFF_Index        idx,
                            FT_UInt          sid,
                            PSNames_Service  psnames_service )
  {
    /* if it is not a standard string, return it */
    if ( sid > 390 )
      return cff_index_get_name( idx, sid - 391 );

    /* that's a standard string, fetch a copy from the PSName module */
    {
      FT_String*   name       = 0;
      const char*  adobe_name = psnames_service->adobe_std_strings( sid );
      FT_UInt      len;


      if ( adobe_name )
      {
        FT_Memory  memory = idx->stream->memory;
        FT_Error   error;


        len = (FT_UInt)ft_strlen( adobe_name );
        if ( !FT_ALLOC( name, len + 1 ) )
        {
          FT_MEM_COPY( name, adobe_name, len );
          name[len] = 0;
        }

        FT_UNUSED( error );
      }

      return name;
    }
  }
开发者ID:1tgr,项目名称:mobius,代码行数:34,代码来源:cffload.c

示例9: cf2_arrstack_push

  cf2_arrstack_push( CF2_ArrStack  arrstack,
                     const void*   ptr )
  {
    FT_ASSERT( arrstack != NULL );

    if ( arrstack->count == arrstack->allocated )
    {
      /* grow the buffer by one chunk */
      if ( !cf2_arrstack_setNumElements(
             arrstack, arrstack->allocated + arrstack->chunk ) )
      {
        /* on error, ignore the push */
        return;
      }
    }

    FT_ASSERT( ptr != NULL );

    {
      size_t  offset = arrstack->count * arrstack->sizeItem;
      void*   newPtr = (FT_Byte*)arrstack->ptr + offset;


      FT_MEM_COPY( newPtr, ptr, arrstack->sizeItem );
      arrstack->count += 1;
    }
  }
开发者ID:qaisjp,项目名称:green-candy,代码行数:27,代码来源:cf2arrst.c

示例10: get_sfnt_glyph_name

  static FT_Error
  get_sfnt_glyph_name( TT_Face     face,
                       FT_UInt     glyph_index,
                       FT_Pointer  buffer,
                       FT_UInt     buffer_max )
  {
    FT_String*  gname;
    FT_Error    error;


    error = TT_Get_PS_Name( face, glyph_index, &gname );
    if ( !error && buffer_max > 0 )
    {
      FT_UInt  len = (FT_UInt)( ft_strlen( gname ) );


      if ( len >= buffer_max )
        len = buffer_max - 1;

      FT_MEM_COPY( buffer, gname, len );
      ((FT_Byte*)buffer)[len] = 0;
    }

    return error;
  }
开发者ID:SOLARIC,项目名称:world-opponent-network,代码行数:25,代码来源:sfdriver.c

示例11: ft_gzip_file_io

static FT_ULong
ft_gzip_file_io( FT_GZipFile  zip,
                 FT_ULong     pos,
                 FT_Byte*     buffer,
                 FT_ULong     count )
{
    FT_ULong  result = 0;
    FT_Error  error;


    /* Reset inflate stream if we're seeking backwards.        */
    /* Yes, that is not too efficient, but it saves memory :-) */
    if ( pos < zip->pos )
    {
        error = ft_gzip_file_reset( zip );
        if ( error )
            goto Exit;
    }

    /* skip unwanted bytes */
    if ( pos > zip->pos )
    {
        error = ft_gzip_file_skip_output( zip, (FT_ULong)( pos - zip->pos ) );
        if ( error )
            goto Exit;
    }

    if ( count == 0 )
        goto Exit;

    /* now read the data */
    for (;;)
    {
        FT_ULong  delta;


        delta = (FT_ULong)( zip->limit - zip->cursor );
        if ( delta >= count )
            delta = count;

        FT_MEM_COPY( buffer, zip->cursor, delta );
        buffer      += delta;
        result      += delta;
        zip->cursor += delta;
        zip->pos    += delta;

        count -= delta;
        if ( count == 0 )
            break;

        error = ft_gzip_file_fill_output( zip );
        if ( error )
            break;
    }

Exit:
    return result;
}
开发者ID:bowlofstew,项目名称:Aquaria,代码行数:58,代码来源:ftgzip.c

示例12: FT_Bitmap_Copy

  FT_Bitmap_Copy( FT_Library        library,
                  const FT_Bitmap  *source,
                  FT_Bitmap        *target)
  {
    FT_Memory  memory = library->memory;
    FT_Error   error  = FT_Err_Ok;
    FT_Int     pitch  = source->pitch;
    FT_ULong   size;


    if ( source == target )
      return FT_Err_Ok;

    if ( source->buffer == NULL )
    {
      *target = *source;

      return FT_Err_Ok;
    }

    if ( pitch < 0 )
      pitch = -pitch;
    size = (FT_ULong)( pitch * source->rows );

    if ( target->buffer )
    {
      FT_Int    target_pitch = target->pitch;
      FT_ULong  target_size;


      if ( target_pitch < 0  )
        target_pitch = -target_pitch;
      target_size = (FT_ULong)( target_pitch * target->rows );

      if ( target_size != size )
        (void)FT_QREALLOC( target->buffer, target_size, size );
    }
    else
      (void)FT_QALLOC( target->buffer, size );

    if ( !error )
    {
      unsigned char *p;


      p = target->buffer;
      *target = *source;
      target->buffer = p;

      FT_MEM_COPY( target->buffer, source->buffer, size );
    }

    return error;
  }
开发者ID:151706061,项目名称:PDFium,代码行数:54,代码来源:fxft_ftbitmap.c

示例13: ft_outline_glyph_init

  static FT_Error
  ft_outline_glyph_init( FT_OutlineGlyph  glyph,
                         FT_GlyphSlot     slot )
  {
    FT_Error     error   = FT_Err_Ok;
    FT_Library   library = FT_GLYPH(glyph)->library;
    FT_Outline*  source  = &slot->outline;
    FT_Outline*  target  = &glyph->outline;


    /* check format in glyph slot */
    if ( slot->format != ft_glyph_format_outline )
    {
      error = FT_Err_Invalid_Glyph_Format;
      goto Exit;
    }

    /* allocate new outline */
    error = FT_Outline_New( library, source->n_points, source->n_contours,
                            &glyph->outline );
    if ( error )
      goto Exit;

    /* copy it */
    FT_MEM_COPY( target->points, source->points,
              source->n_points * sizeof ( FT_Vector ) );

    FT_MEM_COPY( target->tags, source->tags,
              source->n_points * sizeof ( FT_Byte ) );

    FT_MEM_COPY( target->contours, source->contours,
              source->n_contours * sizeof ( FT_Short ) );

    /* copy all flags, except the `ft_outline_owner' one */
    target->flags = source->flags | ft_outline_owner;

  Exit:
    return error;
  }
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:39,代码来源:ftglyph.c

示例14: cff_get_glyph_name

  static FT_Error
  cff_get_glyph_name( CFF_Face    face,
                      FT_UInt     glyph_index,
                      FT_Pointer  buffer,
                      FT_UInt     buffer_max )
  {
    CFF_Font            font   = (CFF_Font)face->extra.data;
    FT_Memory           memory = FT_FACE_MEMORY( face );
    FT_String*          gname;
    FT_UShort           sid;
    FT_Service_PsCMaps  psnames;
    FT_Error            error;


    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );
    if ( !psnames )
    {
      FT_ERROR(( "cff_get_glyph_name:" ));
      FT_ERROR(( " cannot get glyph name from CFF & CEF fonts\n" ));
      FT_ERROR(( "                   " ));
      FT_ERROR(( " without the `PSNames' module\n" ));
      error = CFF_Err_Unknown_File_Format;
      goto Exit;
    }

    /* first, locate the sid in the charset table */
    sid = font->charset.sids[glyph_index];

    /* now, lookup the name itself */
    gname = cff_index_get_sid_string( &font->string_index, sid, psnames );

    if ( gname && buffer_max > 0 )
    {
      FT_UInt  len = (FT_UInt)ft_strlen( gname );


      if ( len >= buffer_max )
        len = buffer_max - 1;

      FT_MEM_COPY( buffer, gname, len );
      ((FT_Byte*)buffer)[len] = 0;
    }

    FT_FREE( gname );
    error = CFF_Err_Ok;

    Exit:
      return error;
  }
开发者ID:EgoIncarnate,项目名称:Infinity,代码行数:49,代码来源:cffdrivr.c

示例15: afm_atoindex

  /* read a glyph name and return the equivalent glyph index */
  static FT_UInt
  afm_atoindex( FT_Byte**  start,
                FT_Byte*   limit,
                T1_Font    type1 )
  {
    FT_Byte*    p = *start;
    FT_PtrDist  len;
    FT_UInt     result = 0;
    char        temp[64];


    /* skip whitespace */
    while ( p < limit                                             &&
            ( *p == ' ' || *p == '\t' || *p == ':' || *p == ';' ) )
      p++;
    *start = p;

    /* now, read glyph name */
    while ( p < limit && IS_ALPHANUM( *p ) )
      p++;

    len = p - *start;

    if ( len > 0 && len < 64 )
    {
      FT_Int  n;


      /* copy glyph name to intermediate array */
      FT_MEM_COPY( temp, *start, len );
      temp[len] = 0;

      /* lookup glyph name in face array */
      for ( n = 0; n < type1->num_glyphs; n++ )
      {
        char*  gname = (char*)type1->glyph_names[n];


        if ( gname && gname[0] == temp[0] && ft_strcmp( gname, temp ) == 0 )
        {
          result = n;
          break;
        }
      }
    }
    *start = p;
    return result;
  }
开发者ID:Bracket-,项目名称:psp-ports,代码行数:49,代码来源:t1afm.c


注:本文中的FT_MEM_COPY函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。