Phil, thanx for your replies. I'll start digging into freetype. Uploaded screenshots to picasa if you're interested: http://picasaweb.google.com/Helbrass/Screenshots?feat=directlink
On 5/17/10, Phil Race <philip.r...@oracle.com> wrote: > On 5/17/2010 5:44 AM, Aekold Helbrass wrote: >> Hi again! >> >> Thanx for you fast and informative responses! >> >> But now I am a bit confused. Roman tells that Freetype does the >> rendering, but there is significant difference between Qt apps and >> Java apps. See screenthos in attachments. >> > > I think you misinterpreted. He's means that freetype produces the glyph > images. > There's no attachment. I think these mailing lists disallow them. > freetype has several knobs, and I don't know if Qt and JDK set them all > the same way. > > >> I found native code that works with freetype and changed glyph loading >> flags to the same as Qt has (i debugged it too), but they became even >> unglier. >> > > That doesn't add up. > >> Phil, why pisces isn't appropriate for B&W or LCD text? Just >> interesting... >> > > its a grey-scale antialiasing rasteriser, not blitting code for already > prepared images > and grey-scale != B&W and grey-scale != LCD. > >> Point me please to right direction - to make Java font rendering >> closer to Qt's should I learn pisces and compare it to Qt's rendering >> or should I debug freetype invocations? >> > > Probably look at the flags passed to freetype in each case. Revisit what > those glyph > loading flags are. > > -phil. > >> Attachments: >> snapshot11 - tiny java app with DejaVu Sans Mono, Plain, 12 size font. >> snapshot12 - the same font of size 10 in KWrite. >> I assume that size (and roundness) difference is because of 72 DPI in >> Java and 96 in KDE, but difference in antialiasing is obvious. >> >> On 5/16/10, Phil Race<philip.r...@oracle.com> wrote: >> >>> Expanding a little on Roman's comments : >>> >>> freetype is a font scaler or rasteriser. eg It takes a TrueType font and >>> returns to >>> its requester a bitmap or greymap image, or a path describing the glyph >>> shape. >>> Its role does not extend to rendering (ie putting the results of >>> rasterisation >>> on a surface). This isn't an "openjdk thing". Its just that's the role >>> of freetype. >>> Yes it also obtains the metrics in most cases. >>> >>> As Roman says there are specialised blitting routines for the text, >>> including >>> OpenGL pixel shader code, if that pipeline is optionally available and >>> enabled. >>> >>> >>> pisces isn't ever going to be the best (notably not the fastest) way to >>> get text >>> on screen and isn't appropriate for B&W or LCD text. >>> >>> -phil. >>> >>> Roman Kennke wrote: >>> >>>> Hello, >>>> >>>> >>>> >>>>> I want to hack into the sources of font rendering of openjdk, and I'm >>>>> a bit confused now. So help me please understand how it works. Links >>>>> are appreciated too. >>>>> >>>>> I read that freetype is used for fonts scaling, but after debugging it >>>>> looks like freetype is used only to get font metrics, while real >>>>> rendering is done using Pisces. I know nothing about real font >>>>> rendering, so I have few questions about it: >>>>> 1. am I right that freetype is used only to get font shapes while all >>>>> rendering and antialiasing is done using Pisces? >>>>> >>>>> >>>> No, not really. The Java2D stack also gets the rendered glyphs from >>>> Freetype as bitmaps. These are displayed by pisces similar to images. >>>> >>>> >>>> >>>>> 2. isn't freetype can be used for font rendering and is used in GTK >>>>> and Qt? Or freetype is only scaler? >>>>> >>>>> >>>> There's the interface FontScaler in the sources (search for it). If you >>>> manage to implement this using GTK or Qt... AFAIK, GTK and Qt use >>>> Freetype themselves, so there wouldn't be any significant improvement. >>>> Plus, the FontScaler interface is quite low level, I guess you'd have a >>>> hard time implementing this using GTK or Qt, which are somwhat >>>> higher-level. >>>> >>>> >>>> >>>>> 3. if freetype can be used for font rendering - why Pisces is used? >>>>> >>>>> >>>> See above. Freetype does the actual rendering (anti-aliasing and such), >>>> Pisces isn't really used, the resulting bitmaps are directly blitted to >>>> the surface. Unless you're fetching the outlines and render them using >>>> draw() or such, in this case freetype doesn't do the rendering. But >>>> that's not the usual case. >>>> >>>> >>>> >>>>> 4th and the most important - how are you guys debugging native code? >>>>> It's not supported with nbprojects, and I can't imagine how to launch >>>>> java with some application to debug some native code... >>>>> >>>>> >>>> I prefer to use gdb. You can launch Java this way: >>>> >>>> java -XX:OnError="gdb - %p" MyApplication >>>> >>>> this jumps into gdb whenever something bad happens. >>>> >>>> Kind regards, Roman