[Qt-interest] How can I use QFontMetrics to measure strings which contains non-ASCII characters?
Willem Liu
wliu at infologic.nl
Wed Jan 19 08:57:04 CET 2011
Hi Kermit,
In what way did you find it inaccurate?
Have you tried the: QRect QFontMetrics::boundingRect ( const QString &
text ) const?
Regards,
Willem Liu
Software Engineer
Please consider the environment before printing this e-mail.
Op 19-1-2011 2:27, Kermit Mei schreef:
> Hello community!
>
> My program is asked to support several language such as English,
> Chinese and so on.
> I must measure some widget by its plainText. These text may consist of
> different languages' characters.
> Now, I use the code like this to measure:
>
> QFont font;
> ... ... //set the font
> QFontMetrics fm(font);
> m_width = fm.width(plainText);
>
> But I found that the result is not accurate. Is there any way to
> resolve it?
>
> Thanks
> --
> B.R
> Kermit
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110119/02157efe/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/02157efe/attachment.vcf
More information about the Qt-interest-old
mailing list