-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Labels
Description
What did you do?
Tried to call ImageDraw.text((15, 36), "A B") with the following font:
FS Lola Medium Regular.zip
What did you expect to happen?
Either a successful call, since that font is rendered correctly on browsers and as a system font, or the usage of one of the 'unidentified characters' (□, �).
What actually happened?
Because of the whitespace, the call fails with a OSError: Bitmap missing for glyph exception on PIL/ImageFont.py:607. I'm not exactly sure if there's any actual error with the font file, but as mentioned, it works fine on browsers and as a system font.
What are your OS, Python and Pillow versions?
- OS: MacOS 13.3.1, Ubuntu 20.04
- Python: 3.8
- Pillow: 10.4
--------------------------------------------------------------------
Pillow 10.4.0
Python 3.8.18 (default, Nov 2 2023, 16:50:59)
[Clang 14.0.3 (clang-1403.0.22.14.1)]
--------------------------------------------------------------------
Python executable is /Users/joaohaas/dev/server/env/bin/python3
Environment Python files loaded from /Users/joaohaas/dev/server/env
System Python files loaded from /opt/homebrew/Cellar/[email protected]/3.8.18_1/Frameworks/Python.framework/Versions/3.8
--------------------------------------------------------------------
Python Pillow modules loaded from /Users/joaohaas/dev/server/env/lib/python3.8/site-packages/PIL
Binary Pillow modules loaded from /Users/joaohaas/dev/server/env/lib/python3.8/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.4.0
--- TKINTER support ok, loaded 8.6
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.3
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.14, harfbuzz 8.5.0
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------
from PIL import Image, ImageDraw, ImageFont
font = ImageFont.truetype("<path>/FS Lola Medium Regular.ttf", size=27)
image = Image.new("RGB", (440, 58), (255, 255, 255))
draw_object = ImageDraw.Draw(image)
draw_object.text((15, 36), "A B", font=font)