Sign in Join

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

Mailing lists / lazarus / 2012-03

TCanvas, Qt, device context, TextOut(), anti-aliasing

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Bernd Kreuss

Hello widgetset and Qt experts, I need some explanations to better understand what is going on. I recently posted a thread "TCanvas.TextRect, subpixel antialiasing with Qt4" that also included a small demo application and screenshots to demonstrate my problem.

I have tried to step through the LCL and widgetset code to see what is actually going on, the problem is when outputting text to some offscreen TCanvas, like for example the TCanvas of the bitmap of a TImage then it will use different text anti-aliasing settings than when doing the same for the TCanvas of the form during the paint event. I have observed this with Qt on Linux.

When painting to the canvas of the form during paint it will respect the subpixel antialiasing settings from my .fonts.conf file and text will be subpixel-antialiased but when outputting text to the canvas of a bitmap it will only use "normal" antialiasing (which looks quite ugly and inconsistent when you see such text appearing right next to the other properly antialiased text in the same application).

I have tried to step through it and it seems it will ask Qt to create a bitmap(?) and a device context for the bitmap and then use Qt to paint on this bitmap and I tried to patch some of the Qt units trying to change font settings and dc settings and renderhints immediately before QPainter_drawText() is called but nothing has the desired effect but I also did not see any obvious flags or constants whose names would suggest that they have anything to do with it.

What is going on here and is it even *possible* to solve this problem? The main reason for me is to use the html panel from turbopower_ipro which seems to be rendering its content to such an offscreen canvas and is producing really really ugly font rendering compared to the rest of the application.

The problem does *not* occur with GTK2. I have not tried Windows yet.

Bernd

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x3945A21D.asc
Type: application/pgp-keys
Size: 16637 bytes
Desc: not available
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120331/88e76669/attachment-0001.bin>

Reply by email

zeljko
to Bernd Kreuss
Bernd Kreuss wrote 34 lines
Hello widgetset and Qt experts, I need some explanations to better understand what is going on. I recently posted a thread "TCanvas.TextRect, subpixel antialiasing with Qt4" that also included a small demo application and screenshots to demonstrate my problem. I have tried to step through the LCL and widgetset code to see what is actually going on, the problem is when outputting text to some offscreen TCanvas, like for example the TCanvas of the bitmap of a TImage then it will use different text anti-aliasing settings than when doing the same for the TCanvas of the form during the paint event. I have observed this with Qt on Linux. When painting to the canvas of the form during paint it will respect the subpixel antialiasing settings from my .fonts.conf file and text will be subpixel-antialiased but when outputting text to the canvas of a bitmap it will only use "normal" antialiasing (which looks quite ugly and inconsistent when you see such text appearing right next to the other properly antialiased text in the same application). I have tried to step through it and it seems it will ask Qt to create a bitmap(?) and a device context for the bitmap and then use Qt to paint on this bitmap and I tried to patch some of the Qt units trying to change font settings and dc settings and renderhints immediately before QPainter_drawText() is called but nothing has the desired effect but I also did not see any obvious flags or constants whose names would suggest that they have anything to do with it. What is going on here and is it even *possible* to solve this problem? The main reason for me is to use the html panel from turbopower_ipro which seems to be rendering its content to such an offscreen canvas and is producing really really ugly font rendering compared to the rest of the application. The problem does *not* occur with GTK2. I have not tried Windows yet.

No idea, maybe best would be to open an issue about it and attach good example, so I can take a look into.

zeljko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20120401/72f84b6f/attachment-0001.html>

Reply by email