Bug 51950

Summary: Pycairo renders no chess figurines using some truetype chess fonts
Product: pycairo Reporter: Bajusz Tamás <gbtami>
Component: generalAssignee: Steve Chaplin <d74n5pohf9>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Bajusz Tamás 2012-07-10 14:40:30 UTC
There is an example code using freetype in cairo cookbook we are using in PyChess to render different chess figurines from truetype chess font files.
(http://cairographics.org/freetypepython/)

It worked ok with older cairo/pycairo versions, but newer cairo versions
(1.12.x) fails to render some of them (not all!). No error message, just empty draws.

One example .ttf is here:
http://code.google.com/p/pychess/source/browse/pieces/ttf/harlequin.ttf

The demonstrating code using this .ttf is here:
http://code.google.com/p/pychess/source/browse/lib/pychess/System/cairoextras.py

Original pychess bugreport with screenshot:
http://code.google.com/p/pychess/issues/detail?id=708
Comment 1 Steve Chaplin 2012-08-04 04:50:52 UTC
This looks like a ctypes usage problem and not a pycairo bug.

The ctypes code uses the pycairo, cairo and freetype application binary interfaces. The pycairo ABI sometimes changes when a new version of pycairo is released. If you examine the ctypes code you will probably find something that worked with an old version of pycairo which is now incorrect for the current pycairo version.

If you check through the ctypes code and reduce the problem to a pure pycairo test case which shows the bug, I'll be happy to look at it.
Comment 2 Bajusz Tamás 2012-08-04 11:12:45 UTC
(In reply to comment #1)
> This looks like a ctypes usage problem and not a pycairo bug.
> 
> The ctypes code uses the pycairo, cairo and freetype application binary
> interfaces. The pycairo ABI sometimes changes when a new version of pycairo is
> released. If you examine the ctypes code you will probably find something that
> worked with an old version of pycairo which is now incorrect for the current
> pycairo version.
> 
> If you check through the ctypes code and reduce the problem to a pure pycairo
> test case which shows the bug, I'll be happy to look at it.

As I described before, it works OK with some other .ttf piece sets. I think the bug related to https://bugs.freedesktop.org/show_bug.cgi?id=50688. I opened the harlequine.ttf with fontforge in Debian Sid, and checked in Has Vertical Metrics checkbox, then generated a new .ttf. And it worked!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.