next up previous contents index
Next: Administrative Information Up: Common Information on Fonts Previous: Metric Information on Glyphs   Contents   Index


Character-Encoding Relation

 char *T1_GetCharName( int FontID, char char1)

to 0pt This function returns the name of the character indexed by char1 according to the current encoding vector. As said above, the memory where the string is stored is static to this function so that the user should not free the returned pointer. If the font is not loaded, NULL is returned.

 int T1_GetEncodingIndex( int FontID, char *char1)

to 0pt This function is the complement to the above function. It returns the lowest index of the character with the specified name in the current encoding vector as an int. If the charactername is not found in the current encoding vector or if the font is not loaded, the value -1 is returned.

 int *T1_GetEncodingIndices( int FontID, char *char1)

to 0pt This function is an extension of the above function. It is meant for cases where all appearences of char1 in the encoding vector are requested. The return value is an integer array whose elements contain the encoding indices where char1 appears in increasing order. The first negative entry in this array indicates that no more valid indices will follow. In the most extreme case we can think of (i.e., where the complete encoding vector is occupied by one character), T1_GetEncodingIndices() will return an array of size 257 where the first 256 elements bear their own index and the 257th element is . If font FontID is not loaded, this function returns NULL and T1_errno will be set appropriately. If char1 was not found in the encoding vector, a valid array is returned but the first element will be .

 char **T1_GetAllCharNames( int FontID)

to 0pt As described in [*], not all characters of a font need to be encoded. A Type 1 may contain the outlines of an arbitrary number of characters, but only 256 can be encoded--and thus accessed--simultaneously. Since the characternames are inside the encrypted portion of the Type 1 font file, there is no easy way to find out which characters a font defines.

t1lib provides T1_GetAllCharNames() for situations where a programmer needs to know what characters are defined in the font file identified by FontID. The value returned is a pointer to an array of char pointers which in turn point to the characternames. The array's size is where is the number of defined outlines. The )th pointer is NULL to indicate the end of the array. An application programmer may use these characternames to construct a specialized encoding vector. Here is an example of how to use T1_GetAllCharNames(). It prints a list of all defined characternames in font 0.

 char **ptr;
 int i;
 .
 .
 .
 ptr=T1_GetAllCharNames( 0);
 i=0;
 while (ptr[i]!=NULL){
   printf("Charstring %d = %s\n", i, ptr[i]);
   i++;
 }

The memory for storing the pointers and the charactername strings is static in
T1_GetAllCharNames(). Thus it remains valid until the function is called the next time. The user should not free this memory or if he does, he should set the pointer to NULL to indicate the memory has already been freed.

 int T1_GetNoKernPairs( int FontID)

to 0pt This function returns the number of kerning pairs defined for the font identified by FontID. The number -1 is returned if an error occured and T1_errno will be set. All positive numbers including 0 should be considered valid return values.


next up previous contents index
Next: Administrative Information Up: Common Information on Fonts Previous: Metric Information on Glyphs   Contents   Index
2005-01-12