luma.emulator.device.asciiart: fix compatibility with Pillow ≥ 10 #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This accounts for two interface removals in Pillow 10:
Font size and offset methods.
PIL.ImageFont.ImageFont.getsize
was deprecated in Pillow 3c0b8763abb2 (9.2.0, 2022-07-01) and removed in Pillow b2301d70d104 (10.0.0, 2023-07-01).PIL.ImageFont.ImageFont.getbbox
, available since Pillow c854bf8d1c05 (9.2.0, 2022-07-01), can be used as the basis for a replacement. Note that since Pillow 1e5aa21fa8ad (10.1.0, 2023-10-25),PIL.ImageFont.load_default
may load aPIL.ImageFont.FreeTypeFont
instead ofPIL.ImageFont.ImageFont
, butFreeTypeFont
has supportedgetbbox
for even longer, since Pillow 395aa946a9f1 (8.0.0, 2020-10-04).Constants.
PIL.Image.ANTIALIAS
was deprecated in Pillow ed8073e846dd (9.1.0, 2022-04-01) and removed in Pillow c8ec15980b00 (10.0.0, 2023-07-01).PIL.Image.Resampling.LANCZOS
, available since Pillow f8e4e9c2dd94 (9.1.0, 2022-04-01), is a direct replacement. This was previously addressed forluma.emulator.device.asciiblock
in dae670a8e8a9, butluma.emulator.device.asciiart
was not updated.Because luma.emulator’s
setup.cfg
depends on luma.core>= 2.4.0
, luma.core 2.4.0’ssetup.cfg
expresses its Pillow dependency as>= 9.2.0
, andPIL.ImageFont.ImageFont.getbbox
andPIL.Image.Resampling.LANCZOS
are available in Pillow 9.2.0, there isn’t any need to make affordances for backwards compatibility with older Pillow versions.