## Printer Device Driver

[prev][next][parent][TOC]

### Font Support

The example plotter driver code supports only one device font. The HP-GL/2 or IBM-GL font named Stick is the plotter driver's default font. This font is a fixed-spaced, scalable font. A fixed-spaced, scalable font is one that can be scaled to any character width and height by setting the character attribute CBB_BOX. As soon as the font is scaled, the width of all characters will be constant.

Changing the code to support another fixed-spaced, scalable font is not difficult and can be achieved through the following steps:

1.Add a data structure to PLOTTERS.C enumerating the FONTMETRICS information of each supported font.
2.Change the PlotterClass data structure in PLOTTERS.C to include a bit fields defining which fonts each device supports and the appropriate default font.
3.Modify the initialize_pdevice() function in ENABLE.C to set the correct default device font.
4.In FONT.C, make DeviceQueryFonts() return the additional fonts and make RealizeFont() select the font.

Adding proportional-spaced fonts requires the following additional changes:

1.In FONT.C, modify cpxfm_metrics() to scale the width of all the characters in the font.
2.Change the character positioning functions QueryTextBox(), QueryWidthTable(), and QueryCharPositions() to use the proportional font character width and kerning information.