Skip to content

getlength output varies for prebuilt vs "build_ext" wheels #6871

@kdumontnu

Description

@kdumontnu

What did you do?

I had been using a pip option to build pillow because there previously weren't prebuilt wheels for some of my (unix) OSes I needed:

pillow; \
       --global-option="build_ext" \
       --global-option="--enable-freetype" \
       --global-option="--disable-zlib" \
       --global-option="--disable-jpeg" \
       --global-option="--disable-tiff" \
       --global-option="--disable-lcms" \
       --global-option="--disable-webp" \
       --global-option="--disable-webpmux" \
       --global-option="--disable-jpeg2000"

This worked well, and I had consistent behavior between operating systems (alpine, windows, MacOS, ubuntu).

However, I've tried moving to the prebuilt wheel, and now I'm seeing slightly different behavior from my text-wrapping built using getlength on ubuntu (tested 22.04 and 20.04)

I assume it's related to a dependency I need to lock, but I'm not sure where to start looking.

What did you expect to happen?

I expected the wrapping to be the same between operating systems and previous builds.

What actually happened?

I'm seeing different length results from getlength, causing differences in behavior between ubuntu vs other OSes and also vs previous "build_ext" versions.

What are your OS, Python and Pillow versions?

  • OS: Ubuntu (22.04 and 20.04)
  • Python: 3.10
  • Pillow: 9.4.0
        # Decode from base64 to binary
        binary = b64decode(MY_FONT_TTF)
        # Load my ttf font by wrapping in BytesIO to make file-like object
        with BytesIO(binary) as myttffontfile:
            self.myfont = ImageFont.truetype(myttffontfile, size=50000)

       self.myfont.getlength(test_softline)  # This has different results on Ubuntu now

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions