ImageFont.truetype loads Mongolian Baiti but getbbox raises OSError: invalid reference

Aperta
#10,553 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start by reproducing the failure with the supplied Mongolian Baiti font and ImageFont.truetype(...).getbbox("Hello") using both BASIC and RAQM layout engines. Then trace the FreeType measurement call that raises OSError: invalid reference; the issue does not name a source file or test. Done means text measurement and rendering work for this font, or the failure reports a more specific reason.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Awaiting OP Action Fonts

Description:

I'm encountering an issue with the Mongolian Baiti TrueType font (monbaiti.ttf) distributed with Windows.

Pillow successfully loads the font and retrieves its family name, but attempting to measure even basic Latin text raises OSError: invalid reference.

The font renders correctly in a Chromium-based application on Windows.

Environment:

Pillow: 12.3.0

Font: Mongolian Baiti Regular (monbaiti.ttf)

Layout engines tested: BASIC and RAQM

Minimal reproduction:

from PIL import ImageFont

font = ImageFont.truetype("monbaiti.ttf", 32)
print(font.getname())       # Works
print(font.getbbox("Hello"))  # OSError: invalid reference

Expected behavior:

Pillow should measure and render the text successfully, or provide a more specific error explaining why the font cannot be rendered.

Actual behavior:

OSError: invalid reference is raised during the underlying FreeType measurement operation.

Additional information:

The failure occurs with both BASIC and RAQM layout engines. The font is readable, and it renders successfully through the browser's font-rendering system.

The font file used for this was taken from the windows font directory.

Lingua principale
Python
Stelle
14k
Fork
2.6k
Merge medio
1g 1h
PR unite (30g)
205

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di python-pillow/Pillow

Tutte le issue di python-pillow/Pillow

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.