[DEVEL] XftTextExtents8 function and spaces characters

walter harms wharms at bfs.de
Wed Apr 24 07:19:54 UTC 2019


Hi,
i did not see an answer so i will try:

The docu says: "XftTextExtents8 computes the pixel extents of "string" when drawn with "font". "
IMHO:
the point here is: "pixel extents" i read "find the last pixel"
white space has no pixel so it should be ignored.
In that logic leading spaces get not ignored because they cause an offset.

You expected "string width" what is obviously not the same-

re,
 wh

Am 13.04.2019 16:21, schrieb Lucien Gentis:
> Hello,
> 
> I use  XftTextExtents8 (display,font,(FcChar8
> *)str,strlen(str),&glyphInfo); instruction to compute width of string str
> 
> Here are values of glyphInfo.width with following strings:
> 
> String                glyphInfo.width
> -------------------------------------
> "e"                    9
> " e" (leading space)   13
> "e " (trailing space)  9
> "e e"                  22
> 
> So it seems thattrailing spaces are not taken into account to compute
> string width.
> 
> is it a bug ?
> 
> 
> 
> 
> _______________________________________________
> xorg at lists.x.org: X.Org support
> Archives: http://lists.freedesktop.org/archives/xorg
> Info: https://lists.x.org/mailman/listinfo/xorg
> Your subscription address: %(user_address)s


More information about the xorg mailing list