Abdelrazak Younes wrote:
Abdelrazak Younes wrote:
In this patch I use simple casts instead of the costly ucs2_to_ucs4 and ucs4_to_ucs2 functions. It turned out that all display issues are resolved... including math! It even brings a very nice speed-up...

Here is a cleaned up version of the patch.

[...]
        // Qt rbearing is from the right edge of the char's width().
-        unsigned short sc = ucs4_to_ucs2(c);
+       QChar sc(static_cast<uint>(c));
        return m.width(sc) - m.rightBearing(sc);

Ah! I forgot that one, I will update the patch with:

        // Qt rbearing is from the right edge of the char's width().
-       unsigned short sc = ucs4_to_ucs2(c);
-       return m.width(sc) - m.rightBearing(sc);
+       return m.width(ucs4_to_qchar(c)) - m.rightBearing(sc);


Abdel.

Reply via email to