FreeType_2.1.2 API Reference
Whole document tree
    

Whole document tree

FreeType_2.1.2 API Reference

FreeType_2.1.2 API Reference

Basic Data Types

This section contains the basic data types defined by FreeType 2, ranging from simple scalar types to bitmap descriptors. More font-specific structures are defined in a different section.


FT_Byte


  typedef unsigned char  FT_Byte;

A simple typedef for the _unsigned_ char type.



FT_Char


  typedef signed char  FT_Char;

A simple typedef for the _signed_ char type.



FT_Int


  typedef int  FT_Int;

A typedef for the int type.



FT_UInt


  typedef unsigned int  FT_UInt;

A typedef for the unsigned int type.



FT_Short


  typedef signed short  FT_Short;

A typedef for signed short.



FT_UShort


  typedef unsigned short  FT_UShort;

A typedef for unsigned short.



FT_Long


  typedef signed long  FT_Long;

A typedef for signed long.



FT_ULong


  typedef unsigned long  FT_ULong;

A typedef for unsigned long.



FT_Bool


  typedef unsigned char  FT_Bool;

A typedef of unsigned char, used for simple booleans.



FT_Offset


  typedef size_t  FT_Offset;

This is equivalent to the ANSI C `size_t' type, i.e. the largest _unsigned_ integer type used to express a file size or position, or a memory block size.



FT_PtrDist


  typedef size_t  FT_PtrDist;

This is equivalent to the ANSI C `ptrdiff_t' type, i.e. the largest _signed_ integer type used to express the distance between two pointers.



FT_String


  typedef char  FT_String;

A simple typedef for the char type, usually used for strings.



FT_Error


  typedef int  FT_Error;

The FreeType error code type. A value of 0 is always interpreted as a successful operation.



FT_Fixed


  typedef signed long  FT_Fixed;

This type is used to store 16.16 fixed float values, like scales or matrix coefficients.



FT_Pointer


  typedef void*  FT_Pointer;

A simple typedef for a typeless pointer.



FT_Pos


  typedef signed long  FT_Pos;

The type FT_Pos is a 32-bit integer used to store vectorial coordinates. Depending on the context, these can represent distances in integer font units, or 26.6 fixed float pixel coordinates.



FT_Vector


  typedef struct  FT_Vector_
  {
    FT_Pos  x;
    FT_Pos  y;

  } FT_Vector;

A simple structure used to store a 2D vector; coordinates are of the FT_Pos type.


fields
x

The horizontal coordinate.

y

The vertical coordinate.


FT_BBox


  typedef struct  FT_BBox_
  {
    FT_Pos  xMin, yMin;
    FT_Pos  xMax, yMax;

  } FT_BBox;

A structure used to hold an outline's bounding box, i.e., the coordinates of its extrema in the horizontal and vertical directions.


fields
xMin

The horizontal minimum (left-most).

yMin

The vertical minimum (bottom-most).

xMax

The horizontal maximum (right-most).

yMax

The vertical maximum (top-most).


FT_Matrix


  typedef struct  FT_Matrix_
  {
    FT_Fixed  xx, xy;
    FT_Fixed  yx, yy;

  } FT_Matrix;

A simple structure used to store a 2x2 matrix. Coefficients are in 16.16 fixed float format. The computation performed is:

 
          x' = x*xx + y*xy 
          y' = x*yx + y*yy 

fields
xx

Matrix coefficient.

xy

Matrix coefficient.

yx

Matrix coefficient.

yy

Matrix coefficient.


FT_FWord


  typedef signed short  FT_FWord;   /* distance in FUnits */

A signed 16-bit integer used to store a distance in original font units.



FT_UFWord


  typedef unsigned short  FT_UFWord;  /* unsigned distance */

An unsigned 16-bit integer used to store a distance in original font units.



FT_F2Dot14


  typedef signed short  FT_F2Dot14;

A signed 2.14 fixed float type used for unit vectors.



FT_UnitVector


  typedef struct  FT_UnitVector_
  {
    FT_F2Dot14  x;
    FT_F2Dot14  y;

  } FT_UnitVector;

A simple structure used to store a 2D vector unit vector. Uses FT_F2Dot14 types.


fields
x

Horizontal coordinate.

y

Vertical coordinate.


FT_F26Dot6


  typedef signed long  FT_F26Dot6;

A signed 26.6 fixed float type used for vectorial pixel coordinates.



FT_Generic


  typedef struct  FT_Generic_
  {
    void*                 data;
    FT_Generic_Finalizer  finalizer;

  } FT_Generic;

Client applications often need to associate their own data to a variety of FreeType core objects. For example, a text layout API might want to associate a glyph cache to a given size object.

Most FreeType object contains a `generic' field, of type FT_Generic, which usage is left to client applications and font servers.

It can be used to store a pointer to client-specific data, as well as the address of a `finalizer' function, which will be called by FreeType when the object is destroyed (for example, the previous client example would put the address of the glyph cache destructor in the `finalizer' field).


fields
data

A typeless pointer to any client-specified data. This field is completely ignored by the FreeType library.

finalizer

A pointer to a `generic finalizer' function, which will be called when the object is destroyed. If this field is set to NULL, no code will be called.


FT_Generic_Finalizer


  typedef void  (*FT_Generic_Finalizer)(void*  object);

Describes a function used to destroy the `client' data of any FreeType object. See the description of the FT_Generic type for details of usage.


input

The address of the FreeType object which is under finalization. Its client data is accessed through its `generic' field.


FT_Bitmap


  typedef struct  FT_Bitmap_
  {
    int             rows;
    int             width;
    int             pitch;
    unsigned char*  buffer;
    short           num_grays;
    char            pixel_mode;
    char            palette_mode;
    void*           palette;

  } FT_Bitmap;

A structure used to describe a bitmap or pixmap to the raster. Note that we now manage pixmaps of various depths through the `pixel_mode' field.


fields
rows

The number of bitmap rows.

width

The number of pixels in bitmap row.

pitch

The pitch's absolute value is the number of bytes taken by one bitmap row, including padding. However, the pitch is positive when the bitmap has a `down' flow, and negative when it has an `up' flow. In all cases, the pitch is an offset to add to a bitmap pointer in order to go down one row.

buffer

A typeless pointer to the bitmap buffer. This value should be aligned on 32-bit boundaries in most cases.

num_grays

This field is only used with `ft_pixel_mode_grays'; it gives the number of gray levels used in the bitmap.

pixel_mode

The pixel_mode, i.e., how pixel bits are stored.

palette_mode

This field is only used with paletted pixel modes; it indicates how the palette is stored.

palette

A typeless pointer to the bitmap palette; only used for paletted pixel modes.

note

For now, the only pixel mode supported by FreeType are mono and grays. However, drivers might be added in the future to support more `colorful' options.

When using pixel modes pal2, pal4 and pal8 with a void `palette' field, a gray pixmap with respectively 4, 16, and 256 levels of gray is assumed. This, in order to be compatible with some embedded bitmap formats defined in the TrueType specification.

Note that no font was found presenting such embedded bitmaps, so this is currently completely unhandled by the library.


FT_Pixel_Mode


  typedef enum  FT_Pixel_Mode_
  {
    ft_pixel_mode_none = 0,
    ft_pixel_mode_mono,
    ft_pixel_mode_grays,
    ft_pixel_mode_pal2,
    ft_pixel_mode_pal4,
    ft_pixel_mode_pal8,
    ft_pixel_mode_rgb15,
    ft_pixel_mode_rgb16,
    ft_pixel_mode_rgb24,
    ft_pixel_mode_rgb32,

    ft_pixel_mode_max      /* do not remove */

  } FT_Pixel_Mode;

An enumeration type used to describe the format of pixels in a given bitmap. Note that additional formats may be added in the future.


fields
ft_pixel_mode_mono

A monochrome bitmap (1 bit/pixel).

ft_pixel_mode_grays

An 8-bit gray-levels bitmap. Note that the total number of gray levels is given in the `num_grays' field of the FT_Bitmap structure.

ft_pixel_mode_pal2

A 2-bit paletted bitmap. Currently unused by FreeType.

ft_pixel_mode_pal4

A 4-bit paletted bitmap. Currently unused by FreeType.

ft_pixel_mode_pal8

An 8-bit paletted bitmap. Currently unused by FreeType.

ft_pixel_mode_rgb15

A 15-bit RGB bitmap. Uses 5:5:5 encoding. Currently unused by FreeType.

ft_pixel_mode_rgb16

A 16-bit RGB bitmap. Uses 5:6:5 encoding. Currently unused by FreeType.

ft_pixel_mode_rgb24

A 24-bit RGB bitmap. Currently unused by FreeType.

ft_pixel_mode_rgb32

A 32-bit RGB bitmap. Currently unused by FreeType.

note

Some anti-aliased bitmaps might be embedded in TrueType fonts using formats pal2 or pal4, though no fonts presenting those have been found to date.


FT_Palette_Mode


  typedef enum  FT_Palette_Mode_
  {
    ft_palette_mode_rgb = 0,
    ft_palette_mode_rgba,

    ft_palettte_mode_max   /* do not remove */

  } FT_Palette_Mode;

An enumeration type used to describe the format of a bitmap palette, used with ft_pixel_mode_pal4 and ft_pixel_mode_pal8.


fields
ft_palette_mode_rgb

The palette is an array of 3-bytes RGB records.

ft_palette_mode_rgba

The palette is an array of 4-bytes RGBA records.

note

As ft_pixel_mode_pal2, pal4 and pal8 are currently unused by FreeType, these types are not handled by the library itself.


FT_Glyph_Format


  typedef enum  FT_Glyph_Format_
  {
    FT_IMAGE_TAG( ft_glyph_format_none, 0, 0, 0, 0 ),

    FT_IMAGE_TAG( ft_glyph_format_composite, 'c', 'o', 'm', 'p' ),
    FT_IMAGE_TAG( ft_glyph_format_bitmap,    'b', 'i', 't', 's' ),
    FT_IMAGE_TAG( ft_glyph_format_outline,   'o', 'u', 't', 'l' ),
    FT_IMAGE_TAG( ft_glyph_format_plotter,   'p', 'l', 'o', 't' )

  } FT_Glyph_Format;

An enumeration type used to describe the format of a given glyph image. Note that this version of FreeType only supports two image formats, even though future font drivers will be able to register their own format.


fields
ft_glyph_format_composite

The glyph image is a composite of several other images. This glyph format is _only_ used with the FT_LOAD_FLAG_NO_RECURSE flag (XXX: Which is currently unimplemented).

ft_glyph_format_bitmap

The glyph image is a bitmap, and can be described as a FT_Bitmap.

ft_glyph_format_outline

The glyph image is a vectorial image made of bezier control points, and can be described as a FT_Outline.

ft_glyph_format_plotter

The glyph image is a vectorial image made of plotter lines (some T1 fonts like Hershey contain glyph in this format).


FT_IMAGE_TAG


#ifndef FT_IMAGE_TAG
#define FT_IMAGE_TAG( value, _x1, _x2, _x3, _x4 )  \
          value = ( ( (unsigned long)_x1 << 24 ) | \
                    ( (unsigned long)_x2 << 16 ) | \
                    ( (unsigned long)_x3 << 8  ) | \
                      (unsigned long)_x4         )
#endif /* FT_IMAGE_TAG */

This macro converts four letter tags into an unsigned long.



FT_MAKE_TAG


#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
          ( ( (FT_ULong)_x1 << 24 ) |     \
            ( (FT_ULong)_x2 << 16 ) |     \
            ( (FT_ULong)_x3 <<  8 ) |     \
              (FT_ULong)_x4         )

This macro converts four letter tags which are used to label TrueType tables into an unsigned long to be used within FreeType.



generated on Sun Jun 23 13:01:54 2002