After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753167 - Pango script crashes
Pango script crashes
Status: RESOLVED FIXED
Product: pango
Classification: Platform
Component: general
1.37.x
Other Linux
: Normal normal
: ---
Assigned To: pango-maint
pango-maint
Depends on:
Blocks:
 
 
Reported: 2015-08-03 06:33 UTC by Carl Banks
Modified: 2015-08-18 14:57 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Carl Banks 2015-08-03 06:33:00 UTC
The following script crashes for me:

--
from gi.repository import PangoFT2, Pango
fontmap = PangoFT2.FontMap()
fontmap.set_resolution(96.0,96.0)
context = fontmap.create_context()
font_description = Pango.FontDescription.from_string("DejaVuSans 20")
layout = Pango.Layout(context)
layout.set_width(-1)
layout.set_text("hello",-1)
layout.set_font_description(font_description)
print(layout.get_size())
--

It aborts the program without raising an exception or printing a stack trace.  Output is this:

--
(process:4469): Pango-ERROR **: Unable to open font file /usr/share/fonts/truetype/dejavu/DejaVuSans.ttf for font DejaVu Sans 20, exiting

Trace/breakpoint trap
--

The font it claims not to be able to open exists on my system, and is readable by the user. Other apps can access the font just fine, including one that uses basically the same code written in C.  This error occurs for all fonts I've tried.
Comment 1 Christoph Reiter (lazka) 2015-08-03 07:22:37 UTC
Use PangoFT2.FontMap.new() instead of PangoFT2.FontMap().

I guess the difference is that pango_ft2_font_map_new() calls FT_Init_FreeType() while pango_ft2_font_map_init() doesn't.

Moving this to pango.
Comment 2 Behdad Esfahbod 2015-08-18 14:57:49 UTC
Fixed.  Thanks.