Bug 141216 - libXft uses new fontconfig objects without registering
Summary: libXft uses new fontconfig objects without registering
Status: RESOLVED FIXED
Alias: None
Product: SUSE Linux 10.1
Classification: openSUSE
Component: X.Org (show other bugs)
Version: Alpha 1
Hardware: Other Linux
: P2 - High : Normal (vote)
Target Milestone: ---
Assignee: Stefan Dirsch
QA Contact: Stefan Dirsch
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-03 10:56 UTC by Mike Fabian
Modified: 2006-01-03 19:40 UTC (History)
2 users (show)

See Also:
Found By: Development
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
p_xft_bugzilla_141216.diff (438 bytes, patch)
2006-01-03 13:14 UTC, Mike Fabian
Details | Diff
fontconfig-test.c (1.05 KB, text/plain)
2006-01-03 14:13 UTC, Mike Fabian
Details
fontconfig-test.c (1.04 KB, text/plain)
2006-01-03 14:18 UTC, Mike Fabian
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Fabian 2006-01-03 10:56:00 UTC
libXft uses new fontconfig objects without registering.
Comment 1 Mike Fabian 2006-01-03 13:13:14 UTC
in libXft, xftdpy.c, around line 547:

    if (FcPatternGet (pattern, XFT_MAX_GLYPH_MEMORY, 0, &v) == FcResultNoMatch)
    {
	FcPatternAddInteger (pattern, XFT_MAX_GLYPH_MEMORY,
			     XftDefaultGetInteger (dpy, XFT_MAX_GLYPH_MEMORY,
						   screen,
						   XFT_FONT_MAX_GLYPH_MEMORY));
    }

libXft adds a custom fontconfig object which has not been registered
with fontconfig, i.e. FcNameRegisterObjectTypes has not been called
for this object.

This leads to a crash in rxvt-unicode when starting rxvt-unicode like
this:

    urxvt -fn "fixed,xft:courier"

and then displaying Japanese:

    LC_ALL=ja_JP.UTF-8 date


Comment 2 Mike Fabian 2006-01-03 13:14:14 UTC
Created attachment 61879 [details]
p_xft_bugzilla_141216.diff

Patch to fix the problem.
Comment 3 Mike Fabian 2006-01-03 13:17:12 UTC
patch by Dirk Müller <dmueller@suse.de> and me.

Comment 4 Mike Fabian 2006-01-03 13:23:10 UTC
After fixing the problem with the bitmap fonts mentioned in bug
#137145, urxvt still crashed often, but this fix for libXft finally
seems to avoid all remaining fontconfig related crashes of urxvt.

Comment 5 Mike Fabian 2006-01-03 13:25:31 UTC
Added Jan Blunck <jblunck@suse.de> to CC: because he suffered from
the urxvt crashes. Jan, you can try the xorg-x11 packages from the following
mbuild jobs (for STABLE):

magellan-mfabian-23 xorg-x11: finished - succeeded: 1
magellan-mfabian-24 xorg-x11: finished - succeeded: 1

They should fix the problem for you.
Comment 6 Mike Fabian 2006-01-03 13:26:14 UTC
Reassigning to sndirsch@suse.de to add the patch to our xorg-x11
package.
Comment 7 Mike Fabian 2006-01-03 14:13:58 UTC
Created attachment 61886 [details]
fontconfig-test.c

Test program to demonstrate the problem.
Comment 8 Mike Fabian 2006-01-03 14:15:56 UTC
Compiling and running the test program:

mfabian@magellan:~/c$ make fontconfig-test
gcc -g -O0 -Wall -o fontconfig-test fontconfig-test.c -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/X11R6/include -L/usr/X11R6/lib64 -lXft -lX11 -lfreetype -lfontconfig -L/usr/X11R6/lib64 -lXrender -lX11
fontconfig-test.c: In function ‘main’:
fontconfig-test.c:41: warning: pointer targets in passing argument 1 of ‘FcNameParse’ differ in signedness
fontconfig-test.c:42: warning: pointer targets in assignment differ in signedness
fontconfig-test.c:46: warning: pointer targets in assignment differ in signedness
fontconfig-test.c:38: warning: unused variable ‘p’
mfabian@magellan:~/c$ ./fontconfig-test courier
1: courier
1: courier:maxglyphmemory=1048576:\_\_DUMMY\_\_=1048576
mfabian@magellan:~/c$


Note the weird __DUMMY__ which has been added to the pattern after

    FcPatternAddInteger (pattern, XFT_MAX_GLYPH_MEMORY, 1048576);

Comment 9 Mike Fabian 2006-01-03 14:18:03 UTC
Created attachment 61887 [details]
fontconfig-test.c

"fixed" test program which adds

    { XFT_MAX_GLYPH_MEMORY,	FcTypeInteger, }, 

to _XftObjectTypes[].
Comment 10 Mike Fabian 2006-01-03 14:22:02 UTC
Compiling and running the "fixed" test-program:

mfabian@magellan:~/c$ make fontconfig-test
gcc -g -O0 -Wall -o fontconfig-test fontconfig-test.c -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/X11R6/include -L/usr/X11R6/lib64 -lXft -lX11 -lfreetype -lfontconfig -L/usr/X11R6/lib64 -lXrender -lX11
fontconfig-test.c: In function ‘main’:
fontconfig-test.c:41: warning: pointer targets in passing argument 1 of ‘FcNameParse’ differ in signedness
fontconfig-test.c:42: warning: pointer targets in assignment differ in signedness
fontconfig-test.c:46: warning: pointer targets in assignment differ in signedness
fontconfig-test.c:38: warning: unused variable ‘p’
mfabian@magellan:~/c$ ./fontconfig-test courier
1: courier
1: courier:maxglyphmemory=1048576
mfabian@magellan:~/c$

Comment 11 Mike Fabian 2006-01-03 14:23:14 UTC
The fixed test-program shows that after properly registering the new
fontconfig object the weird __DUMMY__ element is not added
to the pattern anymore.
Comment 12 Dirk Mueller 2006-01-03 18:43:00 UTC
probably this should be committed upstream as an obvious bugfix. 
Comment 13 Stefan Dirsch 2006-01-03 19:35:00 UTC
fixed for STABLE, i.e. 10.1 Beta1.
Comment 14 Stefan Dirsch 2006-01-03 19:40:36 UTC
Reported upstream:

  https://bugs.freedesktop.org/show_bug.cgi?id=5491