This section describes a few functions that provide access to composite
character data of a font file. The data they return can be considered a
mapping of the original AFM data with respect to the current encoding. As
usual, FontID
must be the identifier of a font loaded into memory,
otherwise an appropriate error indicator is returned. The functions described
in the following may also return some other error types.
Firstly,
int T1_GetNoCompositeChars( int FontID)
The function
int T1_QueryCompositeChar( int FontID, char char1)
char1
. If so, it returns the index within in the AFM composite
character data array as a number equal to or greater than zero. If the result
is valid but no composite character information has been found for
char1
, T1_errno
is set to an appropriate value.
The previous function does not tell anything about whether the font
FontID
incorporates a character definition for the composite char or
not. This can be queried using
int T1_IsInternalChar( int FontID, char char1)
char1
and T1_IsInternalChar()
also might return
T1_errno
, which indicates that the font in question is not
loaded.
The information required to construct a composite character is retrieved by calling the function
T1_COMP_CHAR_INFO *T1_GetCompCharData( int FontID, char char1)
T1_COMP_CHAR_INFO
as described above. The composite character and the
number
of pieces as well as a pointer to the array of type T1_COMP_PIECE
are
stored in this structure. Once this information is obtained the composite
character can be constructed by
numPieces
ptr->pieces[
].deltax
and ptr->pieces[
].deltay
, where ptr
is the pointer
returned by the above function.
pieces[0]
), which then also causes
the horizontal escapement of the composite character.
In cases where char1
is not a composite
character, the compchar
entry is set to char1
itself and
numPieces
becomes , as would be expected. The
pieces
pointer
is then set to NULL
. In case of errors, this function returns
NULL
and T1_errno
is setup correspondingly.
The pointer returned by this function should always be free'd using
T1_FreeCompCharData()
in order to avoid memory leaks (see also
Section ).
A function that provides the same functionality is
T1_COMP_CHAR_INFO *T1_GetCompCharDataByIndex( int FontID, int index)
index
in the AFM composite character data array. This function is thus well-suited
for scanning the complete composite character information of a given font in a
given encoding. index
may, for example, be obtained by a call to
T1_QueryCompCharData()
as described above. The valid range for
index
is from T1_GetNoCompositeChars()
minus one. The range of index
is
validated and in case of an error T1_errno
is to
T1ERR_INVALID_PARAMETER
. There may also appear other errors and under any
erroneous condition, NULL
is returned.
The parameter compchar
of the T1_COMP_CHAR_INFO
structure that
is referenced by the returned pointer, bears somewhat more information for
this function than in the case of
T1_GetCompCharData()
. As said it contains the index in the encoding
vector where the composite glyph is encoded. It may also have the vaue ,
which means that the composite character is not encoded. Note that this is not
an error condition.