[cairo] Cairo vs. Xft glyph rendering

Xan Lopez xan.lopez at gmail.com
Fri Dec 8 04:03:56 PST 2006


Hi,
today I decided to use xtrace[1] to see the differences in the X
server requests between GTK+2.6/Xft and GTK+2.10/Cairo. There's a most
shocking divergence in the RenderCompositeGlyphs8 call:

GTK+2.6:
000:<:03d9:100: RENDERRequest(152): RenderCompositeGlyphs8
op=Over(0x03) src=0x0460002b dst=0x04600089 maskFormat=0x00000036
glyphset=0x04600003 xSrc=0 ySrc=0 glyphcmds={deltax=0 deltay=13
glyphs=0x37,0x4b,0x4c,0x56,0x03,0x4c,0x56,0x03,0x44,0x03,0x53,0x55,0x48,0x57,0x57,0x5c,0x03,0x4f,0x52,0x51,0x4a,0x03,0x56,0x57,0x55,0x4c,0x51,0x4a,0x03,0x5a,0x4c,0x57,0x4b,0x03,0x56,0x52,0x50,0x48,0x03,0x44,0x46,0x46,0x48,0x51,0x57,0x48,0x47,0x03,0x46,0x4b,0x44,0x55,0x56,0x1d,0x03,0x2d,0xb7,0x48,0x03,0xa6,0xa6,0x55,0x48,0x56;
};

GTK+2.10:
000:<:00fc:664: RENDERRequest(152): RenderCompositeGlyphs8
op=Over(0x03) src=0x04600036 dst=0x04600033 maskFormat=0x00000036
glyphset=0x0460002b xSrc=0 ySrc=13 glyphcmds={deltax=0 deltay=13
glyphs=0x37; },{deltax=-1 deltay=2047   glyphs=; },{deltax=-1
deltay=511   glyphs=; },{deltax=0 deltay=19456  glyphset=0x01ffffff
},{deltax=0 deltay=22016  glyphset=0x01000000 },{deltax=0 deltay=19456
  glyphs=; },{deltax=0 deltay=768   glyphs=; },{deltax=0 deltay=256
glyphs=; },{deltax=0 deltay=17408   glyphs=; },{deltax=0 deltay=3072
glyphset=0x53000000 },{deltax=0 deltay=2048   glyphs=; },{deltax=0
deltay=256   glyphs=; },{deltax=0 deltay=18432  glyphset=0x01000000
},{deltax=0 deltay=22272   glyphs=; },{deltax=0 deltay=1280   glyphs=;
},{deltax=0 deltay=256   glyphs=; },{deltax=0 deltay=23552   glyphs=;
},{deltax=0 deltay=2816   glyphs=; },{deltax=-1 deltay=511   glyphs=;
},{deltax=0 deltay=20992   glyphs=; },{deltax=0 deltay=2048   glyphs=;
},{deltax=0 deltay=256   glyphs=; },{deltax=0 deltay=18944
glyphset=0x01000000 },{deltax=0 deltay=22016   glyphs=; },{deltax=0
deltay=1792   glyphs=; },{deltax=0 deltay=256   glyphs=; },{deltax=0
deltay=21760   glyphs=; },{deltax=0 deltay=1280   glyphs=;
},{deltax=-1 deltay=511   glyphs=; },{deltax=0 deltay=20736   glyphs=;
},{deltax=18708 deltay=2048   glyphs=; },{deltax=0 deltay=256
glyphs=; },{deltax=0 deltay=23040   glyphs=; },{deltax=0 deltay=2304
glyphset=0x4c000000 },{deltax=0 deltay=768   glyphs=; },{deltax=0
deltay=256   glyphs=; },{deltax=0 deltay=19200   glyphs=; },{deltax=0
deltay=3072   glyphs=; },{deltax=0 deltay=256   glyphs=; },{deltax=0
deltay=20992   glyphs=; },{deltax=0 deltay=2048   glyphs=; },{deltax=0
deltay=256   glyphs=; },{deltax=0 deltay=18432   glyphs=; },{deltax=0
deltay=3072   glyphs=; },{deltax=0 deltay=256   glyphs=; },{deltax=0
deltay=17920   glyphs=; },{deltax=-11037 deltay=2019
glyphs=0x00,0x00,0x00,0x46,0xcf,0xdf,0xcf,0x01,0x27,0x55,0x27,0x07,0x00,0x00,0x00,0x48,0xa9,0xdb,0xa9,0x01,0x19,0x29,0x19,0x08,0x00,0x00,0x00,0x51,0x6d,0x45,0x6d,0x01,0xe2,0xf2,0xe2,0x08,0x00,0x00,0x00,0x57,0x09,0x28,0x09,0x01,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x48,0x03,0x01,0x03,0x01,0xfd,0xfe,0xfd,0x08,0x00,0x00,0x00,0x47,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x46,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0x07,0x00,0x00,0x00,0x4b,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x44,0x00,0x00,0x00,0x01,0xff,0xff,0xff,0x08;
},{deltax=0 deltay=256   glyphs=; },{deltax=0 deltay=22016   glyphs=;
},{deltax=-1 deltay=2047   glyphs=; },{deltax=0 deltay=256   glyphs=;
},{deltax=0 deltay=11520   glyphs=; },{deltax=-1 deltay=1023
glyphs=; },{deltax=24576 deltay=260   glyphs=; },{deltax=0
deltay=18432   glyphs=; },{deltax=2815 deltay=3072   glyphs=;
},{deltax=-1 deltay=511   glyphs=; },{deltax=0 deltay=-23040
glyphs=; },{deltax=-1 deltay=2303  glyphset=0x55000000 },{deltax=-1
deltay=1279  glyphset=0x48000000 },{deltax=12564 deltay=2048
glyphset=0x56000000 };

The GTK+ 2.6 call, coming from libXft, looks pretty much ok to my
untrained eyes. You can even recognize the glyph codes from each
character in the timetext[2] program. The GTK+ 2.10 call looks like an
abuse of the API :)
If you compare the code from xftrender.c:XftGlyphSpecRender() and
cairo-xlib-surface.c:_cairo_xlib_surface_show_glyph8() it seems that
this the intended behaviour and not a bug. My question is: is this ok?
what is the reason of the divergence?

Cheers, Xan

[1]http://packages.debian.org/unstable/x11/xtrace
[2]http://folks.o-hand.com/jorn/pango-benchmarks/timetext.c


More information about the cairo mailing list