Re: Problem using drawToFile() using PyCairo backend

Andy Robinson <[email protected]> Mon, 12 Jun 2023 17:13:50 +0200
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CABjtAps=UWq-tH6kAx0GZi+_gHr5s_rv8Xocy-nSr8FOA_q2pw@mail.gmail.com>
--===============5409073000237447853==
Content-Type: multipart/alternative; boundary="000000000000224e0605fdf02b04"

--000000000000224e0605fdf02b04
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Many thanks for your investigations.  I'll have to let Robin Becker assess
this one; we are out of the office today...

- Andy

On Mon, 12 Jun 2023 at 15:27, Lele Gaifax <[email protected]> wrote:

> Lele Gaifax <[email protected]> writes:
>
> > I will dig further to understand what is going on in the app context,
> > that apparently has the same versions of those packages, except for
> > Pillow, which is at version 9.4.0...
>
> Ok, I found the culprit. For some reason, the app context had an old
> version of freetype-py, not the required 2.4.0, and that old version did
> not have the Outline.decompose() method. It didn't help the fact that
> freetype.version() actually returns the underline wrapped library, not
> the version of the Python wrapper itself.
>
> Basically, I had this in a standalone fresh virtualenv
>
>     >>> import freetype
>     >>> freetype.version()
>     (2, 13, 0)
>     >>> face =3D
> freetype.Face("/home/lele/3rd/reportlab/src/reportlab/fonts/Vera.ttf")
>     >>> face.set_char_size( 48*64 )
>     >>> face.load_char('S')
>     >>> face.glyph.outline
>     <freetype.Outline object at 0x7fd266a9eb90>
>     >>> face.glyph.outline.decompose
>     <bound method Outline.decompose of <freetype.Outline object at
> 0x7fd266a9e980>>
>
> while doing the same in my app context I saw
>
>     >>> import freetype
>     >>> freetype.version()
>     (2, 13, 0)
>     >>> face =3D
> freetype.Face("/home/lele/3rd/reportlab/src/reportlab/fonts/Vera.ttf")
>     >>> face.set_char_size( 48*64 )
>     >>> face.load_char('S')
>     >>> face.glyph.outline
>     <freetype.Outline object at 0x7fffe99a14d0>
>     >>> face.glyph.outline.decompose
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in <module>
>     AttributeError: 'Outline' object has no attribute 'decompose'
>
> Sorry for the noise,
> bye, lele.
> --
> nickname: Lele Gaifax | Dire che Emacs =C3=A8 "conveniente" =C3=A8 come
> real: Emanuele Gaifas | etichettare l'ossigeno come "utile"
> [email protected]      |                           -- Rens Troost
>
> _______________________________________________
> reportlab-users mailing list
> [email protected]
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>


--=20
Andy Robinson
Managing Director, ReportLab

--000000000000224e0605fdf02b04
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Many thanks for your investigations.=C2=A0 I&#39;ll have t=
o let Robin Becker assess this one; we are out of the office today...<div><=
br></div><div>- Andy</div></div><br><div class=3D"gmail_quote"><div dir=3D"=
ltr" class=3D"gmail_attr">On Mon, 12 Jun 2023 at 15:27, Lele Gaifax &lt;<a =
href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br=
></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex">Lele Gaifax &lt;<a=
 href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
t</a>&gt; writes:<br>
<br>
&gt; I will dig further to understand what is going on in the app context,<=
br>
&gt; that apparently has the same versions of those packages, except for<br=
>
&gt; Pillow, which is at version 9.4.0...<br>
<br>
Ok, I found the culprit. For some reason, the app context had an old<br>
version of freetype-py, not the required 2.4.0, and that old version did<br=
>
not have the Outline.decompose() method. It didn&#39;t help the fact that<b=
r>
freetype.version() actually returns the underline wrapped library, not<br>
the version of the Python wrapper itself.<br>
<br>
Basically, I had this in a standalone fresh virtualenv<br>
<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; import freetype<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; freetype.version()<br>
=C2=A0 =C2=A0 (2, 13, 0)<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face =3D freetype.Face(&quot;/home/lele/3rd/repo=
rtlab/src/reportlab/fonts/Vera.ttf&quot;)<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.set_char_size( 48*64 )<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.load_char(&#39;S&#39;)<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.glyph.outline<br>
=C2=A0 =C2=A0 &lt;freetype.Outline object at 0x7fd266a9eb90&gt;<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.glyph.outline.decompose<br>
=C2=A0 =C2=A0 &lt;bound method Outline.decompose of &lt;freetype.Outline ob=
ject at 0x7fd266a9e980&gt;&gt;<br>
<br>
while doing the same in my app context I saw<br>
<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; import freetype<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; freetype.version()<br>
=C2=A0 =C2=A0 (2, 13, 0)<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face =3D freetype.Face(&quot;/home/lele/3rd/repo=
rtlab/src/reportlab/fonts/Vera.ttf&quot;)<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.set_char_size( 48*64 )<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.load_char(&#39;S&#39;)<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.glyph.outline<br>
=C2=A0 =C2=A0 &lt;freetype.Outline object at 0x7fffe99a14d0&gt;<br>
=C2=A0 =C2=A0 &gt;&gt;&gt; face.glyph.outline.decompose<br>
=C2=A0 =C2=A0 Traceback (most recent call last):<br>
=C2=A0 =C2=A0 =C2=A0 File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&=
gt;<br>
=C2=A0 =C2=A0 AttributeError: &#39;Outline&#39; object has no attribute &#3=
9;decompose&#39;<br>
<br>
Sorry for the noise,<br>
bye, lele.<br>
-- <br>
nickname: Lele Gaifax | Dire che Emacs =C3=A8 &quot;conveniente&quot; =C3=
=A8 come<br>
real: Emanuele Gaifas | etichettare l&#39;ossigeno come &quot;utile&quot;<b=
r>
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>=
=C2=A0 =C2=A0 =C2=A0 |=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-- Rens Troost<br>
<br>
_______________________________________________<br>
reportlab-users mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank">r=
[email protected]</a><br>
<a href=3D"https://pairlist2.pair.net/mailman/listinfo/reportlab-users" rel=
=3D"noreferrer" target=3D"_blank">https://pairlist2.pair.net/mailman/listin=
fo/reportlab-users</a><br>
</blockquote></div><br clear=3D"all"><div><br></div><span class=3D"gmail_si=
gnature_prefix">-- </span><br><div dir=3D"ltr" class=3D"gmail_signature"><d=
iv dir=3D"ltr">Andy Robinson<br>Managing Director, ReportLab<br><br></div><=
/div>

--000000000000224e0605fdf02b04--

--===============5409073000237447853==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline