53
53
If your data is not encoded as UTF8, you will get a UnicodeDecodeError as
54
54
soon as you feed in a non-ASCII character. For example, this snippet below is
55
55
attempting to read in and print a series of names, including one with a French
88
heading2("Changing the built-in fonts output encoding")
88
heading2("Automatic output font substitution")
91
91
There are still a number of places in the code, including the rl_config
92
defaultEncoding parameter, and arguments passed to various Font constructors.
93
These generally relate to the OUTPUT encoding used when we write data in the font
94
file. This affects which characters are actually available in the font if
95
you are using Type 1 fonts, since only 256 glyphs can be available at
96
one time. Unless you have a very specific need for
97
MacRoman or MacExpert encoding characters, we advise you to ignore
98
this. By default the standard fonts (Helvetica, Courier, Times Roman)
99
will offer the glyphs available in Latin-1. If you try to print a non-Latin-1
100
character using the built-in Helvetica, you'll see a rectangle or blob.
92
defaultEncoding parameter, and arguments passed to various Font constructors,
93
which refer to encodings. These were useful in the past when people needed to
94
use glyphs in the Symbol and ZapfDingbats fonts which are supported by PDF
97
By default the standard fonts (Helvetica, Courier, Times Roman)
98
will offer the glyphs available in Latin-1. However, if our engine detects
99
a character not in the font, it will attempt to switch to Symbol or ZapfDingbats to
100
display these. For example, if you include the Unicode character for a pair of
101
right-facing scissors, \\u2702, in a call to ^drawString^, you should see them (there is
102
an example in ^test_pdfgen_general.py/pdf^). It is not
103
necessary to switch fonts in your code.
324
327
registerFontFamily('Vera',normal='Vera',bold='VeraBd',italic='VeraIt',boldItalic='VeraBI')
326
329
disc("""Before using the TT Fonts in Platypus we should add a mapping from the family name to the
327
individual font names that describe the behaviour under the $<b>$ and $<i>$ attributes.""")
330
individual font names that describe the behaviour under the $<b>$ and $<i>$ attributes.""")
330
333
from reportlab.pdfbase.pdfmetrics import registerFontFamily