next up previous contents index
Next: Limits of the X11 Up: The X11-Interface Previous: Rastering Functions   Contents   Index


Creating XPM-Files from t1lib-Glyphs

The creation XPM files is not supported directly in t1lib. Rather, there is a utility function which prepares what is necessary and leaves the creation of the Pixmap file to the one and only authority, to the Pixmap library. The required function is:

 XImage *T1_XImageFromGlyph( GLYPH *glyph)

to 0pt \fbox{$\mathcal{F}()\Rightarrow$} It creates an X11 image from a valid t1lib-glyph of arbitrary depth, padding and antialiasing configuration and returns the pointer to the newly created structure. This image can later be dumped into an XPM file using the XPM library function XpmWriteFileFromImage(). The following code fragment shows how easy this really is. It assumes that the program containing that code is additionally linked with the XPM library.
 .
 .
 .
 ximage=T1_XImageFromGlyph( glyph);   /* generate ximage containg the glyph */
 /* write pixmap file */
 XpmWriteFileFromImage( display, "glyphtest.xpm", ximage, NULL, NULL); 
 ximage->data=NULL;
 XDestroyImage( ximage);
 .
 .
 .
As already shown in this example code, the user has to take care for that XDestroyImage() does not free the glyph's bitmap. This achieved by setting ximage->data to NULL.

Having an XPM file from a t1lib-glyph it should easily be possible to create graphic files of arbitrary formats, e.g., by using xv.


next up previous contents index
Next: Limits of the X11 Up: The X11-Interface Previous: Rastering Functions   Contents   Index
2004-10-04