[comp.windows.news] Variable brightness/shape cursors in NeWS

don@BRILLIG.UMD.EDU (Don Hopkins) (01/26/89)

Here's some code that tests out user definable fonts as cursors. The
cursor machinery seems to use the font cache, which only supports
bitmap images, not color. (I leave it up to someone with a color
display to test that theory.) Note that the "hot spot" of the cursor
is the character's origin. Unfortunatly you can't change the origin of
the characters in a font by giving a predefined bitmap font and a
translation matrix to makefont (that's a bug), so you have to make
your own user defined font. (I had wanted to use a Times-Roman "?",
with the dot as the hot spot, but the hot spot was always the lower
left corner no matter how much I translated with makefont. I suppose I
could just make my own question mark outline in a user defined font.
That would rotate better anyway.) It would be nice if NeWS had an
operator, some variaton of setcanvascursor, to move the cursor hot
spot around independant of the character origin. 

	-Don

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

systemdict begin
/newfont 50 dict def
newfont begin

/FontType 3 def
/FontMatrix [1 0 0 1 0 0] def
/FontBBox [-1 -1 1 1] def

/BuildChar {
  10 dict begin
    2 0 -1 -1 1 1 setcachedevice

    /char exch 256 div 360 mul def /font exch def
    newpath
    0 0 char 17 mul cos dup mul 0 360 arc closepath
    0 0 char 32 mul cos dup mul 0 360 arc closepath
    0 0 char 21 mul sin dup mul 0 360 arc closepath
    0 0 char 5 mul sin dup mul 0 360 arc closepath
    0 0 char 8 mul sin dup mul 0 360 arc closepath
    stroke
  end
} def
end % newfont

/Drip newfont definefont pop

end % systemdict


 /f /Drip findfont 30 scalefont def
 5 { 0 5 255 { f exch dup setcanvascursor .002 sleep } for } repeat