Back to index

scribus-ng  1.3.4.dfsg+svn20071115
Functions
ftface.cpp File Reference
#include "fonts/ftface.h"
#include <qobject.h>
#include <qfile.h>
#include "scfonts.h"
#include "util.h"
#include "fonts/scfontmetrics.h"

Go to the source code of this file.

Functions

FT_Error ftIOFunc (FT_Stream stream, unsigned long pos, unsigned char *buffer, unsigned long count)
 copied from Freetype's FT_Stream_ReadAt()

Function Documentation

FT_Error ftIOFunc ( FT_Stream  stream,
unsigned long  pos,
unsigned char *  buffer,
unsigned long  count 
)

copied from Freetype's FT_Stream_ReadAt()

Definition at line 264 of file ftface.cpp.

{
    FT_Error  error = FT_Err_Ok;
    FT_ULong  read_bytes;
       
    if ( pos >= stream->size )
    {
              qDebug( "ftIOFunc: invalid i/o; pos = 0x%lx, size = 0x%lx\n",
                               pos, stream->size );
              
              return FT_Err_Invalid_Stream_Operation;
    }
       
    if ( stream->read )
              read_bytes = stream->read( stream, pos, buffer, count );
    else
    {
              read_bytes = stream->size - pos;
              if ( read_bytes > count )
                     read_bytes = count;
              
              memcpy( buffer, stream->base + pos, read_bytes );
    }
       
    stream->pos = pos + read_bytes;
       
    if ( read_bytes < count )
    {
              qDebug( "ftIOFunc: invalid read; expected %lu bytes, got %lu\n",
                               count, read_bytes );
              
              error = FT_Err_Invalid_Stream_Operation;
    }
       
    return error;
}

Here is the caller graph for this function: