Skip to content

Conversation

radarhere
Copy link
Member

A few ImageFont._load_pilfont_data() suggestions.

  1. Remove an unnecessary split()
    file.readline().split(b";")
  2. Check image mode before reading from file, to return the error faster.
  3. Rather than potentially reading an entire line,
    if file.readline() != b"PILfont\n":

    we can limit the length of the read operation by just using read(8).

@hugovk hugovk merged commit 5a5c51c into python-pillow:main Oct 4, 2025
51 checks passed
@radarhere radarhere deleted the pilfont branch October 4, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants