[QScintilla] wrong cursor moving
Petr Vanek
petr at scribus.info
Mon Nov 8 11:01:44 GMT 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Nov 8, 2010 (Monday), at 12:33 AM, David Hess wrote:
> On Nov 6, 2010, at 8:50 AM, Petr Vaněk wrote:
>
>> ... snip ...
>>>> changes if you highlight it via selection.
>>>>
>>>> So it seems not to just be a cursor positioning issue but also a layout
>>>> problem.
>>> Out of curiosity, if the patch did...
>>>
>>> qRound(ceil(width));
>>>
>>> ...is it any better?
>>
>> for me it seems little bit worse with the ceil(). But maybe it's only due my
>> tired eyes.
>>
>> Anyway, I can confirm the selection display is somehow wrong - with or without
>> the patch as well.
>>
>>> Even if the patch isn't exactly correct, is it a definite improvement?
>>
>> for me it makes qsci finally usable on mac - at least the cursor is in the
>> right place.
>
> It may be the colorizing making the difference for me, but it still seems pretty bad overall. A long line with colorized text will still put the cursor in the wrong place.
I think it's not a "colorized" but "font weight/bold" problem.
>
> Poking around inside of Scintilla shows that it uses integer pixel positions which I guess your patch is attempting to deal with?
>
> I did some searching in the Qt bug database and saw this ticket: http://bugreports.qt.nokia.com/browse/QTBUG-11234
>
> It seems that adding:
>
> f->setStyleStrategy(QFont::ForceIntegerMetrics);
>
> to Font::Create(...) is worth a try?
>
> I'm working with 4.6.2 which doesn't have QFont::ForceIntegerMetrics. Petr are you working with > 4.6.2 and if so can you try that?
I have 4.7 here. Testing with this patch for PlatQt.cpp:
- --- PlatQt.cpp 2010-11-08 11:56:59.000000000 +0100
+++ PlatQt.cpp.orig 2010-08-31 09:49:37.000000000 +0200
@@ -122,13 +122,6 @@
Release();
QFont *f = new QFont();
- -#ifdef Q_WS_MAC
- -#if QT_VERSION >= 0x040700
- - f->setStyleStrategy(QFont::ForceIntegerMetrics);
- -#else
- -#warning "Correct handling of the QFont metrics requited Qt>=4.7"
- -#endif
- -#endif
// If name of the font begins with a '-', assume, that it is an XLFD.
if (faceName[0] == '-')
- ---
and it seems it works. Well, the cursor is still 1-2px shifted into the glyph itself (comparing linux) but the gap/shift is constant.
And of course - I'm not sure if I applu the setStyleStrategy in the right place... but as I said it seems to work - including selections in the colorized/bold texts.
p.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)
iQEcBAEBAgAGBQJM19iYAAoJEC8yRjM4uE2ttu4H/A84NxHa3pwHOpGfokYioEUs
PkPLxS16OpUvq656t5xl9aNpd5zgpCMDrm01Jo4wNdYI9K1xEpkLCfCsebso5UOE
vbKwg5Spr7VeiyuKD4v/7SMHq2YJmpSdi0Ibli5+PeiSy7FeZlO4qX+R0DLDX2i1
KmafM+3xhZLq3wwdKygGASp0IYQKNeKVWvlO8Lg1et2CtrUmXzi9RenJ62VN0aXL
+Jb0ryz6TWMcfLHyq9EZ5LW2jqAwFmgbghaxfN4PYnlppXq+alVCVGSPpWM1AWKN
mrwMzYWtEyDKyp1coT2TaqGbJlXWrCDeDF+gKjGkgjc/5xydqNzq7tKABLDkG0A=
=TcO5
-----END PGP SIGNATURE-----
More information about the QScintilla
mailing list