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

Abierto
#10,553 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
14k
Forks
2.6k
Merge medio
1 d 1 h
PR fusionados (30 d)
205

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de python-pillow/Pillow

Todos los issues de python-pillow/Pillow

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.