PIL font renderer cuts off descender of some TrueType fonts

Bug #677208 reported by Damian Yerrick
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-imaging (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: python-imaging

#!/usr/bin/env python
"""Demonstrate a bug in Python Imaging Library.

Summary: PIL font renderer cuts off descender of some TrueType fonts

The FreeType font loader in the _imagingft component of
python-imaging does not always render the entire glyph.

Steps to reproduce:
1. Download FinkHeavy.ttf from
   http://www.angelfire.com/stars5/tkcpics2/wildworld/#downloads
2. Copy it to the .fonts folder in your home folder.
3. Run this Python program.

Expected result:
The bottom of the 'g' is round, as it appears in other programs.

Actual result:
The bottom of the 'g' is flat; the bottom has been cut off.

Unlike python-imaging, SDL_ttf does not have this problem.

"""
from PIL import Image, ImageDraw, ImageFont
import os

fontname = os.path.expanduser('~/.fonts/FinkHeavy.ttf')
im = Image.new('L', (256, 256))
dc = ImageDraw.Draw(im)
fh = ImageFont.truetype(fontname, 64)
dc.text((62, 64), "Hg", 254, fh)
im.show()

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: python-imaging 1.1.7-2
ProcVersionSignature: Ubuntu 2.6.35-22.35-generic 2.6.35.4
Uname: Linux 2.6.35-22-generic i686
NonfreeKernelModules: wl
Architecture: i386
Date: Thu Nov 18 16:41:17 2010
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release i386 (20091028.5)
ProcEnviron:
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: python-imaging

Revision history for this message
Damian Yerrick (tepples) wrote :
Revision history for this message
Damian Yerrick (tepples) wrote :

#!/usr/bin/env python
"""
I've also caught it chopping off ascenders and the first glyph in a line.
"""
from PIL import Image, ImageDraw, ImageFont
import os
fontname = os.path.expanduser('~/.fonts/FinkHeavy.ttf')
im = Image.new('L', (256, 256))
fh = ImageFont.truetype(fontname, 64)
ImageDraw.Draw(im).text((62, 64), "jq{", 254, fh)
im.show()

Revision history for this message
Damian Yerrick (tepples) wrote :

Problem still occurs on 11.10

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-imaging (Ubuntu):
status: New → Confirmed
Revision history for this message
Damian Yerrick (tepples) wrote :

The problem does not occur in the successor package 'python3-pil' under Ubuntu 18.04. I guess it can be closed as Won't Fix once we no longer support Python 2.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.