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

オープン
#10,553 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Python
スター
14k
フォーク
2.6k
平均マージ
1日 1時間
マージ済み PR(30日)
205

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

python-pillow/Pillow のほかの issue

python-pillow/Pillow の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。