JDK-4654540 : need hinting support for text rendering with scaled/flipped matrix
Type:Bug
Component:client-libs
Sub-Component:2d
Affected Version:1.2.2
Priority:P4
Status:Resolved
Resolution:Fixed
OS:generic
CPU:generic
Submitted:2002-03-19
Updated:2006-03-22
Resolved:2006-03-22
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
need hinting support for text rendering with scaled/flipped matrix
Comments
EVALUATION
Implemented following approach:
a. decompose original transform to bitmap transform (combination
of quadrant rotation and mirror) and remainder transform
b. further decompose remainder transform to safe hinting transform
and outline compensation transform
c. perform hinting with safe transform
d. apply compensation transform to hinted outline
e. perform scan convertion
f. apply bitmap transform
As a result of this we have following improvements:
- quality of transformed text is significantly improved
if transfromation matrix is close to identity
(e.g. for small rotations)
- better consistency of the length of transformed text
- fixed number of artefacts of assymetrical transforms (see also 4912220)
- quadrant transforms/flips now produce symmetrical results
Note that quadrant rotations embeded into composite glyphs are handled
without using bitmap transforms and for those glyphs some assymetry is
still possible because of dropout control rules.
Also note that for some transforms quality will not improve and in some cases it may degrade. One example of this is rotations by large angles.
Some screenshots illustrating improvements and less obvious consequences are attached
to this bug report (sources of the actual tests are available from related bug reports).
14-03-2006
EVALUATION
Truetype hinting is designed with assumption that orientation of glyph regarding pixel grid is fixed. I.e. it does not support complex affine transforms such as rotation or shear. It does work with scale transforms (if no flipping involved)
and java2d supports that.
We may still benefit from hinting in case of complex transforms if we
decompose them into scale transform S (that works with hinting engine)
and another tranform T.
Then we can first apply hinting to outline with transform S and
then apply transform T to already hinted outline.
This makes text outlook under different affine transforms more consistent
(turning off hinting makes the big difference).