Bristol Wearable Computing

[ Home | Plans | Meetings | Members | Search | Papers | Links | CyberWear | LocoSoft]

PostScipt Subset Functionality

    In order to allow some freedom of expression on the handheld device, for instance, we need to provide more than just "here's some text, and here's a GIF - display it". The reader of the MIME message will read each content in turn.

    We can introduce limited PostScipt functionality for this project to enable a standard way of moving the cursor poistion, placing text and drawing and filling shapes which will enable use to construct an image to the screen easily. After every content in the MIME message, say after a GIF image, we can place a PostScipt content type containg instructions to move the cursor position and draw a line over the GIF. Then we could move the cursor position again and then have the next content type which could be text. So an example MIME message with the included PostScript information could yield the below image to the display device:

Content-type: application/postscript/Nino

72 72 moveto

Content-type: image/gif

<GIF image data>

Content-type: application/postscript/Nino

/inch {72 mul} def
1 inch 1 inch moveto
2 inch 2 inch rlineto
0 0 moveto

Content-type: text/plain

This is the image

screen2.gif (10572 bytes)


The Currently Supported Postscript Functionality

      The initial settings for the varaibles are as follows:

One can select normal fonts, italic or bold or both. Selecting a gray level will impact the gray level or all subsequent stokes, fills and text.

N.B. As with standard Postscript, the (0,0) co-ordinate is the bottom-left of the page. Even though the Windows addressing is from the top left, the co-ordinated passed are automatically changed for you.

Keyword:      Action:    Syntax:
add        pops and adds top two operands, pushs result    op1 op2 add result
closepath        automatically closes a path from the first point to the last    closepath
def        allows dictionary definitions    <....>. def
div        pops and divides top two operands, pushes result    op1 op2 div result
dup        duplicates topmost operand (numbers only)    dup
fill        fills the current path, then removes path    fill
findfont        locates a specified font    /<font> findfont font
lineto        adds a line path from current position to specified position    x y lineto
moveto        moves current position to specified position    x y moveto
mul        pops and multiplies top two operands, pushs result    op1 op2 mul result
newpath        resets the current path to nil    newpath
rlineto        adds a line from current position to specified relative position    dx dy rlineto
rmoveto        moves to the relative specified position    dx dy rmoveto
scalefont        scales the loaded font    font scalefont font
    setfont        sets the loaded font to the font to be used    font setfont
setgray        sets the gray level between 0 and 1    0.x setgray
setlinewidth        sets line width in points    width setlinewidth
show        pops off text and displays it    (text) show
showpage        commits page to print    showpage
stroke        stroke the current path, reset path    stroke
sub        pops and subtracts top two operands, pushs result    op1 op2 sub

    N.B. There is currently a bug if you try and use dictionary definitions (font lookups are fine). Please avoid for the time being (Mike's map app for instance does not use any macros like /inch {72 mul} def).


    In addition to the above postscript commands, there is now a "hotbox" creation function hotbox - since this does not obviously conform to normal postscript, it does NOT use or alter the current cursor position, instead it accpets the bottom left corner position, its width and height (again in points), a unique identifier number from 0 and above (NOT negative), and any text you want displayed in the centre of the box (use "( )" empty brackets to indicate no text:

<bottom left x> <bottom left y> <hotbox width> <hotbox height> <unique ID num> <(text)> hotbox

Examples:               72 72 100 30 0 (OK) hotbox    - creates a hotbox starting at (72,72) with width 100 and height 30 points, ID 0 and text "OK" in the box
                               100 200 50 50 1 () hotbox        - creates a hotbox starting at (100,200) with width 50 and height 50, ID 1 and no text in the box


unicrest.gif (4191 bytes)

The material displayed is provided 'as is' and is subject to use restrictions.
For problems or questions regarding this web contact Cliff Randell.
Last updated: January 14, 2000.
logoep.gif (1404 bytes)
ęCopyright Hewlett-Packard 1997-2000.