[reportlab-users] Problem using drawToFile() using PyCairo backend

Lele Gaifax lele at metapensiero.it
Mon Jun 12 09:27:18 EDT 2023


Lele Gaifax <lele at metapensiero.it> 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 = 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 = 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 è "conveniente" è come
real: Emanuele Gaifas | etichettare l'ossigeno come "utile"
lele at etour.tn.it      |                           -- Rens Troost



More information about the reportlab-users mailing list