www.delorie.com/gnu/docs/hp2xx/hp2xxinf_28.html   search  
 
Buy GNU books!


HP2XX, A HP-GL Converter

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.4 Font coding

This section is intended for those few users who might care to improve the built-in character set of hp2xx.

HP-GL plotters feature built-in fonts with both fixed and variable-width characters. There are commands for font selection and quick switching between two pre-selected fonts, and there is also a way for users to download own character definitions.

hp2xx currently features just a few fixed-width character sets.

If you plan to modify these characters set or to add more, you need an understanding of how characters are drawn by hp2xx. The source file `charset.h' contains a comment explaining this procedure. Below you find a (modified) copy of this:

 
 This file defines a standard character set by elementary
 "draw" & "move" commands. The format is a very compact one from
 the old days where every byte was still appreciated.

 A font or character set is an array of strings. Each character is
 addressed by its ASCII code.

 A character is a (NULL-terminated) string of bytes. Each byte
 codes for a draw or move action according to the code below:

     Bit: 7 6 5 4 3 2 1 0
          p x x x y y y y

 p:    Plot flag. If set, "draw to" new point, else "move to" it.
 xxx:  3-bit unsigned integer  (0...7). X coordinate of new point.
 yyyy: 4-bit unsigned integer (0..15). Y coordinate of new point.

 The baseline is y = 4 instead of y = 0, so characters with parts
 below it can be drawn properly. Function "code_to_ucoord" transforms
 these coordinates into actual user coordinates.

 Example:  code for character 'L': "\032\224\324" translates to:
           moveto(1,10); drawto(1,4); drawto(5,4);


 From the example you can conclude that the font below essentially is
 defined on a 5x7 grid:

         0 1 2 3 4 5 6 7
     15  - - - - - - - -     - : unused
     14  - - - - - - - -     # : always used
     13  - - - - - - - -     o : sometimes used
     12  - - - - - - - -
     11  - - - - - - - -
     10  o # # # # # - -
      9  o # # # # # - -
      8  o # # # # # - -
      7  o # # # # # - -
      6  o # # # # # - -
      5  o # # # # # - -
      4  o # # # # # - -
      3  o o o o o o - -
      2  o o o o o o - -
      1  o o o o o o - -
      0  o o o o o o - -


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003