Skip to main content

[JAVA2D] Antialiased text change 1.3 vs. 1.4.2?

2 replies [Last post]
Anonymous

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Michael Slade

Hi Bira,

Thank you for the document. The font I'm using is a TTF so maybe this
explains some of the differences in the size of the rendering.

But I don't know how that would explain the odd color effects I'm seeing.
The small images are hard to evaluate without zooming in, so here is a
graphic with both images blown up for easier inspection:
http://www.adlibmedia.com/pngs/VideoGraphicBug.png
(this is a screen capture of a blowup, so there is no alpha channel in this
png.)
Again, the lower image should have nothing but shades of gray.

Thank you,
Michael Slade

On 9/8/05 8:16 PM, "Bira Neto" wrote:

> http://java.sun.com/products/jfc/tsc/articles/merlin/2d.html
>
> I would guess it has to do of the fonts not using native rasterizers and
> the TTF hint reading(as read in the article). About your 1.4 sample
> image... it's pretty hard to see blue and green in the image. It looks
> good either.
>
> Michael Slade wrote:
>
>> I had an application running under JDK 1.3 that created antialiased text in
>> a buffer of TYPE_INT_ARGB that was then stored in a png file with an alpha
>> channel - worked great. Here is a fragment of an image that illustrates the
>> quality:
>> http://www.adlibmedia.com/pngs/video_graphicJDK1.3.png
>> (notice white text with black drop shadow, grey antialiase pixels and alpha
>> channel)
>>
>> but under JDK 1.4.2, the font got wider and taller (by about 1 pixel) and
>> some of the antialiased pixels are now brown or blue instead of gray. Here
>> is a fragment of the image that demonstrates the problem:
>> http://www.adlibmedia.com/pngs/video_graphicJDK1.4.2.png
>>
>> Here is a code fragment that prints the shadow or the foreground
>> /*
>> ** This method adds a line of left-justified text to the current
>> ** graphic.
>> */
>> public static void addLeftJustifiedText(String s, Graphics2D g2d, float
>> xPos, float yPos)
>> {
>> // get the font render context and calculate the position
>> FontRenderContext fntCntxt = g2d.getFontRenderContext();
>> Rectangle2D bounds = g2d.getFont().getStringBounds(s, fntCntxt);
>> g2d.drawString(s, xPos, yPos);
>> }
>>
>> I'm scratching my head trying to figure it out. I looked at the archive for
>> this list and didn't see anything. I set every hint I could find. I'm
>> guessing something basic and obvious changed that I'm missing in the
>> documentation.
>>
>> Any suggestions?
>>
>> Thank you,
>> Michael Slade
>>
>> ===========================================================================
>> To unsubscribe, send email to listserv@java.sun.com and include in the body
>> of the message "signoff JAVA2D-INTEREST". For general help, send email to
>> listserv@java.sun.com and include in the body of the message "help".
>>
>>
>>
>>
>

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

nis
Offline
Joined: 2006-02-14
Points: 0

Hi Michael,

could you post simplified testcase to reproduce this problem?

have you tried to reproduce it with jdk5.0 and latest mustang builds?

-igor