Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Look and Chameleon Technology » Font drawing in linux
Font drawing in linux [message #33014] Thu, 30 June 2011 13:10 Go to next message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
Hi,

I am writing an application that shows information on small (44x16 pixel) LED display. The problem is that ttf fonts in NOGTK version of UPP look worse that in GTK. I thought that font rendering is the same in GTK and NOGTK version. Any ideas how to correct font drawing?

Test code:
#include <CtrlLib/CtrlLib.h>
#include <Draw/Draw.h>

using namespace Upp;

GUI_APP_MAIN
{
	Size sz(55,24);
	Font fnt(Font::FindFaceNameIndex("Impact"), 14);
	fnt.NonAntiAliased();
	ImageDraw id(sz);
	id.DrawRect(0, 0, sz.cx, sz.cy, Black());
	id.DrawText(0, -4, "PO LINE1", fnt, White());
	id.DrawText(0, 8, "PO LINE2", fnt, White());
	PNGEncoder png;
	png.SaveFile("FontTest.png", Image(id));
}


index.php?t=getfile&id=3335&private=0
Re: Font drawing in linux [message #33015 is a reply to message #33014] Thu, 30 June 2011 15:06 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Zbych,

Wild guess before someone competent answers: Have you tried using Painter? It generally creates much nicer images than Draw. Also, you might try rendering a bigger image and then scaling it down. Of course, this doesn't answer the question why there is a difference between NOGTK and regular...

Anyway, it sounds like an interesting project Wink

Best regards,
Honza
Re: Font drawing in linux [message #33016 is a reply to message #33015] Thu, 30 June 2011 16:04 Go to previous messageGo to next message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
With painter it looks great. How can I turn off antialiasing?

index.php?t=getfile&id=3336&private=0


Ok. I've found how to turnoff AA. MODE_NOAA must be added to ImagePainter initialization. But IMHO it's a pity that ImagePainter doesn't respect font properties (NonAntiAliased flag) like ImageDraw does.

[Updated on: Thu, 30 June 2011 17:06]

Report message to a moderator

Re: Font drawing in linux [message #33017 is a reply to message #33014] Thu, 30 June 2011 20:17 Go to previous messageGo to next message
mr_ped is currently offline  mr_ped
Messages: 825
Registered: November 2005
Location: Czech Republic - Praha
Experienced Contributor
I think ImageDraw does use OS API to draw fonts whenever possible, which looks to be in both GTK and NOGTK case of your test.

Painter is complete SW renderer from U++, so it is not affected by OS libraries, but on the other hand the level of features supported like using all the info out of font is limited.

With Painter you can anytime jump into the source, and suggest patches to improve it or just bend it for your custom needs. Smile

With classic ImageDraw you can just take it or leave it, the code is inside OS, not U++. (maybe you can patch slightly the way how OS font rendering is called)
Re: Font drawing in linux [message #33029 is a reply to message #33014] Sat, 02 July 2011 11:49 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 14162
Registered: November 2005
Ultimate Member
I have found the problem with NOGTK flag (gtk_hinting should be initialized to -1), now fixed.

Mirek
Re: Font drawing in linux [message #33033 is a reply to message #33029] Sat, 02 July 2011 17:03 Go to previous message
Zbych is currently offline  Zbych
Messages: 327
Registered: July 2009
Senior Member
Thank you.
Previous Topic: Appearance problem in TabCtrl
Next Topic: UPP with Tango look
Goto Forum:
  


Current Time: Sat Dec 14 13:42:09 CET 2024

Total time taken to generate the page: 0.03384 seconds