Font metrics and kerning

Russell Shaw rjshaw at netspace.net.au
Mon Sep 26 09:00:48 PDT 2005


Hi,
How do X toolkits do accurate pos(x,y) to character string
hit testing in text widgets?

Looking thru Xaw code, it looks like only XCharStruct is
used:

typedef struct {
             short lbearing;          /* origin to left edge of raster */
             short rbearing;          /* origin to right edge of raster */
             short width;             /* advance to next char's origin */
             short ascent;            /* baseline to top edge of raster */
             short descent;           /* baseline to bottom edge of raster */
             unsigned short attributes;/* per char flags (not predefined) */
} XCharStruct;


But this does not have kerning information to allow you to
calculate accurate text widths. Does X core fonts even do
kerning at all?



More information about the xorg mailing list