[comp.lang.postscript] fuzzy text program

eln272v@monu1.cc.monash.oz ( r lang) (10/19/89)

I saw a sign similar to one of these in the local Magistrates 
Court Office two years ago.  Recently I worked out how to 
produce the same fuzzy text using PostScript.
This postscript program prints a pair of pages picturing
phuzzy printing. (apologies about an attempt at alliteration)
The first clips the text with many fine bars, then shifts
the text and clips it again with shifted bars.
The second prints the text shifted and unshifted using grey,
then prints the intersection of the shifted and unshifted text
with black.  They are best viewed from several metres distance.

Have fun with these posters!

%!
%%Title: fuzzy.ps
%%Creator: Russell Lang
%%CreationDate: Thu Oct 19 13:07:25 EST 1989
%%Pages: 2
%%EndComments
  /inch {72 mul} def
  /mm {25.4 div 72 mul} def
% size of paper (A4 landscape)
  /Paperwidth 297 mm def
  /Paperheight 210 mm def
% Landscape mode
  /Landscape {
    90 rotate
    0 Paperheight neg translate
  } def
% size of text
  /Textheight 35 mm def
% centre of page
  /Centre {Paperwidth 2 div Paperheight 2 div} def
% size of clip area 
  /Xsize Paperwidth def
  /Ysize Paperheight  def
% size of clipping bars
%  if this is too narrow then clip will generate 
%  a limitcheck error
  /Height 0.5 mm def
% outline of single bar
  /Barclip { 
    0 exch moveto 
    Xsize 0 rlineto
    0 Height rlineto
    Xsize neg 0 rlineto
    0 Height neg rlineto
    closepath
  } def
% make clipping path lots of horizontal bars
  /Makeclip { 
    newpath
    0   Height 2 mul   Ysize   { Barclip }   for
    clip
    newpath
  } def
% show text bar fuzzy!
  /FuzzyBarshow { 
    % fuzzy shift depends on text size
    /Fuzzyshift (M) stringwidth pop 9 div def
    % calculate size of box to clip
    dup stringwidth pop Fuzzyshift add /Xsize exch def
    /Ysize Textheight def
    %
    currentpoint
    3 copy % string x y
    % show text once
    gsave
    translate
    Makeclip
    0 0 moveto show
    grestore
    % show text shifted
    gsave
    translate
    0 Height translate
    Makeclip
    Fuzzyshift Height neg moveto show
    grestore
  } def
% show text bar fuzzy centred about current point
  /FuzzyBarCshow {
    dup
    stringwidth pop -2 div 0 rmoveto
    FuzzyBarshow
  } def
% show text grey fuzzy!
  /FuzzyGreyshow { 
    % fuzzy shift depends on text size
    /Fuzzyshift (M) stringwidth pop 9 div def
    %
    gsave
    currentpoint
    translate
    0.5 setgray
    % show text grey once
    dup % string
    0 0 moveto show
    % show text grey shifted
    dup % string
    Fuzzyshift 0 moveto show
    % set up clip path
    dup % string
    0 0 moveto 
    true charpath clip newpath
    % show text black shifted clipped
    0 setgray
    Fuzzyshift 0 moveto show
    grestore
  } def
% show text grey fuzzy centred about current point
  /FuzzyGreyCshow {
    dup
    stringwidth pop -2 div 0 rmoveto
    FuzzyGreyshow
  } def
%%EndProlog
%%Page: "bar" 1
Landscape
/Times-Bold findfont Textheight scalefont setfont
Centre Textheight add moveto
(DO YOU) FuzzyBarCshow
Centre moveto
(SUFFER FROM) FuzzyBarCshow
Centre Textheight sub moveto
(EYE STRAIN?) FuzzyBarCshow
showpage
%%Page: "Grey" 2
%%BeginDocument: acuity2.ps
%!
% acuity2.ps
% Modified from Byte, May 1987
% acuity test chart

150 750 moveto
/width 250 def
/size width 4 div def
/cuberoot2 2 1 3 div exp def
width 2 div size -1.5 mul rmoveto

/showrow
{  currentpoint 3 -1 roll
   FontDirectory /Sloan known
   {/Sloan findfont size scalefont setfont}
   {/Helvetica-Bold findfont size 1.8 mul scalefont setfont}
   ifelse
   dup stringwidth pop -2 div 0 rmoveto
% original line is below
%   show
% replace with next two lines to fuzzy show for fun!
   currentdict /FuzzyGreyshow known
   {FuzzyGreyshow} {show} ifelse
%
   moveto
   /size size cuberoot2 div def
   0 size -2 mul rmoveto
} def

(Z C H) showrow (O S H) showrow (H K N) showrow
(O Z S) showrow (D H C) showrow (C N O) showrow
(K D V) showrow (S H O) showrow (D R H) showrow
(K N Z) showrow (R H K) showrow (C H O) showrow
(N K S) showrow (C Z R) showrow (S O K) showrow
(D N C) showrow (C H D) showrow (R O H) showrow
(S N D) showrow (O C H) showrow (Z H K) showrow
(C V H) showrow (V N Z) showrow (S C K) showrow
(N D C) showrow (C N D) showrow (O V N) showrow
(Z H V) showrow (H S K) showrow (D N O) showrow
(N S K) showrow (D C Z) showrow (V H K) showrow
(S K V) showrow (V R K) showrow (V R S) showrow
(K Z N) showrow

showpage
%EndDocument
%%Trailer
-- 
Russell Lang    ACSnet: eln272v@monu1.cc.monash.oz    Phone: (03) 565 3464
Department of Electrical and Computer Systems Engineering
Monash University, Australia