next up previous contents index
Next: Using Outlines Up: Interface to Outlines Previous: Interface to Outlines   Contents   Index


Outline Format

Before going into implementation details the general structure of a Type 1 outline is described. We will consider the simple fictive character whose outline is shown in figure [*].
Figure: The outline of a fictive character.


We assume that scaling, grid fitting and hinting has already been carried out. Then, the outline is given by set of points and segments connecting those points. There are: For Type 1 fonts in general, the following rules for interpreting coordinate specifications hold: Additionally, for this special rasterizer implementation, the following terms apply:

Before describing the functions for retrieving outlines the format in which outlines are presented in C will be described. A point specification is done in the following structure:

typedef struct {
  long x;
  long y;
} T1_PATHPOINT;
x and y are fractional pixels as described above.

An outline is represented by a linked list of structures which describe path segments of the type described above. Line- and Move-segments are described by the following structure:

typedef struct pathsegment {  
  char type;                
  unsigned char flag;       
  short references;         
  unsigned char size;       
  unsigned char context;    
  struct pathsegment *link; 
  struct pathsegment *last; 
  T1_PATHPOINT    dest;     
} T1_PATHSEGMENT;
type is either T1_PATHTYPE_MOVE or T1_PATHTYPE_LINE. flag, references, size and context are internally used by the rasterizer. link is a pointer to the next segment structure or NULL in case it is the last structure in the list. Finally, the last-entry is a pointer to the last structure in the linked list. last is only set in the first segment and is reset to NULL in the remaining segment structures. A Bezier-segment is described by the following structure:
typedef struct bezierpathsegment {
  char type;              
  unsigned char flag;     
  short references;       
  unsigned char size;     
  unsigned char context;  
  T1_PATHSEGMENT *link;   
  T1_PATHSEGMENT *last;   
  T1_PATHPOINT    dest;   
  T1_PATHPOINT    B;      
  T1_PATHPOINT    C;      
} T1_BEZIERSEGMENT;
Obviously, the format is identical to that for straight path segments, extended by the entries B and C which specify the control points as described earlier in this subsection. The common return type for the outline retrieving functions is a pointer to T1_OUTLINE, which is in fact identical to T1_PATHSEGMENT. This purely for convention. Although it is quite unlikely, an outline might start with a Bezier-segment. To access Bezier-segment elements, a cast must be used.


next up previous contents index
Next: Using Outlines Up: Interface to Outlines Previous: Interface to Outlines   Contents   Index
2005-01-12