[reportlab-users] Using accented chars with TTF?
Dinu Gherman
reportlab-users@reportlab.com
Tue, 10 Sep 2002 08:53:51 +0200
--Apple-Mail-21--353459840
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Hi,
I'm trying to use TTF fonts with Platypus where I found a little
surprise: I can see accented characters after converting my text
input to UTF-8, but these are prefixed by the logical NOT charac-
ter. See attached PDF sample and generator file. Can anybody ex-
plain this, or, even better, suggest how to get rid of them?
Thanks,
Dinu
--Apple-Mail-21--353459840
Content-Disposition: attachment;
filename=rinatest.py
Content-Transfer-Encoding: quoted-printable
Content-Type: application/text;
x-unix-mode=0644;
x-mac-type=54455854;
name="rinatest.py"
#=20rinatest1.py=0A=0Afrom=20reportlab.lib.styles=20import=20=
ParagraphStyle=0Afrom=20reportlab.lib.fonts=20import=20addMapping=0Afrom=20=
reportlab.pdfbase=20import=20pdfmetrics=0Afrom=20=
reportlab.pdfbase.ttfonts=20import=20TTFont=0Afrom=20=
reportlab.platypus.doctemplate=20import=20SimpleDocTemplate=0Afrom=20=
reportlab.platypus.paragraph=20import=20Paragraph=0A=0A=
pdfmetrics.registerFont(TTFont('Rina',=20'Rina.ttf'))=0Afor=20i=20in=20=
(0,=201):=0A=20=20=20=20for=20j=20in=20(0,=201):=0A=20=20=20=20=20=20=20=20=
addMapping('Rina',=20i,=20j,=20'Rina')=0A=0Adef=20latin1toUtf8(s):=0A=20=20=
=20=20return=20unicode(s,=20"iso-8859-1").encode("utf-8")=0A=0Anormal=20=
=3D=20ParagraphStyle('normal')=0Ap=20=3D=20=
Paragraph(latin1toUtf8('Andr=8E'),=20normal)=0A=
SimpleDocTemplate('Andre.pdf').build([p])=0A=0A=
--Apple-Mail-21--353459840
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
--Apple-Mail-21--353459840
Content-Disposition: inline;
filename=Andre.pdf
Content-Transfer-Encoding: quoted-printable
Content-Type: application/pdf;
x-unix-mode=0644;
name="Andre.pdf"
%PDF-1.3=0D=0A%=93=8C=8B=9E=20ReportLab=20Generated=20PDF=20document=20=
http://www.reportlab.com=0D=0A%=20'BasicFonts'=20=
'<reportlab.pdfbase.pdfdoc.PDFDictionary=20instance=20a'=20=0D=0A1=200=20=
obj=0D=0A%=20The=20standard=20fonts=20dictionary=0D=0A<<=20/F1=202=200=20=
R=0D=0A=20/F2=203=200=20R=20>>=0D=0Aendobj=0D=0A%=20'F1'=20=
'<reportlab.pdfbase.pdfdoc.PDFType1Font=20instance=20at'=20=0D=0A2=200=20=
obj=0D=0A%=20Font=20Helvetica=0D=0A<<=20/BaseFont=20/Helvetica=0D=0A=20=
/Encoding=20/MacRomanEncoding=0D=0A=20/Name=20/F1=0D=0A=20/Subtype=20=
/Type1=0D=0A=20/Type=20/Font=20>>=0D=0Aendobj=0D=0A%=20'F2'=20=
'<reportlab.pdfbase.pdfdoc.PDFType1Font=20instance=20at'=20=0D=0A3=200=20=
obj=0D=0A%=20Font=20Times-Roman=0D=0A<<=20/BaseFont=20/Times-Roman=0D=0A=20=
/Encoding=20/MacRomanEncoding=0D=0A=20/Name=20/F2=0D=0A=20/Subtype=20=
/Type1=0D=0A=20/Type=20/Font=20>>=0D=0Aendobj=0D=0A%=20'Page1'=20=
'<reportlab.pdfbase.pdfdoc.PDFPage=20instance=20at=200x2b'=20=0D=0A4=200=20=
obj=0D=0A%=20Page=20dictionary=0D=0A<<=20/Contents=208=200=20R=0D=0A=20=
/MediaBox=20[=200=0D=0A=20=200=0D=0A=20=20595.275590551=0D=0A=20=20=
841.88976378=20]=0D=0A=20/Parent=207=200=20R=0D=0A=20/Resources=20<<=20=
/Font=201=200=20R=0D=0A=20=20/ProcSet=20[=20/PDF=0D=0A=20=20=20/Text=0D=0A=
=20=20=20/ImageB=0D=0A=20=20=20/ImageC=0D=0A=20=20=20/ImageI=20]=20>>=0D=0A=
=20/Trans=20<<=20=20>>=0D=0A=20/Type=20/Page=20>>=0D=0Aendobj=0D=0A%=20=
'R5'=20'<reportlab.pdfbase.pdfdoc.PDFCatalog=20instance=20at=200'=20=0D=0A=
5=200=20obj=0D=0A%=20Document=20Root=0D=0A<<=20/Outlines=209=200=20R=0D=0A=
=20/PageMode=20/UseNone=0D=0A=20/Pages=207=200=20R=0D=0A=20/Type=20=
/Catalog=20>>=0D=0Aendobj=0D=0A%=20'R6'=20=
'<reportlab.pdfbase.pdfdoc.PDFInfo=20instance=20at=200x4a'=20=0D=0A6=200=20=
obj=0D=0A<<=20/Author=20(anonymous)=0D=0A=20/CreationDate=20=
(20020910084809)=0D=0A=20/Producer=20(ReportLab=20=
http://www.reportlab.com)=0D=0A=20/Subject=20(unspecified)=0D=0A=20=
/Title=20(untitled)=20>>=0D=0Aendobj=0D=0A%=20'R7'=20=
'<reportlab.pdfbase.pdfdoc.PDFPages=20instance=20at=200x1'=20=0D=0A7=200=20=
obj=0D=0A%=20page=20tree=0D=0A<<=20/Count=201=0D=0A=20/Kids=20[=204=200=20=
R=20]=0D=0A=20/Type=20/Pages=20>>=0D=0Aendobj=0D=0A%=20'R8'=20=
'<reportlab.pdfbase.pdfdoc.PDFStream=20instance=20at=200x'=20=0D=0A8=200=20=
obj=0D=0A%=20page=20stream=0D=0A<<=20/Filter=20[=20/ASCII85Decode=0D=0A=20=
=20/FlateDecode=20]=0D=0A=20/Length=20171=20>>=0D=0Astream=0D=0A=
Gar>?]*\To&F9MpLFLatB%D2C9*MH#&[o>I;%W02qu=3DMjOBB"G#%hLlLhOmc=0D=0A=
D\Gm'm=3Dh2u+(,E^3oI*r]tIp3,nU)AU\`cmSg!8ah^,m=3DoX9b5bL8QM`VR9J=0D=0A=
U]R+2Lk(K\qY@Au<lb$MN4UL5YZjJ%cqSM+/HtT,0Z5H=3D~>endstream=0D=0A=0D=0A=
endobj=0D=0A%=20'R9'=20'<reportlab.pdfbase.pdfdoc.PDFOutlines=20instance=20=
at=20'=20=0D=0A9=200=20obj=0D=0A<<=20/Count=200=0D=0A=20/Type=20=
/Outlines=20>>=0D=0Aendobj=0D=0Axref=0D=0A0=2010=0D=0A0000000000=2065535=20=
f=0D=0A0000000145=2000000=20n=0D=0A0000000286=2000000=20n=0D=0A=
0000000485=2000000=20n=0D=0A0000000691=2000000=20n=0D=0A0000001012=20=
00000=20n=0D=0A0000001184=2000000=20n=0D=0A0000001417=2000000=20n=0D=0A=
0000001558=2000000=20n=0D=0A0000001908=2000000=20n=0D=0Atrailer=0D=0A<<=20=
/ID=20=0D=0A=20=20%=20ReportLab=20generated=20PDF=20document=20--=20=
digest=20(http://www.reportlab.com)=20=0D=0A=20=20=
[(j\377"\267\332:\317\015\360D\335\3208zZ\371)=20=
(j\377"\267\332:\317\015\360D\335\3208zZ\371)]=20=0D=0A=20=0D=0A=20/Info=20=
6=200=20R=0D=0A=20/Root=205=200=20R=0D=0A=20/Size=2010=20>>=0D=0A=
startxref=0D=0A1959=0D=0A%%EOF=0D=0A=
--Apple-Mail-21--353459840--