Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
PostScript
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Units of length === PostScript uses the [[Point (typography)|point]] as its unit of length. However, unlike some of the other versions of the point, PostScript uses exactly 72 points to the inch. Thus: : {{math|1=1 point = {{sfrac|1|72}} inch = {{sfrac|25.4|72}} mm = {{sfrac|127|360}} mm = 352.777β¦ micrometers}} For example, in order to draw a vertical line of 4 cm length, it is sufficient to type: <syntaxhighlight lang="postscript"> 0 0 moveto 0 113.385827 rlineto stroke </syntaxhighlight> More readably and idiomatically, one might use the following equivalent, which demonstrates a simple procedure definition and the use of the mathematical operators <code>mul</code> and <code>div</code>: <syntaxhighlight lang="postscript"> /cm {72 mul 2.54 div} def % 1 inch = 2.54 cm exactly 0 0 moveto 0 4 cm rlineto stroke </syntaxhighlight> (Technically, most printers have a construction-implied unprintable margin around the physical borders of the sheet, and the 0 0 coordinates are calibrated to its corner,<ref name=PLR/>{{rp |at=section 4.3.1}} so you might have to use a different starting point to actually see something.) Most implementations of PostScript use [[single-precision]] reals<ref name=PLR/>{{rp |at=appendix B}} (24-bit mantissa), so it is not meaningful to use more than 9 decimal digits to specify a real number, and performing calculations may produce unacceptable round-off errors.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)