FreeType_2.1.2 API Reference
Whole document tree
    

Whole document tree

FreeType_2.1.2 API Reference

FreeType_2.1.2 API Reference

SFNT Names

The TrueType and OpenType specification allow the inclusion of a special `names table' in font files. This table contains textual (and internationalized) information regarding the font, like family name, copyright, version, etc.

The definitions below are used to access them if available.

Note that this has nothing to do with glyph names!


FT_SfntName


  typedef struct  FT_SfntName_
  {
    FT_UShort  platform_id;
    FT_UShort  encoding_id;
    FT_UShort  language_id;
    FT_UShort  name_id;

    FT_Byte*   string;      /* this string is *not* null-terminated! */
    FT_UInt    string_len;  /* in bytes */

  } FT_SfntName;

A structure used to model an SFNT `name' table entry.


fields
platform_id

The platform ID for `string'.

encoding_id

The encoding ID for `string'.

language_id

The language ID for `string'.

name_id

An identifier for `string'.

string

The `name' string. Note that its format differs depending on the (platform,encoding) pair. It can be a Pascal String, a UTF-16 one, etc..

Generally speaking, the string is not zero-terminated. Please refer to the TrueType specification for details..

string_len

The length of `string' in bytes.

note

Possible values for `platform_id', `encoding_id', `language_id', and `name_id' are given in the file `ttnameid.h'. For details please refer to the TrueType or OpenType specification.


FT_Get_Sfnt_Name_Count


  FT_EXPORT( FT_UInt )
  FT_Get_Sfnt_Name_Count( FT_Face  face );

Retrieves the number of name strings in the SFNT `name' table.


input
face

A handle to the source face.

return

The number of strings in the `name' table.


FT_Get_Sfnt_Name


  FT_EXPORT( FT_Error )
  FT_Get_Sfnt_Name( FT_Face       face,
                    FT_UInt       idx,
                    FT_SfntName  *aname );

Retrieves a string of the SFNT `name' table for a given index.


input
face

A handle to the source face.

idx

The index of the `name' string.

output
aname

The indexed FT_SfntName structure.

return

FreeType error code. 0 means success.

note

The `string' array returned in the `aname' structure is not null-terminated.

Use FT_Get_Sfnt_Name_Count() to get the total number of available `name' table entries, then do a loop until you get the right platform, encoding, and name ID.


FT_Stream


  typedef struct FT_StreamRec_*    FT_Stream;

handle to an input stream object. These are also ?FT_Object handles



FT_Stream_Class


  typedef const struct FT_Stream_ClassRec_*   FT_Stream_Class;

opaque handle to a FT_Stream_ClassRec class structure describing the methods of input streams



FT_Stream_ReadFunc


  typedef FT_ULong  (*FT_Stream_ReadFunc)( FT_Stream   stream,
                                           FT_Byte*    buffer,
                                           FT_ULong    size );

a method used to read bytes from an input stream into memory


input
stream

target stream handle

buffer

target buffer address

size

number of bytes to read

return

number of bytes effectively read. Must be <= 'size'.


FT_Stream_SeekFunc


  typedef FT_Error  (*FT_Stream_SeekFunc)( FT_Stream   stream,
                                           FT_ULong    pos );

a method used to seek to a new position within a stream


input
stream

target stream handle

pos

new read position, from start of stream

return

error code. 0 means success


FT_Stream_ClassRec


  typedef struct FT_Stream_ClassRec_
  {
    FT_ClassRec          clazz;
    FT_Stream_ReadFunc   stream_read;
    FT_Stream_SeekFunc   stream_seek;

  } FT_Stream_ClassRec;

a structure used to describe an input stream class


input
clazz

root ?FT_ClassRec fields

stream_read

stream byte read method

stream_seek

stream seek method


FT_StreamRec


  typedef struct FT_StreamRec_
  {
    FT_ObjectRec        object;
    FT_ULong            size;
    FT_ULong            pos;
    const FT_Byte*      base;
    const FT_Byte*      cursor;
    const FT_Byte*      limit;

  } FT_StreamRec;

the input stream object structure. See FT_Stream_ClassRec for its class descriptor


fields
object

root ?FT_ObjectRec fields

size

size of stream in bytes (0 if unknown)

pos

current position within stream

base

for memory-based streams, the address of the stream's first data byte in memory. NULL otherwise

cursor

the current cursor position within an input stream frame. Only valid within a FT_FRAME_ENTER .. FT_FRAME_EXIT block; NULL otherwise

limit

the current frame limit within a FT_FRAME_ENTER .. FT_FRAME_EXIT block. NULL otherwise


FT_Memory


  typedef struct FT_MemoryRec_*   FT_Memory;

opaque handle to a memory manager handle. Note that since FreeType 2.2, the memory manager structure FT_MemoryRec is hidden to client applications.

however, you can still define custom allocators easily using the ft_memory_new API



FT_Memory_AllocFunc


  typedef FT_Pointer  (*FT_Memory_AllocFunc)( FT_ULong   size,
                                              FT_Pointer mem_data );

a function used to allocate a block of memory.


input
size

size of blocks in bytes. Always > 0 !!

mem_data

memory-manager specific optional argument (see ft_memory_new )

return

address of new block. NULL in case of memory exhaustion


FT_Memory_FreeFunc


  typedef void        (*FT_Memory_FreeFunc) ( FT_Pointer  block,
                                              FT_Pointer  mem_data );

a function used to release a block of memory created through FT_Memory_AllocFunc or FT_Memory_ReallocFunc


input
block

address of target memory block. cannot be NULL !!

mem_data

memory-manager specific optional argument (see ft_memory_new )


FT_Memory_ReallocFunc


  typedef FT_Pointer  (*FT_Memory_ReallocFunc)( FT_Pointer   block,
                                                FT_ULong     new_size,
                                                FT_ULong     cur_size,
                                                FT_Pointer   mem_data );

a function used to reallocate a memory block.


input
block

address of target memory block. cannot be NULL !!

new_size

new requested size in bytes

cur_size

current block size in bytes

mem_data

memory-manager specific optional argument (see ft_memory_new )


FT_Memory_CreateFunc


  typedef FT_Pointer  (*FT_Memory_CreateFunc)( FT_UInt     size,
                                               FT_Pointer  init_data,
                                               FT_Pointer *amem_data );

a function used to create a FT_Memory object to model a memory manager


input
size

size of memory manager structure in bytes

init_data

optional initialisation argument

output
amem_data

memory-manager specific argument to block management routines.

return

handle to new memory manager object. NULL in case of failure


FT_Memory_DestroyFunc


  typedef void        (*FT_Memory_DestroyFunc)( FT_Memory  memory,
                                                FT_Pointer mem_data );

a function used to destroy a given FT_Memory manager


input
memory

target memory manager handle

mem_data

option manager-specific argument


FT_Memory_FuncsRec


  typedef struct FT_Memory_FuncsRec_
  {
    FT_Memory_AllocFunc     mem_alloc;
    FT_Memory_FreeFunc      mem_free;
    FT_Memory_ReallocFunc   mem_realloc;
    FT_Memory_CreateFunc    mem_create;
    FT_Memory_DestroyFunc   mem_destroy;

  } FT_Memory_FuncsRec, *FT_Memory_Funcs;

a function used to hold all methods of a given memory manager implementation.


fields
mem_alloc

block allocation routine

mem_free

block release routine

mem_realloc

block re-allocation routine

mem_create

manager creation routine

mem_destroy

manager destruction routine


FT_Memory_Funcs


  typedef const FT_Memory_FuncsRec*  FT_Memory_Funcs;

a pointer to a constant FT_Memory_FuncsRec structure used to describe a given memory manager implementation.



ft_memory_new


  FT_BASE( FT_Memory )
  ft_memory_new( FT_Memory_Funcs  mem_funcs,
                 FT_Pointer       mem_init_data );

create a new memory manager, given a set of memory methods


input
mem_funcs

handle to memory manager implementation descriptor

mem_init_data

optional initialisation argument, passed to FT_Memory_CreateFunc

return

new memory manager handle. NULL in case of failure


ft_memory_destroy


  FT_BASE( void )
  ft_memory_destroy( FT_Memory  memory );

destroy a given memory manager


input
memory

handle to target memory manager


generated on Sun Jun 23 13:01:54 2002