Created
October 27, 2023 18:25
-
-
Save pmarreck/fd00ac12e73902e7de95671be04f6d6d to your computer and use it in GitHub Desktop.
An example of a text wrapping function in pure PostScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%!PS | |
%%BoundingBox: 0 0 612 792 | |
/Times-Roman findfont 12 scalefont setfont | |
% Define the starting coordinates | |
/x 72 def | |
/y 720 def | |
% Routine to wrap lines | |
/wordbreak ( ) def | |
/linewidth 475 def | |
/cwz {/curwidth 0 def} def | |
cwz | |
% cr is the carriage return (linefeed) function | |
/cr { /y y 20 sub def /x 72 def x y moveto cwz } def | |
/nlwrap { /y y 20 sub def x y moveto nextword show ( ) show } def | |
/wrap { /text exch def | |
{text wordbreak search | |
{/nextword exch def pop | |
/text exch def | |
/wordwidth nextword stringwidth pop def | |
/breakwidth wordbreak stringwidth pop def | |
curwidth wordwidth add linewidth gt | |
{nlwrap /curwidth wordwidth breakwidth add def} | |
{nextword show ( ) show /curwidth curwidth wordwidth add breakwidth add def } | |
ifelse | |
} | |
{pop exit} | |
ifelse | |
}loop | |
}def | |
x y moveto | |
(Peter Marreck )wrap | |
cr | |
(Addigence, Director of Engineering )wrap | |
cr | |
(Port Washington, NY )wrap | |
cr | |
(October 27, 2023 )wrap | |
cr cr | |
(Sarah Silverman )wrap | |
cr | |
(Address Line 1 )wrap | |
cr | |
(Address Line 2 )wrap | |
cr cr | |
(Dear Ms. Silverman, )wrap | |
cr cr | |
(I hope this letter finds you well. I am writing to bring to your attention an issue concerning a tree on your property that borders mine. Recently, I have noticed that the said tree seems to be in a deteriorating state, with several branches having fallen onto my yard. )wrap | |
cr | |
(I am concerned that the tree, in its current frail state, poses a risk to the safety of both our properties. I kindly request that you have a professional arborist examine the tree to assess its health and recommend any necessary remedial actions. )wrap | |
cr | |
(I would appreciate it if this matter could be attended to at your earliest convenience. If there is anything I can do to assist, please do not hesitate to reach out. I am looking forward to resolving this issue amicably and ensuring the continued safety and tranquility of our neighborhood. )wrap | |
cr | |
(Thank you for your understanding and cooperation. )wrap | |
cr cr | |
(Sincerely, )wrap | |
cr cr cr | |
(Peter Marreck )wrap | |
cr | |
showpage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment