u2ps(1)

πŸ“¦ version 1.2, in nixos 26.05, nixpkgs unstable

✨ u2ps(1) β€” unicode text to PostScript converter πŸ’… (General Commands Manual)

🌸 NAME 🌸

u2ps β€” unicode text to PostScript converter. periodt.

πŸŽ€ SYNOPSIS πŸŽ€

u2ps [options] [input-file [output-file]]

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so u2ps produces a printable PostScript document from the text you give it, and it handles arbitrary Unicode characters. iconic behavior, honestly πŸ’–

🌈 USAGE 🌈

Typically u2ps should be run with inputname but without outputname, and in that case the output will be written to inputname.ps. iykyk ✨

πŸ’… General options πŸ’…

  • -T, --tab=n β€” Spaces per tab.
  • -a, --no-ansi β€” Do not interpret ANSI terminal control sequences.
  • -P, --paper=name β€” Paper name, or size in mm (WxH).
  • -M, --margins=values β€” Margins, in pt; a single number, or V:H, or T:R:B:L. Heads up: the margins are for the text area only. Headings, line numbers and wrap marks will be printed outside of the specified region.
  • -r, --landscape β€” Rotate to landscape orientation.
  • -w, --wrap β€” Wrap long lines.
  • -W, --mark β€” Wrap long lines and set wrap marks.
  • -i, --inverse β€” Inverse (white text on black background) mode. Does not change other colors, so red will still be red. Use this to make the page look as close to a real terminal as possible. Can be useful for making "terminal screenshots" or rendering ASCII art, but hardly suitable for printing.

🎨 Fonts setup 🎨

u2ps can switch between regular/bold/italic fonts, and if instructed so, between fonts providing different Unicode areas. Fonts are always loaded via Ghostscript, and the font names used are PostScript names.

In addition to that, u2ps keeps a built-in list of common font variants. For instance, -f FreeMono sets regular, bold and italic fonts at once. Still, fontset names are chosen to match base font names closely.

  • -fname/--font=name β€” Primary font set [FreeMono].
  • -fK:name β€” Font name for key K; possible key values are: Regular, Italic, Bold, bOld italic, CJK characters, Thai.
  • --aux-font=name β€” Auxilliary font, for headings and line numbers [Times-Roman].
  • --aux-size=n β€” Auxilliary font size (pt).

🧚 Aspect ratio adjustments 🧚

Most monospace fonts have aspect ratio of 0.6, which means printing M in 10pt font advances caret right by 6pt.

  • -2 β€” Scale fonts so that terminal cell aspect ratio is 0.5.
  • -1 β€” Same, for aspect ratio of 1.0 (square characters).

Aspect ratio is calculated for single-width characters. Double-width glyphs naturally have double that, so -2 mode should be used to get square CJK ideographs in the output.

⭐ Font size selection ⭐

Use only one of these options. Paper size will be used to determine the other two.

  • -s, --font-size=n β€” Font size (pt).
  • -C, --columns=n β€” Columns per line.
  • -L, --lines=n β€” Lines per page.

πŸ’– Output control options: πŸ’–

  • -l, --numbers β€” Print line numbers.
  • --start-line=n β€” First line number, instead of default 1.
  • -b, --bookish β€” Swap left and right headings on even pages.
  • -H, --no-headings β€” Do not print default headings.
  • --header=... β€” Page heading, centered.
  • --header-left=... β€” Page heading, left aligned.
  • --header-right=... β€” Page heading, right aligned.
  • --footer=... β€” Page footers.
  • --footer-left=... β€” Page footers.
  • --footer-right=... β€” Page footers.
  • -t, --title=string β€” Page title (DSC only, not printed anywhere).

Use # in --header or --footer strings to get current page number. Set --header="@" to get input file name.

πŸ”₯ Postscript options πŸ”₯

  • -R, --noreduce β€” Do not reduce resources, embed everything as is (see -r in psfrem(1)).
  • -A, --allfonts β€” Embed/reduce all fonts, including standard postscript 35.
  • -E, --noembed β€” Do not embed resources; see below on how to use the output.
  • --keep β€” Do not delete temporary files.

πŸ’€ NOTES πŸ’€

πŸ“ Font reduction πŸ“

To allow large fontsets and at the same time produce files of reasonable size, u2ps embeds only fonts and glyphs actually used into the final document. This is done by passing initial document through gs -sDEVICE=nullpage, collecting glyph usage statistics and dumping relevant parts of the fonts loaded by gs.

Ghostscript run is the most complicated and cpu-intensive part of u2ps operation.

Embedding fonts into document is not, in fact, necessary if gs knows where to look for them. In such case you can make u2ps run much faster by using -E option. Just make sure to pass -I/usr/share/u2ps/ps to gs when handling files produced by u2ps -E, or otherwise make u2ps resources available.

πŸ”₯ PostScript printers πŸ”₯

u2ps relies on non-standard glyphwidth operator to center and right-align headings. In case postscript interpreter in your printer lacks this operator, you are likely to get misaligned headings.

🌈 Standard PostScript fonts 🌈

Unless told otherwise, u2ps does not embed standard fonts (Times-Roman, Courier and such). Most of the time it works well. However, range coverage outside of basic Latin1 is not guaranteed for standard fonts, and the fonts bundled with Ghostscript tend to have more glyphs than fonts in a typically printer.

In case you get notdef marks on printouts that weren't there in Ghostscript, consider embedding standard fonts as well (-A option).

πŸ¦‹ TrueType fonts πŸ¦‹

Normally u2ps relies on Ghostscript to load TT fonts. However, Ghostscript can not handle TrutType fonts without post table properly. When loaded directly by Ghostscript, such fonts get non-standard (and non-usable) glyph names, which makes them useless for u2ps.

πŸŽ€ Font licensing πŸŽ€

When embedding fonts, u2ps assumes you have the rights to do so. No checks are performed and no warnings are issued even for protected fonts.

πŸ‘‘ AUTHOR πŸ‘‘

Written by Alex Suykov <alex.suykov@gmail.com>. Feel free to send bug reports and suggestions.

🌟 SEE ALSO 🌟

gs(1), highlight(1), psnup(1), psbook(1), psselect(1), epstopdf(1), ps2pdf.

Similar utilities: a2ps(1), paps(1), texttops from cups package.

and that's the u2ps(1) page, bestie β€” footer says just u2ps(1), no extra version/date tea. stay iconic πŸ’…βœ¨

πŸ“¦ where this page comes from