.TL Pbmtext User Manual .SH 1 pbmtext .LP Updated: 14 April 2005 .br Table Of Contents .SH 2 NAME .LP pbmtext - render text into a PBM image .SH 2 SYNOPSIS .LP \fBpbmtext\fR [\fB-font\fR \fIfontfile\fR] [\fB-builtin\fR \fIfontname\fR] [\fB-space\fR \fIpixels\fR] [\fB-lspace\fR \fIpixels\fR] [\fB-nomargins\fR] [\fB-width\fR \fIpixels\fR] [\fItext\fR] .LP Minimum unique abbreviation of option is acceptable. You may use double hyphens instead of single hyphen to denote options. You may use white space in place of the equals sign to separate an option name from its value. .SH 2 DESCRIPTION .LP .LP This program is part of Netpbm. .LP \fBpbmtext\fR takes the specified text, either a single line from the command line or multiple lines from standard input, and renders it into a PBM graphical image. .LP In the image, each line of input is a line of output. Formatting characters such as newline have no effect on the formatting; like any unprintable character, they turn into spaces. .LP The image is just wide enough for the longest line of text, plus margins, and just high enough to contain the lines of text, plus margins. .LP The left and right margins are twice the width of the widest character in the font; the top and bottom margins are the height of the tallest character in the font. But if the text is only one line, all the margins are half of this. You can use the \fB-nomargins\fR option to eliminate the margins. .LP \fBpbmtextps\fR does the same thing as \fBpbmtext\fR, but uses Ghostscript to generate the characters, which means it's a lot more sophisticated and you can use Postscript fonts. But it also means you have to have Ghostscript installed and it isn't as fast. .SH 2 OPTIONS .LP .RS .IP "\fB-font\fR" .IP "\fB-builtin\fR" \fB-builtin\fR selects a font among those built into Netpbm. \fB-font\fR selects a font that you supply yourself either as an X Window System BDF (Bitmap Distribution Format) file or as a PBM file in a special form. .LP The default is the built in font "bdf." .LP "bdf" is Times-Roman 15 pixels high. (That's about 14 point type printed at 75 dpi). .LP "fixed" is a built in fixed with font. .LP To create a font as a PBM file (to use with the \fB-font\fR option), do this: In your window system of choice, display the following text in the desired (fixed-width) font: .DS L M ",/^_[`jpqy| M / !"#$%&'()*+ / < ,-./01234567 < > 89:;<=>?@ABC > @ DEFGHIJKLMNO @ _ PQRSTUVWXYZ[ _ { \]^_`abcdefg { } hijklmnopqrs } ~ tuvwxyz{|}~ ~ M ",/^_[`jpqy| M .DE Do a screen grab or window dump of that text, using for instance \fBxwd\fR, \fBxgrabsc\fR, or \fBscreendump\fR. Convert the result into a pbm file. If necessary, use \fBpamcut\fR to remove everything except the text. Finally, run it through \fBpnmcrop\fR. to make sure the edges are right up against the text. \fBpbmtext\fR can figure out the sizes and spacings from that. .IP "\fB-space\fR \fIpixels\fR" Add \fIpixels\fR pixels of space between characters. This is in addition to whatever space surrounding characters is built into the font, which is usually enough to produce a reasonable string of text. .LP \fIpixels\fR may be fractional, in which case the number of pixels added varies so as to achieve the specified average. For example \fB-space=1.5\fR causes half the spaces to be 1 pixel and half to be 2 pixels. .LP \fIpixels\fR may be negative to crowd text together, but the author has not put much thought or testing into how this works in every possible case, so it might cause disastrous results. .IP "\fB-lspace\fR \fIpixels\fR" Add \fIpixels\fR pixels of space between lines. This is in addition to whatever space above and below characters is built into the font, which is usually enough to produce a reasonable line spacing. .LP \fIpixels\fR must be a whole number. .LP \fIpixels\fR may be negative to crowd lines together, but the author has not put much thought or testing into how this works in every possible case, so it might cause disastrous results. .IP "\fB-nomargins\fR" By default, \fBpbmtext\fR adds margins all around the image as described above. This option causes \fBpbmtext\fR not to add any margins. .LP Note that there may still be space beyond the edges of the type because a character itself may include space at its edges. To eliminate all surrounding background, so the type touches all four edges of the image, use \fBpnmcrop\fR. .IP "\fB-width\fR \fIpixels\fR" This specifies how much horizontal space the text is supposed to fit into. .LP If the input is one line, \fBpbmtext\fR breaks it into multiple lines as needed to fit the specified width. It breaks it between characters, but does not pay attention to white space; it may break in the middle of a word and a line may begin or end with white space. .LP If the input is multiple lines, \fBpbmtext\fR assumes you already have line breaks where they make sense, and \fBpbmtext\fR simply truncates each line as needed to fit the specified width. .RE .SH 2 USAGE .LP .LP Often, you want to place text over another image. One way to do this is with \fBppmlabel\fR. \fBppmlabel\fR does not give you the font options that \fBpbmtext\fR does, though. .LP Another way is to use \fBpbmtext\fR to create an image containing the text, then use \fBpamcomp\fR to overlay the text image onto your base image. To make only the text (and not the entire rectangle containing it) cover the base image, you will need to give \fBpamcomp\fR a mask, via its \fB-alpha\fR option. You can just use the text image itself as the mask, as long as you also specify the \fB-invert\fR option to \fBpamcomp\fR. .LP If you want to overlay colored text instead of black, just use \fBppmchange\fR to change all black pixels to the color of your choice before overlaying the text image. But still use the original black and white image for the alpha mask. .LP If you want the text at an angle, use \fBpnmrotate\fR on the text image (and alpha mask) before overlaying. .SH 2 SEE ALSO .LP \fBpbmtextps\fR, \fBpamcut\fR, \fBpnmcrop\fR, \fBpamcomp\fR, \fBppmchange\fR, \fBpnmrotate\fR, \fBppmlabel\fR, \fBpstopnm\fR, \fBpbm\fR .SH 2 AUTHOR .LP Copyright (C) 1993 by Jef Poskanzer and George Phillips .br \l'5i' .SH 2 Table Of Contents .LP .IP \(bu NAME .IP \(bu SYNOPSIS .IP \(bu DESCRIPTION .IP \(bu OPTIONS .IP \(bu USAGE .IP \(bu SEE ALSO .IP \(bu AUTHOR .LP