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  [-wchar]  [-font fontfile] [-builtin fontname] [-space pixels]
11       [-lspace pixels] [-nomargins] [-width pixels] [-text-dump] [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       The  text  rendered is all the non-option command line arguments, sepa‐
28       rated by spaces, except that if there are no  non-option  command  line
29       arguments, it is Standard Input.
30
31
32       In the image, each line of input is a line of output.  Formatting char‐
33       acters such as newline have no  effect  on  the  formatting;  like  any
34       unprintable character, they turn into spaces.
35
36       The  image  is just wide enough for the longest line of text, plus mar‐
37       gins, and just high enough to contain the lines of text, plus margins.
38
39       The left and right margins are twice the width of the widest  character
40       in  the  font; the top and bottom margins are the height of the tallest
41       character in the font.  But if the text is only one line, all the  mar‐
42       gins  are half of this.  You can use the -nomargins option to eliminate
43       the margins.
44
45       pbmtext renders left to right.  It cannot render vertically or right to
46       left.
47
48       pbmtextps  does the same thing as pbmtext, but uses Ghostscript to gen‐
49       erate the characters, which means you can use Postscript fonts.  But it
50       also means you have to have Ghostscript installed and it isn't as fast.
51       Also, pbmtextps generates only one line of text,  whereas  pbmtext  can
52       create multiple lines.
53
54       pbmtext  is  meant for simple text.  If you're working with a document,
55       you would be better off using a document formatting program to  "print"
56       to a Postscript file, then feeding that Postscript to pstopnm.
57
58

OPTIONS

60       -wchar
61
62              By  default,  pbmtext  takes  a  single-byte character stream as
63              input.  When you specify -wchar,  it  treats  input  text  as  a
64              multibyte  character  stream  encoded  according  to the current
65              locale.  Normally, the user would supply a BDF font file encoded
66              in ISO-10646-1 with a -font option.
67
68              With  -wchar, you cannot supply the text on the command line; it
69              must be fed from standard input.
70
71              This option was new in Netpbm 10.82 (March 2018).
72
73
74
75       -font
76
77       -builtin
78              -builtin selects a font among those built into Netpbm.
79
80              -font selects a font that you supply yourself  either  as  an  X
81              Window     System     BDF     (Bitmap    Distribution    Format)
82http://xfree86.org/current/bdf.pdf⟩  file or as a PBM file in a
83              special form.
84
85              The default is the built in font "bdf."
86
87              "bdf"  is  Times-Roman  15  pixels high.  (That's about 14 point
88              type printed at 75 dpi).
89
90              "fixed" is a built in fixed width font.
91
92              For information about other fonts, and how to make one  of  your
93              own, see Fonts ⟨#fonts⟩  below.
94
95
96
97       -space pixels
98               Add  pixels  pixels  of  space  between characters.  This is in
99              addition to whatever space surrounding characters is built  into
100              the font, which is usually enough to produce a reasonable string
101              of text.
102
103              pixels may be fractional, in which case  the  number  of  pixels
104              added  varies so as to achieve the specified average.  For exam‐
105              ple -space=1.5 causes half the spaces to be 1 pixel and half  to
106              be 2 pixels.
107
108              pixels  may  be  negative to crowd text together, but the author
109              has not put much thought or testing into how this works in every
110              possible case, so it might cause disastrous results.
111
112
113       -lspace pixels
114               Add  pixels pixels of space between lines.  This is in addition
115              to whatever space above and below characters is built  into  the
116              font, which is usually enough to produce a reasonable line spac‐
117              ing.
118
119              pixels must be a whole number.
120
121              pixels may be negative to crowd lines together, but  the  author
122              has not put much thought or testing into how this works in every
123              possible case, so it might cause disastrous results.
124
125
126       -nomargins
127              By default,  pbmtext  adds  margins  all  around  the  image  as
128              described above.  This option causes pbmtext not to add any mar‐
129              gins.
130
131              Note that there may still be space beyond the edges of the  type
132              because  a  character itself may include space at its edges.  To
133              eliminate all surrounding background, so the  type  touches  all
134              four edges of the image, use pnmcrop.
135
136
137       -width pixels
138              This specifies how much horizontal space the text is supposed to
139              fit into.
140
141              If the input is one line, pbmtext breaks it into multiple  lines
142              as  needed  to  fit  the  specified width.  It breaks it between
143              characters, but does not pay attention to white  space;  it  may
144              break  in  the middle of a word and a line may begin or end with
145              white space.
146
147              If the input is multiple lines, pbmtext assumes you already have
148              line  breaks where they make sense, and pbmtext simply truncates
149              each line as needed to fit the specified width.
150
151
152       -text-dump
153              This option causes pbmtext just to write to Standard Output  the
154              text  in  ASCII that would be rendered.  The output reflects any
155              text formatting, unprintable character substitution, tab  expan‐
156              sion,  etc.  It is for diagnosing problems.  This option was new
157              in Netpbm 10.82 (March 2018).
158
159              When -wchar is in effect, the output text will be in the  encod‐
160              ing specified by the current locale.
161
162
163
164
165

USAGE

167       Often,  you  want to place text over another image.  One way to do this
168       is with ppmlabel.  For more flexible (but complex) drawing of  text  on
169       an  image,  there  is  ppmdraw.  These do not give you the font options
170       that pbmtext does, though.
171
172       Another way is to use pbmtext to create an image containing  the  text,
173       then  use  pamcomp  to overlay the text image onto your base image.  To
174       make only the text (and not the entire rectangle containing  it)  cover
175       the  base  image,  you will need to give pamcomp a mask, via its -alpha
176       option.  You can just use the text image itself as the mask, as long as
177       you also specify the -invert option to pamcomp.
178
179       If  you  want  to  overlay colored text instead of black, just use ppm‐
180       change to change all black pixels to the color of  your  choice  before
181       overlaying  the text image.  But still use the original black and white
182       image for the transparency mask.
183
184       If you want the text at an angle, use pnmrotate on the text image  (and
185       transparency mask) before overlaying.
186
187

FONTS

189       There are three kinds of fonts you an use with pbmtext:
190
191
192
193       ·      built in
194
195       ·      BDF
196
197       ·      PBM
198
199
200
201   Built In Fonts
202       There  are  two  built in fonts: bdf and fixed.  You select these fonts
203       with a -builtin option.
204
205       bdf is the default when you specify no font information on the  command
206       line.  The naming reflects the fact that it shares many characteristics
207       of BDF style fonts.  When this font was implemented,  pbmtext  did  not
208       have  the  ability  to  read arbitrary BDF fonts specified by the -font
209       option.  There is no external font file involved.
210
211       bdf is encoded in ISO 8859-1 (Latin 1, 8-bit).  In addition to  English
212       it  can  handle  most West European languages (Spanish, French, German,
213       Swedish ...)  This set lacks the Euro currency sign.
214
215       fixed is ASCII (7-bit) only.
216
217       While it is not an error to do so, you should not use the above  built-
218       in fonts with -wchar.
219
220
221
222   BDF Font
223       BDF  is  an ancient font format that at one time was standard for the X
224       Window System.  Now, you don't see it very often, but you can find some
225       BDF             fonts             on             the            Xfree86
226http://cvsweb.xfree86.org/cvsweb/xc/fonts/bdf/⟩  web site.
227
228       You can get the full package of the BDF fonts from XFree86 (see  above)
229       from the Netpbm web site ⟨http://netpbm.sourceforge.net/bdffont.tgz⟩ .
230
231
232   PBM Font
233       To create a font as a PBM file (to use with the -font option), you just
234       create a PBM image of the text matrix below.
235
236       The first step is to display text matrix below on the screen,  e.g.  in
237       an X11 window.
238
239
240           M ",/^_[`jpqy| M
241
242           /  !"#$%&'()*+ /
243           < ,-./01234567 <
244           > 89:;<=>?@ABC >
245           @ DEFGHIJKLMNO @
246           _ PQRSTUVWXYZ[ _
247           { \]^_`abcdefg {
248           } hijklmnopqrs }
249           ~ tuvwxyz{|}~  ~
250
251           M ",/^_[`jpqy| M
252
253
254       Make  sure  it's a fixed width font -- This should display as a perfect
255       rectangle.
256
257       Also, try to use a simple display program.  Pbmtext divides this into a
258       matrix  of  cells, all the same size, each containing one character, so
259       it is important that whatever you use to display it display  with  uni‐
260       form  horizontal  and vertical spacing.  Fancy word processing programs
261       sometimes stretch characters in both directions to fit  certain  dimen‐
262       sions,  and that won't work.  Sometimes a display program scales a font
263       to show a character larger or smaller than its natural size.  That  too
264       won't  often  work because the rounding involved in such scaling causes
265       non-uniform distances between characters.
266
267       If you display the text matrix improperly, the usual  symptom  is  that
268       when  you  try  to  use  the  font, pbmtext fails with an error message
269       telling you that the number of lines in the font isn't divisible by 11,
270       or  it can't find the blank band around the inner rectangle.  Sometimes
271       the symptom is that one of the characters displays with a piece of  the
272       character  that  is  next  to it in the matrix.  For example, "l" might
273       display with a little piece of the "m" attached on its right.
274
275       Do a screen grab or window dump of that text, using for  instance  xwd,
276       xgrabsc, or screendump.  Convert the result into a pbm file.  If neces‐
277       sary, use pamcut to remove anything you grabbed in addition to the text
278       pictured  above (or be a wimp and use a graphical editor such as Gimp).
279       Finally, run it through pnmcrop to make sure the  edges  are  right  up
280       against  the  text.  pbmtext can figure out the sizes and spacings from
281       that.
282
283       There are some historical computer fonts, such  as  that  used  by  the
284       original  IBM  PC, in the form that you can screen-grab and turn into a
285       PBM font file available from Stewart C Russell" (1).  There  are  fonts
286       with various duodecimal digit glyphs at
287        treisara.deviantart.com
288http://treisaran.deviantart.com/gallery/38695571/NetPBM-Fonts⟩ .
289
290       PBM fonts cannot be used with -wchar.
291
292
293
294

MULTI-BYTE INPUT

296       In the past, English text was encoded in 7-bit ASCII.  8-bit and multi‐
297       byte encodings were needed only for non-English languages.  This is not
298       the case today.  As of this writing, 90% of all web pages  are  encoded
299       in  UTF-8.   While many of them are actually restricted to 7-bit ASCII,
300       which is a subset of UTF-8, English  text  encoded  in  UTF-8  commonly
301       employs "66 99" style quotation marks, which do not appear in ASCII.
302
303       If  your  input  text is UTF-8, you should use -wchar.  You may have to
304       tweak the locale setting.  pbmtext recognizes code points up to  65535.
305       This is sufficient for the vast majority of text written in modern lan‐
306       guages.
307
308       In the default single-byte (or "narrow") character  mode,  pbmtext  can
309       handle  7-bit  and  8-bit character sets.  Examples are ASCII, ISO 8859
310       family, koi8-r/u and VISCII.  It is up to the user to supply a BDF file
311       covering  the  necessary glyphs with the "-font" option.  The font file
312       must be in the right encoding.
313
314       pbmtext does not inspect the encoding of the font file.
315
316
317

TIPS

319       If you get garbled output, check the input text encoding and font  file
320       encoding.  When using -wchar, also check the current locale.
321
322       To convert the encoding of a text file, use iconv or luit.
323
324       To  check the encoding of a BDF file, examine the CHARSET_REGISTRY line
325       and the next line, which should be CHARSET_ENCODING:
326
327           $ grep -A1 CHARSET_REGISTRY font-a.bdf
328           CHARSET_REGISTRY "ISO8859"
329           CHARSET_ENCODING "1"
330
331           $ grep -A1 CHARSET_REGISTRY font-b.bdf
332           CHARSET_REGISTRY "ISO10646"
333           CHARSET_ENCODING "1"
334
335       The latter is Unicode.  BDF files coded in ISO 16046-1 usually work for
336       Western  European  languages,  because  ISO  16046-1 expands ISO 8859-1
337       (also called "Latin-1") while maintaining the first  256  code  points.
338       ISO  8859-1  itself  is a superset of ASCII.  Run the above command and
339       verify the necessary  glyphs are present.
340
341       IMPORTANT: For input text, a different rule applies.  If you  feed  ISO
342       8859-1 text to pbmtext -wchar set up for UTF-8, the output will be gar‐
343       bled.  Unicode provides several encoding schemes and different ones are
344       in  effect  for  input  text  and font.  The difference between Unicode
345       codepoint and the various encodings is a  formidable  stumbling  block;
346       beware of web pages that get the concept wrong.
347
348       75%  of  the BDF files in the font collection available from the Netpbm
349       website  ⟨http://netpbm.sourceforge.net/bdffont.tgz⟩     are   in   ISO
350       10646-1.   Many  have  the Euro sign, Greek letters, etc., but they are
351       placed at code points available to pbmtext only with -wchar.
352
353       Before pbmtext had the -wchar option, one often had to  produce  a  BDF
354       file  in  an  8-bit  encoding  from  a  master  BDF file encoded in ISO
355       10646-1.
356
357       There are several programs that perform BDF  encoding  conversion.   If
358       you have the X Window System installed, first look for ucs2any.  If you
359       don't, you can download ucs2any.pl from Unicode  fonts  and  tools  for
360       X11" (1).  This website has much useful information on fonts.
361
362       Another converter is trbdf, included in the "trscripts" package, avail‐
363       able in some GNU/Linux distributions.
364
365       BDF files encoded in ISO 8859-2, ISO 8859-7, koi8-r, etc. are available
366       from  ISO  8859  Alphabet  Soup"  (1)  and its sister page The Cyrillic
367       Charset Soup" (1).  Though the information is dated, these pages give a
368       good overview of 8-bit character sets.
369
370       To convert OTF or TTF font files to BDF, use
371        otf2bdf                 by                 Mike                Leisher
372http://www.math.nmsu.edu/~mleisher/Software/otf2bdf⟩ .
373
374
375

SEE ALSO

377       pbmtextps(1), pamcut(1), pnmcrop(1), pamcomp(1),  ppmchange(1),  pnmro‐
378       tate(1),    ppmlabel(1),    ppmdraw(1),   pstopnm(1),   pbm(1),   Pango
379       http://www.pango.org, Cairo ⟨http://cairographics.org
380
381

AUTHOR

383       Copyright (C) 1993 by Jef Poskanzer and George Phillips
384

DOCUMENT SOURCE

386       This manual page was generated by the Netpbm tool 'makeman'  from  HTML
387       source.  The master documentation is at
388
389              http://netpbm.sourceforge.net/doc/pbmtext.html
390
391netpbm documentation             25 March 2018          Pbmtext User Manual(0)
Impressum