mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-14 19:36:38 +03:00
Deprecate FreeType 2.7, to be removed in Pillow 9 (2022-01-02)
This commit is contained in:
parent
ff40eaa961
commit
27bf17009c
|
@ -998,3 +998,15 @@ def test_render_mono_size():
|
||||||
|
|
||||||
draw.text((10, 10), "r" * 10, "black", ttf)
|
draw.text((10, 10), "r" * 10, "black", ttf)
|
||||||
assert_image_equal_tofile(im, "Tests/images/text_mono.gif")
|
assert_image_equal_tofile(im, "Tests/images/text_mono.gif")
|
||||||
|
|
||||||
|
|
||||||
|
def test_freetype_deprecation(monkeypatch):
|
||||||
|
# Arrange: mock features.version_module to return fake FreeType version
|
||||||
|
def fake_version_module(module):
|
||||||
|
return "2.7"
|
||||||
|
|
||||||
|
monkeypatch.setattr(features, "version_module", fake_version_module)
|
||||||
|
|
||||||
|
# Act / Assert
|
||||||
|
with pytest.warns(DeprecationWarning):
|
||||||
|
ImageFont.truetype(FONT_PATH, FONT_SIZE)
|
||||||
|
|
|
@ -12,6 +12,20 @@ Deprecated features
|
||||||
Below are features which are considered deprecated. Where appropriate,
|
Below are features which are considered deprecated. Where appropriate,
|
||||||
a ``DeprecationWarning`` is issued.
|
a ``DeprecationWarning`` is issued.
|
||||||
|
|
||||||
|
FreeType 2.7
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. deprecated:: 8.1.0
|
||||||
|
|
||||||
|
Support for FreeType 2.7 is deprecated and will be removed in Pillow 9.0.0 (2022-01-02),
|
||||||
|
when FreeType 2.8 will be the minimum supported.
|
||||||
|
|
||||||
|
We recommend upgrading to at least FreeType `2.10.4`_, which fixed a severe
|
||||||
|
vulnerability introduced in FreeType 2.6 (CVE-2020-15999_).
|
||||||
|
|
||||||
|
.. _2.10.4: https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/
|
||||||
|
.. _CVE-2020-15999: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15999
|
||||||
|
|
||||||
Image.show command parameter
|
Image.show command parameter
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
45
docs/releasenotes/8.1.0.rst
Normal file
45
docs/releasenotes/8.1.0.rst
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
8.1.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
Deprecations
|
||||||
|
============
|
||||||
|
|
||||||
|
FreeType 2.7
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
|
Support for FreeType 2.7 is deprecated and will be removed in Pillow 9.0.0 (2022-01-02),
|
||||||
|
when FreeType 2.8 will be the minimum supported.
|
||||||
|
|
||||||
|
We recommend upgrading to at least FreeType `2.10.4`_, which fixed a severe
|
||||||
|
vulnerability introduced in FreeType 2.6 (:cve:`CVE-2020-15999`).
|
||||||
|
|
||||||
|
.. _2.10.4: https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/
|
||||||
|
|
||||||
|
API Changes
|
||||||
|
===========
|
||||||
|
|
||||||
|
TODO
|
||||||
|
^^^^
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
API Additions
|
||||||
|
=============
|
||||||
|
|
||||||
|
TODO
|
||||||
|
^^^^
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
Security
|
||||||
|
========
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
||||||
|
Other Changes
|
||||||
|
=============
|
||||||
|
|
||||||
|
TODO
|
||||||
|
^^^^
|
||||||
|
|
||||||
|
TODO
|
|
@ -13,6 +13,7 @@ expected to be backported to earlier versions.
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
8.1.0
|
||||||
8.0.1
|
8.0.1
|
||||||
8.0.0
|
8.0.0
|
||||||
7.2.0
|
7.2.0
|
||||||
|
|
|
@ -28,9 +28,12 @@
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import warnings
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from . import Image
|
from packaging.version import parse as parse_version
|
||||||
|
|
||||||
|
from . import Image, features
|
||||||
from ._util import isDirectory, isPath
|
from ._util import isDirectory, isPath
|
||||||
|
|
||||||
LAYOUT_BASIC = 0
|
LAYOUT_BASIC = 0
|
||||||
|
@ -164,6 +167,15 @@ class FreeTypeFont:
|
||||||
self.index = index
|
self.index = index
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
|
|
||||||
|
freetype_version = parse_version(features.version_module("freetype2"))
|
||||||
|
if freetype_version < parse_version("2.8"):
|
||||||
|
warnings.warn(
|
||||||
|
"Support for FreeType 2.7 is deprecated and will be removed in Pillow "
|
||||||
|
"9 (2022-01-02). Please upgrade to FreeType 2.8 or newer, preferably "
|
||||||
|
"FreeType 2.10.4 which fixes CVE-2020-15999.",
|
||||||
|
DeprecationWarning,
|
||||||
|
)
|
||||||
|
|
||||||
if layout_engine not in (LAYOUT_BASIC, LAYOUT_RAQM):
|
if layout_engine not in (LAYOUT_BASIC, LAYOUT_RAQM):
|
||||||
layout_engine = LAYOUT_BASIC
|
layout_engine = LAYOUT_BASIC
|
||||||
if core.HAVE_RAQM:
|
if core.HAVE_RAQM:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user