[reportlab-users] no one replied back :(

Kirby Urner reportlab-users@reportlab.com
Wed, 17 Dec 2003 13:58:31 -0800


This is a multi-part message in MIME format.

------=_NextPart_000_0013_01C3C4A5.DAD9F170
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

 

Since I have easy access to back posts, here's a transcript of what Sarah
was asking about (or is it Sam?):

hi guys,
 i tried the stuff u told me about it worked well , but ... i am using an
arabic font, so when i open the pdf , it contin arabic characters but not
the ones i wrote, so anyone faced this thing before ???. 
 i though of changing the locale of my OS but it did not work, i also tried
to change the default encoding in the site.py, it did not work either.
  ANY Suggestions ...

sam ellawindy

 

 

thanks for replying. here is the code i wrote:


    import reportlab.rl_config
    reportlab.rl_config.warnOnMissingFontGlyphs = 0 
    from reportlab.pdfbase import pdfmetrics
    from reportlab.pdfbase.ttfonts import TTFont
    from reportlab.pdfgen import canvas
    c = canvas.Canvas('t.pdf')
    pdfmetrics.registerFont(TTFont('ArabicRiyadh', 'ArabicRiyadh.ttf'))
    from reportlab.lib.fonts import addMapping
    addMapping('ArabicRiyadh', 0, 0, 'ArabicRiyadh')
    c.setFont('ArabicRiyadh', 32)
    TEST = u'JGaHm'
    #temp = unicode("JGaHm~", "ISO-8859-13")
    c.drawString(100, 700,TEST.encode('utf-8'))
    c.save()

 

the output was not JGaHm' at all, it another word.
by the way, i am uisng adode acrobat ME , and i used  another viewer but the
same thing took place.
i tried sending the ttf file to u, but the coz of its size, the modrator of
the group  send me a notification back.
thanks in advance,
sam ellawindy

 

Sir,
 i forget telling u something , a warning was araised during compilation :

         sys:1: DeprecationWarning: Non-ASCII character '\xca' in file
wxApp1.py on line 42, but no encoding declared; see
http://www.python.org/peps/pep-0263.html for details
      C:\PYTHON23\lib\reportlab\pdfbase\ttfonts.py:309: FutureWarning: x<<y
losing bits or changing sign will return a long in Python 2.4 and up

    ####where line 42 is the unicode string  i want to write in the pdf file

so i fetched the given URL (pep-0263), from it , i understood that if we
want to use a certain encoding, then the whole src code of the python should
use the same encoding.
 i assumed then that we need to change 1st the file encoding  and then we
could use the one that is used in arabic (normally, the arabic encoding used
with windows is - AR8MSWIN1256)(p.s. the platform used is win98 )
i got 2 questions then:
  1. whether i got that document wrong or right?
  2. if i got it right, how to change the source code file encoding?

thanks u for ur concern,
   sarah ellawindy

  

Sir,
 this is a mail i wrote before, but no one replied back. anyway, i said that
something might happened and noone saw it.
 i hope that anyone replies back to say whether i am in the right direction
or not.
 i want to ak about another thing, does this relates to the problem of cezch
character or not.
 i hope anyone replies back, thanks in advance.
sam ellawindy

 


------=_NextPart_000_0013_01C3C4A5.DAD9F170
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"place"/>
<o:SmartTagType =
namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags"
 name=3D"City"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
h1
	{margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:Arial;
	font-weight:bold;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:blue;
	text-decoration:underline;}
p
	{mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman";}
p.Style1, li.Style1, div.Style1
	{margin-top:12.0pt;
	margin-right:0in;
	margin-bottom:3.0pt;
	margin-left:0in;
	text-align:center;
	page-break-after:avoid;
	font-size:16.0pt;
	font-family:Arial;
	font-weight:bold;}
p.Source, li.Source, div.Source
	{margin:0in;
	margin-bottom:.0001pt;
	background:#CCFFFF;
	border:none;
	padding:0in;
	font-size:12.0pt;
	font-family:"Courier New";}
span.EmailStyle20
	{mso-style-type:personal-reply;
	font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dblue>

<div class=3DSection1>

<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0in 0in =
0in 4.0pt'>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Since I have easy access to back =
posts,
here&#8217;s a transcript of what Sarah was asking about (or is it =
Sam?):<o:p></o:p></span></font></p>

<p><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>hi guys,<br>
&nbsp;i tried the stuff u told me about it worked well , but ... i am =
using
an&nbsp; arabic font, so when i open the pdf , it contin
arabic&nbsp;characters&nbsp;but not the ones i wrote, so anyone faced =
this
thing before ???. <br>
&nbsp;i though of changing the locale of my OS but it did not work, i =
also
tried to change the default encoding in the site.py, it did not work =
either.<br>
&nbsp; ANY Suggestions ...<o:p></o:p></span></font></p>

<p><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>sam
ellawindy<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>thanks for replying. here is the code i =
wrote:<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><br>
&nbsp;&nbsp;&nbsp; import reportlab.rl_config<br>
&nbsp;&nbsp;&nbsp; reportlab.rl_config.warnOnMissingFontGlyphs =3D 0 =
<br>
&nbsp;&nbsp;&nbsp; from reportlab.pdfbase import pdfmetrics<br>
&nbsp;&nbsp;&nbsp; from reportlab.pdfbase.ttfonts import TTFont<br>
&nbsp;&nbsp;&nbsp; from reportlab.pdfgen import canvas<br>
&nbsp;&nbsp;&nbsp; c =3D canvas.Canvas('t.pdf')<br>
&nbsp;&nbsp;&nbsp; pdfmetrics.registerFont(TTFont('ArabicRiyadh',
'ArabicRiyadh.ttf'))<br>
&nbsp;&nbsp;&nbsp; from reportlab.lib.fonts import addMapping<br>
&nbsp;&nbsp;&nbsp; addMapping('ArabicRiyadh', 0, 0, 'ArabicRiyadh')<br>
&nbsp;&nbsp;&nbsp; c.setFont('ArabicRiyadh', 32)<br>
&nbsp;&nbsp;&nbsp; TEST =3D u'JGaHm'<br>
&nbsp;&nbsp;&nbsp; #temp =3D unicode(&quot;JGaHm~&quot;, =
&quot;ISO-8859-13&quot;)<br>
&nbsp;&nbsp;&nbsp; c.drawString(100, 700,TEST.encode('utf-8'))<br>
&nbsp;&nbsp;&nbsp; c.save()<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>&nbsp;<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>the output was not JGaHm' at all, it another word.<br>
by the way, i am uisng adode acrobat ME , and i used&nbsp; another =
viewer but
the same thing took place.<br>
i tried sending the ttf file to u, but the coz of its size, the modrator =
of the
group &nbsp;send me a notification back.<br>
thanks in advance,<br>
sam ellawindy<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>Sir,<br>
&nbsp;i forget telling u something , a warning&nbsp;was araised during
compilation :<o:p></o:p></span></font></p>

<p><font size=3D1 color=3D"#400000" face=3D"Times New Roman"><span =
style=3D'font-size:
7.5pt;color:#400000'>&nbsp;&nbsp;&nbsp;&nbsp;</span></font><font =
size=3D1
color=3D"#ff007f"><span =
style=3D'font-size:7.5pt;color:#FF007F'>&nbsp;&nbsp;&nbsp;&nbsp;
sys:1: DeprecationWarning: Non-ASCII character '\xca' in file wxApp1.py =
on line
42, but no encoding declared; see =
http://www.python.org/peps/pep-0263.html for
details<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
C:\PYTHON23\lib\reportlab\pdfbase\ttfonts.py:309: FutureWarning: =
x&lt;&lt;y
losing bits or changing sign will return a long in Python 2.4 and =
up</span></font><o:p></o:p></p>

<p><font size=3D1 color=3D"#400000" face=3D"Times New Roman"><span =
style=3D'font-size:
7.5pt;color:#400000'>&nbsp;&nbsp;&nbsp; </span></font><font size=3D1 =
color=3Dblack><span
style=3D'font-size:7.5pt;color:black'>####where line 42 is the unicode
string&nbsp; i want to write in the pdf file</span></font><font size=3D1
color=3D"#400000"><span =
style=3D'font-size:7.5pt;color:#400000'><o:p></o:p></span></font></p>

<p><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>so
i&nbsp;fetched the given URL (pep-0263), from it , i understood that if
we&nbsp;want to use&nbsp;a certain encoding, then the whole src code of =
the
python should use the same encoding.<br>
&nbsp;i assumed then that we need to change 1st the file encoding&nbsp; =
and
then we could use the one that is used in arabic (normally, the arabic =
encoding
used with windows is - AR8MSWIN1256)(p.s.&nbsp;the platform used is =
win98&nbsp;)<br>
i got 2 questions then:<br>
&nbsp; 1. whether i got that document wrong or right?<br>
&nbsp; 2. if i got it right, how to change the source code file =
encoding?<o:p></o:p></span></font></p>

<p><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>thanks u
for <st1:place w:st=3D"on"><st1:City =
w:st=3D"on">ur</st1:City></st1:place> concern,<br>
&nbsp;&nbsp; sarah ellawindy<o:p></o:p></span></font></p>

<p><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:12.0pt'>&nbsp; <o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'>Sir,<br>
&nbsp;this is a mail i wrote before, but no one replied back. anyway, i =
said
that something might happened and noone saw it.<br>
&nbsp;i hope that anyone replies back to say whether i am in the right
direction or not.<br>
&nbsp;i want to ak about another thing, does this relates to the problem =
of
cezch character or not.<br>
&nbsp;i hope anyone replies back, thanks in advance.<br>
sam ellawindy</span></font><font size=3D2 color=3Dnavy =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial;color:navy'><o:p></o:p></span=
></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

</div>

</div>

</body>

</html>

------=_NextPart_000_0013_01C3C4A5.DAD9F170--