Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2012-03

TCanvas.TextRect, subpixel antialiasing with Qt4

3 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bernd

I'm currently experimenting with the IDE compiled for the Qt widgetset and also with an application that will use the TIpHtmlPanel for displaying some text and there is a strange discrepancy between the text rendering on GTK2 and on Qt4.

It becomes obvious if you compare the two hint windows in the two screenshots below, one is the IDE compiled with Qt and the other with GTK2. The hint window is using the turbopower_ipro html component, the same that I want to use in my own application. It is calling TCanvas.TextRect() to render the text to the canvas and this has different results depending on the currently used widgetset.

http://img6.imagebanana.com/img/75epg1ll/TextRect_gtk2.png http://img7.imagebanana.com/img/hawlfm0z/TextRect_qt4.png

The strange thing about this is that as you can see from the screenshots the entire IDE, the entire widgetset is using the same font rendering settings, buttons, menus, labels etc are respecting my font settings: hintfull and subpixel RGB anti-aliasing. Everything is looking beautiful, except the text that is rendered via TextRect() in the hint window. In the second screenshot look at the "/", "A", "x", "()" characters in the hint window, they are quite ugly compared to the GTK example and this looks exactly like subpixel-antialiasing is turned off.

Is this a bug in TCanvas or is this the wrong usage in the IpHtml component? Can anybody reproduce this effect?

Note that I am not using KDE, I am using Xubuntu and have used qtconfig-qt4 to set the Qt4 theme and I have a ~/.fonts.conf file that has the same hinting- and antialiasing-settings defined (just in case some application does not understand the GTK settings). Maybe there are even more different places where I can set these settings?

Bernd

Reply by email

Bernd
to Bernd

I made some more experiments with this. This screenshot shows TextOut() on the canvas of the Form and on the canvas of a TImage.Picture.Bitmap.

The canvas of the form seems to have subpixel aliasing (cleartype) always activated by default, the canvas of the bitmap has it deactivated. The settings of the font are ignored. How can I make the font rendering in the TImage look exactly the same as the fonts on the TForm? What is does the TForm.Canvas have that the TBitmap.Canvas is missing?

Bernd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qt4-font-rendering.png
Type: image/png
Size: 9416 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120325/f9a708c2/attachment-0002.png> -------------- next part --------------
A non-text attachment was scrubbed...
Name: qt4-font-rendering-zoom.png
Type: image/png
Size: 2408 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120325/f9a708c2/attachment-0003.png>

Reply by email