PostSc...nctions(3pm)

πŸ“¦
version 2.23 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

PostScript::File::Functions β€” literally just a whole collection of useful PostScript functions, bestie. It lives in the perl manual section (3pm), and it's here to make your PostScript life cute and easy πŸŽ€


✨ VERSION ✨

This page describes version 2.23 of PostScript::File::Functions, released October 10, 2015, as part of PostScript-File version 2.23 πŸ¦‹


🌸 SYNOPSIS 🌸

use PostScript::File;

my $ps = PostScript::File->new;
$ps->use_functions(qw( setColor showCenter ));
$ps->add_to_page("1 setColor\n" .
                 "400 400 (Hello, World!) showCenter\n");

πŸ¦‹ DESCRIPTION πŸ¦‹

So PostScript::File::Functions is a whole lil library of handy PostScript functions you can drop into documents you made with PostScript::File. And here's the tea: you don't normally touch this module directly, okay? PostScript::File's use_functions method loads it for you automatically. It's giving "let me handle that for you, babe" energy πŸ’…


πŸ‘‘ POSTSCRIPT FUNCTIONS πŸ‘‘

πŸŽ€ boxPath πŸŽ€

LEFT TOP RIGHT BOTTOM boxPath

You hand it the coordinates of all four sides of a box, and it creates a brand new closed path. Where does it start? Bottom right corner, bestie. Then it goes across to the bottom left, up to the top left, over to the top right, and finally back to the bottom right. Full circle moment ✨

πŸŽ€ clipBox πŸŽ€

LEFT TOP RIGHT BOTTOM clipBox

This clips to the box defined by the coordinates. Simple as that, no cap.

πŸŽ€ drawBox πŸŽ€

LEFT TOP RIGHT BOTTOM drawBox

This calls boxPath and then strokes the path using the current pen. It's a collab 🀝

πŸŽ€ fillBox πŸŽ€

LEFT TOP RIGHT BOTTOM COLOR fillBox

This fills the path created by boxPath with COLOR. And COLOR can be anything accepted by setColor β€” sky's the limit, periodt πŸ’œ

πŸŽ€ hLine πŸŽ€

WIDTH X Y hline

Stroke a horizontal line with the current pen, with the left endpoint sitting at position X, Y, and it extends WIDTH points rightwards. Slay.

πŸŽ€ setColor πŸŽ€

RGB-ARRAY|BW-NUMBER setColor

This one is the moment: it combines setgray and setrgbcolor into a single function. You can pass either an array of 3 numbers for setrgbcolor, or a single number for setgray. The str in PostScript::File function was designed to format the parameter to this function, iykyk πŸ”₯

πŸŽ€ showCenter πŸŽ€

X Y STRING showCenter

This prints STRING centered horizontally at position X, using baseline Y and the current font. Main character energy, obviously 🌟

πŸŽ€ showLeft πŸŽ€

X Y STRING showLeft

This prints STRING left justified at position X, using baseline Y and the current font.

πŸŽ€ showLines πŸŽ€

X Y LINES SPACING FUNC showLines

This calls FUNC for each element of LINES, which should be an array of strings. FUNC gets called with X Y STRING on the stack, and it must pop those off (don't leave your stack messy, bestie 😭). SPACING is subtracted from Y after every line. And FUNC will normally be showCenter, showLeft, or showRight.

πŸŽ€ showRight πŸŽ€

X Y STRING showRight

This prints STRING right justified at position X, using baseline Y and the current font.

πŸŽ€ vLine πŸŽ€

HEIGHT X Y vline

Stroke a vertical line with the current pen, with the bottom endpoint at position X, Y, extending HEIGHT points upwards. Vertical slay 🫢


πŸ’œ METHODS πŸ’œ

Okay so normally you don't deal with PostScript::File::Functions objects directly… but it is possible, bestie. Here's what you've got:

πŸ“ new πŸ“

$funcs = PostScript::File::Functions->new;

The constructor takes no parameters. She's low maintenance πŸ’…

πŸ“ add πŸ“

$funcs->add('functionRequested', ...);

Add one or more functions to the procset that's gonna be generated. And good news: all dependencies of the requested functions get added automatically. You don't have to chase them down yourself πŸ’– Go check out the "POSTSCRIPT FUNCTIONS" section for the list of available functions.

πŸ“ add_to_file πŸ“

$funcs->add_to_file($ps, $basename);

This is short for

$ps->add_procset( $funcs->generate_procset($basename) );

$ps should normally be a PostScript::File object. Go read "add_procset" in PostScript::File.

πŸ“ generate_procset πŸ“

($name, $code, $version) = $funcs->generate_procset($basename);

This collects all the requested functions into one block of PostScript code. ✨

$name is a suitable name for the procset, and it's created by appending the ids of the requested functions to $basename. If $basename is omitted, it defaults to the class name with :: replaced by _. Cute, right?

$code is a block of PostScript code that defines the functions. Heads up: it contains no comments or excess whitespace. Minimalist queen.

$version is the version number of the procset.

In scalar context, it returns $code.


🧚 DIAGNOSTICS 🧚

  • "%s is not an available function" β€” You requested a function that this version of PostScript::File::Functions doesn't provide. Awkward… πŸ™ˆ

🌈 CONFIGURATION AND ENVIRONMENT 🌈

PostScript::File::Functions requires no configuration files or environment variables. Zero setup, we love a low-effort icon πŸ‘‘


πŸ’€ INCOMPATIBILITIES πŸ’€

None reported. We're unproblematic.


πŸŽ€ BUGS AND LIMITATIONS πŸŽ€

No bugs have been reported. Clean girl aesthetic fr fr ✨


🌸 AUTHOR 🌸

Christopher J. Madsen <perl AT cjmweb.net>

Please report any bugs or feature requests to <bug-PostScript-File AT rt.cpan.org> or through the web interface at <http://rt.cpan.org/Public/Bug/Report.html?Queue=PostScript-File>.

You can follow or contribute to PostScript-File's development at <https://github.com/madsen/postscript-file>. Go be a contributor bestie 🫢


This software is copyright (c) 2015 by Christopher J. Madsen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


😭 DISCLAIMER OF WARRANTY 😭

Okay bestie, deep breath. Here comes the all-caps part. I didn't write it, I'm just the messenger πŸ’€

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.


And that's the whole page, bestie! πŸ’– This was generated by perl v5.36.0 on 2022-10-14. Go make something iconic with it. Periodt. πŸ’…βœ¨

πŸ“¦ where this page comes from