Exemplo n.º 1
0
FT_Error FX_Activate_Stream( FT_Face face ) {
    FT_ULong ulPos;
    FT_Error error;

    ulPos = face->stream->pos;
    if ( ! STREAM_FILE( face->stream )) {
        error = FT_Stream_Open( face->stream, face->stream->pathname.pointer );
        if ( !error )
            DosSetFilePtr( STREAM_FILE( face->stream ),
                           ulPos, FILE_BEGIN, &(face->stream->pos));
    }
    else
        error = FT_Err_Ok;
    return error;
}
Exemplo n.º 2
0
  ft_ansi_stream_close( FT_Stream  stream )
  {
    ft_fclose( STREAM_FILE( stream ) );

    stream->descriptor.pointer = NULL;
    stream->size               = 0;
    stream->base               = 0;
  }
Exemplo n.º 3
0
  ft_close_stream( FT_Stream  stream )
  {
//  fclose( STREAM_FILE( stream ) );
    Close( STREAM_FILE( stream ) );     // TetiSoft

    stream->descriptor.pointer = NULL;
    stream->size               = 0;
    stream->base               = 0;
  }
Exemplo n.º 4
0
  ft_amiga_stream_close( FT_Stream  stream )
  {
    struct SysFile* sysfile;

    sysfile = STREAM_FILE( stream );
    Close ( sysfile->file );
    FreeMem ( sysfile, sizeof ( struct SysFile ));

    stream->descriptor.pointer = NULL;
    stream->size               = 0;
    stream->base               = 0;
  }
Exemplo n.º 5
0
  ft_FSp_stream_io( FT_Stream       stream,
                    unsigned long   offset,
                    unsigned char*  buffer,
                    unsigned long   count )
  {
    FT_FILE*  file;


    file = STREAM_FILE( stream );

    ft_fseek( file, offset, SEEK_SET );

    return (unsigned long)ft_fread( buffer, 1, count, file );
  }
Exemplo n.º 6
0
  ft_io_stream( FT_Stream       stream,
                unsigned long   offset,
                unsigned char*  buffer,
                unsigned long   count )
  {
//  FILE*  file;
    BPTR   file;        // TetiSoft


    file = STREAM_FILE( stream );

//  fseek( file, offset, SEEK_SET );
    Seek( file, offset, OFFSET_BEGINNING );     // TetiSoft

//  return (unsigned long)fread( buffer, 1, count, file );
    return (unsigned long)FRead( file, buffer, 1, count);
  }
Exemplo n.º 7
0
  ft_ansi_stream_io( FT_Stream       stream,
                     unsigned long   offset,
                     unsigned char*  buffer,
                     unsigned long   count )
  {
    FT_FILE*  file;


    if ( !count && offset > stream->size )
      return 1;

    file = STREAM_FILE( stream );

    if ( stream->pos != offset )
      ft_fseek( file, (long)offset, SEEK_SET );

    return (unsigned long)ft_fread( buffer, 1, count, file );
  }
Exemplo n.º 8
0
FT_Error FX_Flush_Stream( FT_Face face ) {
    DosSetFilePtr( STREAM_FILE( face->stream ),
                   0, FILE_CURRENT, &(face->stream->pos));
    face->stream->close( face->stream );
    return FT_Err_Ok;
}
Exemplo n.º 9
0
  ft_amiga_stream_io( FT_Stream       stream,
                      unsigned long   offset,
                      unsigned char*  buffer,
                      unsigned long   count )
  {
    struct SysFile* sysfile;
    unsigned long   read_bytes;

    if ( count != 0 )
    {
      sysfile = STREAM_FILE( stream );

      /* handle the seek */
      if ( (offset < sysfile->iobuf_start) || (offset + count > sysfile->iobuf_end) )
      {
        /* requested offset implies we need a buffer refill */
        if ( !sysfile->iobuf_end || offset != sysfile->iobuf_end )
        {
          /* a physical seek is necessary */
          Seek( sysfile->file, offset, OFFSET_BEGINNING );
        }
        sysfile->iobuf_start = offset;
        sysfile->iobuf_end = 0; /* trigger a buffer refill */
      }

      /* handle the read */
      if ( offset + count <= sysfile->iobuf_end )
      {
        /* we have buffer and requested bytes are all inside our buffer */
        CopyMem( &sysfile->iobuf[offset - sysfile->iobuf_start], buffer, count );
        read_bytes = count;
      }
      else
      {
        /* (re)fill buffer */
        if ( count <= IOBUF_SIZE )
        {
          /* requested bytes is a subset of the buffer */
          read_bytes = Read( sysfile->file, sysfile->iobuf, IOBUF_SIZE );
          if ( read_bytes == -1UL )
          {
            /* error */
            read_bytes = 0;
          }
          else
          {
            sysfile->iobuf_end = offset + read_bytes;
            CopyMem( sysfile->iobuf, buffer, count );
            if ( read_bytes > count )
            {
              read_bytes = count;
            }
          }
        }
        else
        {
          /* we actually need more than our buffer can hold, so we decide
          ** to do a single big read, and then copy the last IOBUF_SIZE
          ** bytes of that to our internal buffer for later use */
          read_bytes = Read( sysfile->file, buffer, count );
          if ( read_bytes == -1UL )
          {
            /* error */
            read_bytes = 0;
          }
          else
          {
            ULONG bufsize;

            bufsize = ( read_bytes > IOBUF_SIZE ) ? IOBUF_SIZE : read_bytes;
            sysfile->iobuf_end = offset + read_bytes;
            sysfile->iobuf_start = sysfile->iobuf_end - bufsize;
            CopyMem( &buffer[read_bytes - bufsize] , sysfile->iobuf, bufsize );
          }
        }
      }
    }
    else
    {
      read_bytes = 0;
    }

    return read_bytes;
  }