[gs-devel] Writing an HPGL driver (with extra xefitra)

Christian Brunschen christian.brunschen at gmail.com
Mon Apr 28 12:02:16 PDT 2008


Hi all,

I acquired an HP 7550B plotter that speaks HP-GL/2 . I want to be able  
to use it as a more-or-less general-purpose output device, and to that  
purpose I am writing an HPGL driver for Ghostscript (entirely for my  
own use at this time).

Why yes, I *am* aware that I'm crazy, thank you! :)

By implementing the 'fill_path' and 'fill_rectangle' procedures, I am  
able to capture most of the drawing that happens. This includes text  
being rendered, where one call is made to 'fill_rectangle' for each 1- 
device-coordinate-tall rectangle that would be rendered if the plotter  
were a raster device.

While this works, it's not really satisfactory, especially for the  
case where the font is represented as outlines in some fashion. In  
order to best render text, I would love to get access to the glyph  
outlines, or those fonts where this is possible. (For any other fonts,  
intercepting 'fill_rectangle" is workable and does give a usable, if  
not perfect, result.)

I was thinking of checking in text_begin whether the operation was a  
drawing operation. If this was the case I would start an almost  
exactly duplicated text enumeration, but with a charpath operation  
instead, collect the outlines, etc. However, this won't collect  
anything if the font in use isn't an outline one or doesn't support  
collecting its actual outlines, in which case just letting things fall  
through to being rastrised and eventually calling 'fill_rectangle'  
wold have been better.

If anyone could advice me on what to do, ideally pointing me to some  
example code, that would be very much appreciated.

(I have a few other questions (mainly relating to colours and such) as  
well, but I think I'll just ask one of them at a time.)

Best wishes,

// Christian Brunschen




More information about the gs-devel mailing list