1Pbmtext User Manual(0)                                  Pbmtext User Manual(0)
2
3
4

NAME

6       pbmtext - render text into a PBM image
7
8

SYNOPSIS

10       pbmtext  [-font  fontfile] [-builtin fontname] [-space pixels] [-lspace
11       pixels] [-nomargins] [-width pixels] [text]
12
13       Minimum unique abbreviation of option is acceptable.  You may use  dou‐
14       ble  hyphens  instead  of single hyphen to denote options.  You may use
15       white space in place of the equals sign to separate an option name from
16       its value.
17
18
19

DESCRIPTION

21       This program is part of Netpbm(1).
22
23       pbmtext takes the specified text, either a single line from the command
24       line or multiple lines from standard input, and renders it into  a  PBM
25       graphical image.
26
27       In the image, each line of input is a line of output.  Formatting char‐
28       acters such as newline have no  effect  on  the  formatting;  like  any
29       unprintable character, they turn into spaces.
30
31       The  image  is just wide enough for the longest line of text, plus mar‐
32       gins, and just high enough to contain the lines of text, plus margins.
33
34       The left and right margins are twice the width of the widest  character
35       in  the  font; the top and bottom margins are the height of the tallest
36       character in the font.  But if the text is only one line, all the  mar‐
37       gins  are half of this.  You can use the -nomargins option to eliminate
38       the margins.
39
40       pbmtextps does the same thing as pbmtext, but uses Ghostscript to  gen‐
41       erate the characters, which means you can use Postscript fonts.  But it
42       also means you have to have Ghostscript installed and it isn't as fast.
43       Also,  pbmtextps  generates  only one line of text, whereas pbmtext can
44       create multiple lines.
45
46       pbmtext is meant for small quantities of simple text.  If you're  work‐
47       ing  with  a document, you would be better off using a document format‐
48       ting program to 'print' to a Postscript file, then feeding  that  Post‐
49       script to pstopnm.
50
51

OPTIONS

53       -font
54
55       -builtin
56              -builtin selects a font among those built into Netpbm.
57
58              -font  selects  a  font  that you supply yourself either as an X
59              Window    System    BDF     (Bitmap     Distribution     Format)
60http://xfree86.org/current/bdf.pdf⟩  file or as a PBM file in a
61              special form.
62
63              The default is the built in font 'bdf.'
64
65              'bdf' is Times-Roman 15 pixels high.   (That's  about  14  point
66              type printed at 75 dpi).
67
68              'fixed' is a built in fixed width font.
69
70              For  information  about other fonts, and how to make one of your
71              own, see Fonts ⟨#fonts⟩  below.
72
73
74
75       -space pixels
76               Add pixels pixels of space  between  characters.   This  is  in
77              addition  to whatever space surrounding characters is built into
78              the font, which is usually enough to produce a reasonable string
79              of text.
80
81              pixels  may  be  fractional,  in which case the number of pixels
82              added varies so as to achieve the specified average.  For  exam‐
83              ple  -space=1.5 causes half the spaces to be 1 pixel and half to
84              be 2 pixels.
85
86              pixels may be negative to crowd text together,  but  the  author
87              has not put much thought or testing into how this works in every
88              possible case, so it might cause disastrous results.
89
90
91       -lspace pixels
92               Add pixels pixels of space between lines.  This is in  addition
93              to  whatever  space above and below characters is built into the
94              font, which is usually enough to produce a reasonable line spac‐
95              ing.
96
97              pixels must be a whole number.
98
99              pixels  may  be negative to crowd lines together, but the author
100              has not put much thought or testing into how this works in every
101              possible case, so it might cause disastrous results.
102
103
104       -nomargins
105              By  default,  pbmtext  adds  margins  all  around  the  image as
106              described above.  This option causes pbmtext not to add any mar‐
107              gins.
108
109              Note  that there may still be space beyond the edges of the type
110              because a character itself may include space at its  edges.   To
111              eliminate  all  surrounding  background, so the type touches all
112              four edges of the image, use pnmcrop.
113
114
115       -width pixels
116              This specifies how much horizontal space the text is supposed to
117              fit into.
118
119              If  the input is one line, pbmtext breaks it into multiple lines
120              as needed to fit the specified  width.   It  breaks  it  between
121              characters,  but  does  not pay attention to white space; it may
122              break in the middle of a word and a line may begin or  end  with
123              white space.
124
125              If the input is multiple lines, pbmtext assumes you already have
126              line breaks where they make sense, and pbmtext simply  truncates
127              each line as needed to fit the specified width.
128
129
130
131
132

USAGE

134       Often,  you  want to place text over another image.  One way to do this
135       is with ppmlabel.  ppmlabel does not give you  the  font  options  that
136       pbmtext does, though.
137
138       Another  way  is to use pbmtext to create an image containing the text,
139       then use pamcomp to overlay the text image onto your  base  image.   To
140       make  only  the text (and not the entire rectangle containing it) cover
141       the base image, you will need to give pamcomp a mask,  via  its  -alpha
142       option.  You can just use the text image itself as the mask, as long as
143       you also specify the -invert option to pamcomp.
144
145       If you want to overlay colored text instead of  black,  just  use  ppm‐
146       change  to  change  all black pixels to the color of your choice before
147       overlaying the text image.  But still use the original black and  white
148       image for the alpha mask.
149
150       If  you want the text at an angle, use pnmrotate on the text image (and
151       alpha mask) before overlaying.
152
153

FONTS

155       There are three kinds of fonts you an use with pbmtext:
156
157
158
159       ·      built in
160
161       ·      BDF
162
163       ·      PBM
164
165
166
167   BDF Font
168       BDF is an ancient font format that at one time was standard for  the  X
169       Window System.  Now, you don't see it very often, but you can find some
170       BDF            fonts             on             the             Xfree86
171http://cvsweb.xfree86.org/cvsweb/xc/fonts/bdf/⟩  web site.
172
173       You  can get the full package of the BDF fonts from XFree86 (see above)
174       from the Netpbm web site ⟨http://netpbm.sourceforge.net/bdffont.tgz⟩ .
175
176
177   PBM Font
178       To create a font as a PBM file (to use with the -font option), you just
179       create a PBM image of the text matrix below.
180
181       The  first  step is to display text matrix below on the screen, e.g. in
182       an X11 window.
183
184
185           M ',/^_[`jpqy| M
186
187           /  !'#$%&'()*+ /
188           < ,-./01234567 <
189           > 89:;<=>?@ABC >
190           @ DEFGHIJKLMNO @
191           _ PQRSTUVWXYZ[ _
192           { \]^_`abcdefg {
193           } hijklmnopqrs }
194           ~ tuvwxyz{|}~  ~
195
196           M ',/^_[`jpqy| M
197
198
199       Make sure it's a fixed width font -- This should display as  a  perfect
200       rectangle.
201
202       Also, try to use a simple display program.  Pbmtext divides this into a
203       matrix of cells, all the same size, each containing one  character,  so
204       it  is  important that whatever you use to display it display with uni‐
205       form horizontal and vertical spacing.  Fancy word  processing  programs
206       sometimes  stretch  characters in both directions to fit certain dimen‐
207       sions, and that won't work.  Sometimes a display program scales a  font
208       to  show a character larger or smaller than its natural size.  That too
209       won't often work because the rounding involved in such  scaling  causes
210       non-uniform distances between characters.
211
212       If  you  display  the text matrix improperly, the usual symptom is that
213       when you try to use the font,  pbmtext  fails  with  an  error  message
214       telling you that the number of lines in the font isn't divisible by 11,
215       or it can't find the blank band around the inner rectangle.   Sometimes
216       the  symptom is that one of the characters displays with a piece of the
217       character that is next to it in the matrix.   For  example,  'l'  might
218       display with a little piece of the 'm' attached on its right.
219
220       Do  a  screen grab or window dump of that text, using for instance xwd,
221       xgrabsc, or screendump.  Convert the result into a pbm file.  If neces‐
222       sary, use pamcut to remove anything you grabbed in addition to the text
223       pictured above (or be a  wimp  and  use  a  graphical  editor  such  as
224       ImageMagick).  Finally, run it through pnmcrop.  to make sure the edges
225       are right up against the text.  pbmtext can figure out  the  sizes  and
226       spacings from that.
227
228
229

SEE ALSO

231       pbmtextps(1),  pamcut(1),  pnmcrop(1), pamcomp(1), ppmchange(1), pnmro‐
232       tate(1), ppmlabel(1), pstopnm(1), pbm(1)
233
234

AUTHOR

236       Copyright (C) 1993 by Jef Poskanzer and George Phillips
237
238
239
240netpbm documentation             26 April 2007          Pbmtext User Manual(0)
Impressum