Skip to content

[Bug]: PDF Type 42 output regression in 3.11: excessive font embedding and fl rendered as a ligature #31955

Description

@smirnovhub

Bug summary

After upgrading from Matplotlib 3.9.4 to 3.11.0, PDF files generated with the default
DejaVu Sans font and pdf.fonttype = 42 became significantly larger.

Additionally, words containing the character sequence fl (for example, Ecoflow)
are rendered with a ligature, while this did not happen with Matplotlib 3.9.x.

The same code, data, and font are used in both versions.

Expected behavior

  • PDF size should remain similar to Matplotlib 3.9.4.
  • The text Ecoflow should be rendered as separate f and l glyphs.
  • Only the required font subset should be embedded.

Actual behavior

With Matplotlib 3.11.0:

  • PDF size increases.
  • The sequence fl is rendered as a ligature.
  • The issue only occurs when using pdf.fonttype = 42.

Working configuration:

  • Python: 3.9.13
  • Matplotlib: 3.9.4

Affected configuration:

  • Python: 3.14.6
  • Matplotlib: 3.11.0

Code for reproduction

import matplotlib
from matplotlib.figure import Figure

matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['pdf.compression'] = 9

fig = Figure()
ax = fig.subplots()

ax.set_title("Ecoflow")

fig.savefig("ligature-bug.pdf")

Actual outcome

Image

Expected outcome

Image

Additional information

No response

Operating system

Debian

Matplotlib Version

3.11.0

Matplotlib Backend

agg

Python version

Python 3.14.6

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions