Skip to content

Commit 0483a3d

Browse files
committed
Deprecate setting text kerning factor to any non-0 value
This factor existed only to preserve test images, but as of matplotlib#29816, it is set to 0 (i.e., disabled and providing default behaviour). In the future, with libraqm, it will have no effect no matter its setting (because we won't be applying kerning ourselves at all.)
1 parent fe89bea commit 0483a3d

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Font kerning factor is deprecated
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
Due to internal changes to support complex text rendering, the kerning factor on fonts is
5+
no longer used. Setting the ``text.kerning_factor`` rcParam (which existed only for
6+
backwards-compatibility) to any value other than 0 is deprecated, and the rcParam will be
7+
removed in the future.

src/ft2font_wrapper.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,6 @@ const char *PyFT2Font_init__doc__ = R"""(
432432
.. warning::
433433
This API is both private and provisional: do not use it directly.
434434
435-
_kerning_factor : int, optional
436-
Used to adjust the degree of kerning.
437-
438-
.. warning::
439-
This API is private: do not use it directly.
440-
441435
_warn_if_used : bool, optional
442436
Used to trigger missing glyph warnings.
443437
@@ -453,6 +447,11 @@ PyFT2Font_init(py::object filename, long hinting_factor = 8,
453447
if (hinting_factor <= 0) {
454448
throw py::value_error("hinting_factor must be greater than 0");
455449
}
450+
if (kerning_factor != 0) {
451+
auto api = py::module_::import("matplotlib._api");
452+
auto warn = api.attr("warn_deprecated");
453+
warn("since"_a="3.11", "name"_a="_kerning_factor", "obj_type"_a="parameter");
454+
}
456455

457456
PyFT2Font *self = new PyFT2Font();
458457
self->x = nullptr;

0 commit comments

Comments
 (0)