[comp.windows.x] XTextExtents

pds@quintus (Peter Schachte) (01/05/89)

If one has done the requisite XQueryFont(), and so has the XFontStruct
in the client process, is there EVERY any reason to use
XQueryTextExtents() over XTextExtents()?  Does XQueryTextExtents()
ALWAYS return the same results as XTextExtents()?  I'm looking for any
difference, even obscure.

TIA,
-Peter Schachte
pds@quintus.uucp
..!sun!quintus!pds

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (01/05/89)

XTextExtents should always return the same results as XQueryTextExtents,
and do it much faster.

poser@csli.Stanford.EDU (Bill Poser) (06/07/90)

I am having trouble with XTextExtents in X11R3. I give it a single
character in order to obtain information necessary to center the
character but, but the ascent, descent, lbearing, and rbearing returned
are all zero. Am I doing something wrong, or is there a bug in XTextExtents?

The relevant code fragment is:

   XCharStruct strprops;	/* Extent information */
   int dh;			/* Unused */
   int fa;			/* Unused */
   int fd;			/* Unused */

   extern XFontStruct *fontinfo;

   XTextExtents(fontinfo,w->m_type,1,&dh,&fa,&fd,&strprops);

where w->m_type is the character about which I want information.

						Bill

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (06/08/90)

> I am having trouble with XTextExtents in X11R3.  I give it a single
> character in order to obtain information necessary to center the
> character but, but the ascent, descent, lbearing, and rbearing
> returned are all zero.  Am I doing something wrong, or is there a bug
> in XTextExtents?

>    XTextExtents(fontinfo,w->m_type,1,&dh,&fa,&fd,&strprops);
> where w->m_type is the character about which I want information.

The second argument should be a pointer to character, not the character
itself.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu