PDA

View Full Version : Font differences and how to mitigate



PrimeCP
19th July 2007, 00:56
I have an application that uses the QGraphicsItems, Views, Scene, etc that looks great on my LINUX box, but when I launch the same application via VNC from my windows machine the text drawn using QPainter inside a QGraphicsItem is horrible looking. I attached a file below as an example. The text on the left is via drawText in the graphics item's paint method, the text on the right is text from a popup menu I have on the graphics view. There is a noticeable difference.

What can I do (or what settings can I try) to get the text from drawText(...) more readable? I have tried a bunch of rending hints (blindly choosing which to use) but have not had any success.

INFO:
I have not set any font information via the interface to QGraphicsView.
I set the font to be SanSerif, 12 point size in the paint method of the QGraphicsItem before drawing the text for the image below. I have tried various other fonts, or not setting any font at all, and the result is still ugly looking text.


Thanks

PrimeCP
19th July 2007, 17:59
I have noticed some further differences with fonts. Attached is an image showing some menus right next to each other and another with buttons right next to each other. In both images a Qt3 compiled app is shown on the left (and looks much better) and a Qt4 app is on the right to show the difference.

Maybe its difficult to see, but on my computer the Qt3 text looks much better.

This is using the same scenario as my first post, running both Qt apps simultaneously via VNC from my windows machine.

It's difficult to convince someone that Qt4 is better in many respects when all they see is how ugly the text looks ... hence my problem.

Thanks

marcel
19th July 2007, 18:08
It's difficult to convince someone that Qt4 is better in many respects when all they see is how ugly the text looks ... hence my problem.

Thanks

Hey, be careful what you say about Qt4(especially 4.3)! :)
How does the text look locally( no remote )?
Have you tried with a newer version of the vnc client?
Perhaps there are some settings in there. It looks like you are missing glyph antialiasing.

Regards

marcel
19th July 2007, 18:32
I just tested with kde3.5 in a virtual machine.
If I disable the font antialiasing in Control Center, then I get something similar to you.

Even on your local machine, the fonts are not antialiased.
I assume that this KDE antialiasing does not have any effect on Qt4 applications. I tend to believe this is because of the way freetype for qt4 is initially compiled. It should be compiled with glyph antialising support.

I'll look further and let you know if I find something.

Regards

marcel
19th July 2007, 18:41
Well, looks like font smoothing is enabled by default:


Generating modules list in ./objs/ftmodule.h...
* module: truetype (Windows/Mac font files with extension *.ttf or *.ttc)
* module: type1 (Postscript font files with extension *.pfa or *.pfb)
* module: cff (OpenType fonts with extension *.otf)
* module: cid (Postscript CID-keyed fonts, no known extension)
* module: pfr (PFR/TrueDoc font files with extension *.pfr)
* module: type42 (Type 42 font files with no known extension)
* module: winfnt (Windows bitmap fonts with extension *.fnt or *.fon)
* module: pcf (pcf bitmap fonts)
* module: bdf (bdf bitmap fonts)
* module: sfnt (helper module for TrueType & OpenType formats)
* module: autofit (automatic hinting module)
* module: pshinter (Postscript hinter module)
* module: raster (monochrome bitmap renderer)
* module: smooth (anti-aliased bitmap renderer)
* module: smooth (anti-aliased bitmap renderer for LCDs)
* module: smooth (anti-aliased bitmap renderer for vertical LCDs)
* module: psaux (Postscript Type 1 & Type 2 helper module)
* module: psnames (Postscript & Unicode Glyph name handling)
done.
cd builds/unix; ./configure --help
`configure' configures FreeType 2.2.1 to adapt to many kinds of systems.


Then it must be a problem with KDE font smoothing and Qt4. I actually don't know anything about how that works in KDE, so you should do a little search on the internet.

Regards

PrimeCP
19th July 2007, 19:35
Thanks for the responses, I'll research a little more given your input above.

Just FYI, the text looks great when in local mode (for both qt3 and qt4), it's only in remote mode (using VNC, or Hummingbird) that I see differences between Qt3 and Qt4 text (unfortunately, that is how people are launching the application so I have to figure something out).

marcel
19th July 2007, 19:47
Perhaps you could work a little on your VNC compression scheme.
The VNC server passes small rectangles of the screen( rasters, as the framebuffer modifies ) to the client. To improve client updates, the rasters are compressed using different compression methods.
But these methods are not lossless. A higher compression means faster updates but at a lower detail(not really noticeable in general).

I suggest to look and see if you can adjust the way your server/client handles tiles compression.

Regards

PrimeCP
23rd July 2007, 22:55
One last bit of info, if I don't scale the QGraphicsView, the text looks good. In the picture attached below I show a 1,1 scale compared to the same text scaled larger, and then smaller. So scaling appears to be the major culprit of ugly text.

So as a recap:

Text is ugly when viewing any scaled text via VNC from my Windows machine to LINUX.

Text is fine when viewing from VNC if it is NOT scaled.

Text is fine if app is run via my LINUX (no VNC, or other such tool) box. Scaling has no ill effects on the text.

This is my last post regarding this issue, just wanted to put up this last bit of info to see if anyone has any idea why scaling the QGraphicsView ruins my text (ruins it only when using VNC or any other similar application, I've tried 3 diff. ones).