For robustness against website failure, the current code (though the
jdawiseman.com version of it might, within the next few days, be updated).
%!PS
% (c) Copyright 2021 Julian Wiseman of
jdawiseman.com.
%
http://www.jdawiseman.com/papers/bugs/20210614_clip_test.ps
%
http://groups.google.com/g/comp.lang.postscript/c/wa-vv0jzOfk
% PDF made by Adobe Distiller XI Pro 11.0.23 (01/11/2017), "Copyright 1984-2012 Adobe Systems Incorporated".
% DeFontPath has two uses.
% Bug in Adobe Distiller 8.1.3 (23/10/2006). In attempting to treat paths derived from text as copyable text, it fails to cope with paths made partly thereby and partly from a upath.
% Also, eliminates some types of problems with embedding fonts.
/DeFontPath
{
{
[ {/moveto cvx} {/lineto cvx} {/curveto cvx} {/closepath cvx} pathforall ] newpath cvx exec
} stopped {(Warning: protected path in DeFontPath) =} if
} bind def % /DeFontPath
% BoolCharPath BoolDeFont PaintTextPath -
/PaintTextPath
{
2 dict begin
/BoolDeFont exch def
/BoolCharPath exch def
gsave
(ABCDE) BoolCharPath charpath
BoolDeFont {DeFontPath} if
gsave BoolCharPath {0.4 0.6 1} {0 0.8 0} ifelse setrgbcolor fill grestore
4 setlinewidth 0 setgray 1 setlinejoin clip stroke % !!! Without DeFontPath, clip fails !!!
grestore
end
} bind def % /PaintTextPath
<< /PageSize [340 240] >> setpagedevice
0 1 1
{
1 eq /BoolDeFont exch def
/FiraSans-Regular 9.5 selectfont 0.6 0 0 setrgbcolor
BoolDeFont {(Page 2, with)} {(Page 1, without)} ifelse
10 227 moveto show ( DeFontPath: blue = true charpath; green = false charpath.) show
10 217 moveto (Source:
http://www.jdawiseman.com/papers/bugs/20210614_clip_test.ps) show
/FiraSansExtraCondensed-Bold 128 selectfont
10 210 moveto 320 0 rlineto stroke
10 110 moveto true BoolDeFont PaintTextPath
10 10 moveto false BoolDeFont PaintTextPath
showpage
} for % BoolDeFont