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.  For more flexible (but complex) drawing of  text  on
136       an  image,  there  is  ppmdraw.  These do not give you the font options
137       that pbmtext does, though.
138
139       Another way is to use pbmtext to create an image containing  the  text,
140       then  use  pamcomp  to overlay the text image onto your base image.  To
141       make only the text (and not the entire rectangle containing  it)  cover
142       the  base  image,  you will need to give pamcomp a mask, via its -alpha
143       option.  You can just use the text image itself as the mask, as long as
144       you also specify the -invert option to pamcomp.
145
146       If  you  want  to  overlay colored text instead of black, just use ppm‐
147       change to change all black pixels to the color of  your  choice  before
148       overlaying  the text image.  But still use the original black and white
149       image for the alpha mask.
150
151       If you want the text at an angle, use pnmrotate on the text image  (and
152       alpha mask) before overlaying.
153
154

FONTS

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

NON-ENGLISH TEXT

247       pbmtext does little to accomodate  the  special  needs  of  non-English
248       text.
249
250       pbmtext  reads  input  in  byte  units.  Unicode (utf-7, utf-8, utf-16,
251       etc.) text which contains multibyte characters does not work.
252
253       pbmtext can handle 7-bit and 8-bit character sets.  Examples are ASCII,
254       ISO 8859 family, koi8-r/u and VISCII.  It is up to the user to supply a
255       BDF file covering the necessary glyphs with the  "-font"  option.   The
256       font file must be in the right encoding.
257
258       pbmtext  does not recognize locale.  It ignores the associated environ‐
259       ment variables.
260
261       pbmtext cannot render vertically or right to left.
262
263
264

TIPS

266       If you get garbled output, check whether the font file encoding  corre‐
267       sponds  to  the input text encoding.  Also make sure that your input is
268       not in utf-* or any other mutli-byte format.
269
270       To dump characters in a BDF font file run this command:
271
272           $ awk 'BEGIN { for (i=0x01; i<=0xFF; i++)
273                           { printf('%c%s',i,i%16==15 ? '\n':''); } }' |\
274             pbmtext -f font.bdf > dump.pbm
275
276       If you need only ASCII, change the for statement to:
277
278            for (i=0x20; i<=0x7E; i++)
279
280       To check the encoding of a BDF file, examine the CHARSET_REGISTRY  line
281       and the next line, which should be CHARSET_ENCODING:
282
283           $ grep -A1 CHARSET_REGISTRY font-a.bdf
284           CHARSET_REGISTRY 'ISO8859'
285           CHARSET_ENCODING '1'
286
287           $ grep -A1 CHARSET_REGISTRY font-b.bdf
288           CHARSET_REGISTRY 'ISO10646'
289           CHARSET_ENCODING '1'
290
291       The latter is Unicode.  BDF files coded in ISO 16046-1 usually work for
292       Western European languages, because  ISO  16046-1  expands  ISO  8859-1
293       (also  called  'Latin-1')  while maintaining the first 256 code points.
294       ISO 8859-1 itself is a superset of ASCII.  Run the  above  command  and
295       verify the necessary glyphs are present.
296
297       It may sound strange that pbmtext accepts font files encoded in Unicode
298       but not input text in Unicode.  This is because Unicode  provides  sev‐
299       eral 'numbering schemes'.
300
301       When  rendering text in character sets other than ISO 8859-1, one often
302       has to produce a BDF file in the given encoding from a master BDF  file
303       encoded in ISO 10646-1.
304
305       In  particular,  75%  of the BDF files in the font collection available
306       from the Netpbm  website  ⟨http://netpbm.sourceforge.net/bdffont.tgz
307       are  in  ISO 10646-1.  Many have the Euro sign, Greek letters, etc, but
308       they are placed in code points beyond what pbmtext sees.
309
310       There are several programs that perform BDF  encoding  conversion.   If
311       you have the X Window System installed, first look for ucs2any.  If you
312       don't, you can download ucs2any.pl from  Unicodefontsandtools  for  X11
313       (1).  This website has much useful information on fonts.
314
315       Another converter is trbdf, included in the 'trscripts' package, avail‐
316       able in some GNU/Linux distributions.
317
318       BDF files encoded in ISO 8859-2, ISO 8859-7, koi8-r, etc. are available
319       from  ISO8859Alphabet  Soup  (1) and its sister page TheCyrillicCharset
320       Soup (1).  Though the information is dated, these  pages  give  a  good
321       overview of 8-bit character sets.
322
323       To convert OTF or TTF font files to BDF, use
324        otf2bdf                 by                 Mike                Leisher
325http://www.math.nmsu.edu/~mleisher/Software/otf2bdf⟩ .
326
327
328

SEE ALSO

330       pbmtextps(1), pamcut(1), pnmcrop(1), pamcomp(1),  ppmchange(1),  pnmro‐
331       tate(1),    ppmlabel(1),    ppmdraw(1),   pstopnm(1),   pbm(1),   Pango
332       http://www.pango.org, Cairo ⟨http://cairographics.org
333
334

AUTHOR

336       Copyright (C) 1993 by Jef Poskanzer and George Phillips
337
338
339
340netpbm documentation             14 June 2010           Pbmtext User Manual(0)
Impressum