[Qt-interest] How can I use QFontMetrics to measure strings which contains non-ASCII characters?

Willem Liu wliu at infologic.nl
Wed Jan 19 09:46:48 CET 2011


Hi Kermit,

Do you mean that when it's painted on screen that the length of those 
Strings are the same, but the QFontMetrics return different values for 
both of the Strings?
I assume you use the same font with exactly the same font settings for 
both Strings. Then I can only think of one more thing which is highly 
unlikely, but can it be that the font isn't monospaced/non-proportional?

Regards,

Willem Liu
Software Engineer

Please consider the environment before printing this e-mail.


Op 19-1-2011 9:40, Kermit Mei schreef:
>
>
> 2011/1/19 Willem Liu <wliu at infologic.nl <mailto:wliu at infologic.nl>>
>
>     Hi Kermit,
>
>     In what way did you find it inaccurate?
>
>
> Use the same length of string with Chinese characters. But the result 
> is different.
>
>     Have you tried the: QRect QFontMetrics::boundingRect ( const
>     QString & text ) const?
>
> Yes, I have. But it was inaccurate too.
>
>
>     Regards,
>
>     Willem Liu
>     Software Engineer
>
>     Please consider the environment before printing this e-mail.
>
>
> Thanks
> -- 
> B.R
> Kermit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110119/b4ddf984/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wliu.vcf
Type: text/x-vcard
Size: 271 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110119/b4ddf984/attachment.vcf 


More information about the Qt-interest-old mailing list