Bug 331 - Floating-point precision needed in TextRenderer
Summary: Floating-point precision needed in TextRenderer
Status: RESOLVED WONTFIX
Alias: None
Product: Jogl
Classification: JogAmp
Component: awt (show other bugs)
Version: 1
Hardware: All all
: P5 normal
Assignee: Sven Gothel
URL:
Depends on:
Blocks:
 
Reported: 2007-10-29 02:47 CET by Sven Gothel
Modified: 2012-01-23 00:09 CET (History)
0 users

See Also:
Type: DEFECT
SCM Refs:
Workaround: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Gothel 2010-03-24 07:51:01 CET


---- Reported by kbr 2007-10-29 14:47:49 ----

Patrick Murris from the NASA World Wind Java project has pointed out that for
high-quality rendering of text it is necessary to use floating-point precision
rather than integer precision. The Rectangle2D from getBounds() needs to not be
rounded to an integer size, and draw() needs an overloading taking a
floating-point x and y.



---- Additional Comments From kbr 2007-11-08 18:46:15 ----

More details from Patrick on related usage, which may inform changes to the
Javadoc of the getBounds() method:

"The trick to get the most accurate advance measurements is:
1. avoid cumulating text chunks bounds width. They get rounded to int and errors
sum up. Reevaluate all previous chunks in one getBounds() to eliminate
cumulative errors.
2. use the getBounds() rectangle x and y properties to compute advance for one
chunk. Advance on x is bounds.getWidth() plus bounds.getX(). This way, leading
spaces are almost correctly accounted for.

This gives very acceptable results for word by word processing.

However, the one limitating thing i see here is the rounding to int of all draw
and getBounds coordinates. Allowing floats or doubles would ease the above point
one."



--- Bug imported by sgothel@jausoft.com 2010-03-24 07:51 EDT  ---

This bug was previously known as _bug_ 331 at https://jogl.dev.java.net/bugs/show_bug.cgi?id=331