[prev in list] [next in list] [prev in thread] [next in thread]
List: freedesktop-xorg
Subject: Re: [DEVEL] XftTextExtents8 function and spaces characters
From: Lucien Gentis <lucien.gentis () univ-lorraine ! fr>
Date: 2019-04-24 9:16:17
Message-ID: 3210db66-c596-d63e-31cb-392ec363a615 () univ-lorraine ! fr
[Download RAW message or body]
Hi,
Thanks for your answer.
As I have to know exact width of the string, I found that solution :
For every font I use, I calculate the width of a space.
And every time I use XftTextExtents8, I test if the last character of
the string is a space or not.
If it's a space, I add the width of the space to the width of the string.
Cheers,
Lucien
Le 24/04/2019 à 09:19, walter harms a écrit :
> 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@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
> _______________________________________________
> xorg@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
_______________________________________________
xorg@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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic