JDK-8169188 : [macos] java/awt/font/TextLayout/TextLayoutBounds.java always fail
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 9,10,11,13,14
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • Submitted: 2016-11-03
  • Updated: 2023-10-09
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.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
This test used to fail differently until b137 (see JDK-8144015) but now on both my systems (10.10 and 10.12) it throws
tlbounds=java.awt.geom.Rectangle2D$Float[x=-1.09375,y=-23.125,w=83.578125,h=27.75]
gvbounds=java.awt.geom.Rectangle2D$Float[x=-1.09375,y=-23.125,w=83.265625,h=27.75]
outlineBounds=java.awt.geom.Rectangle2D$Float[x=-1.09375,y=-23.125,w=83.578125,h=27.75]
java.lang.RuntimeException: Bounds differ [gvv != tl]

i.e. width is different. I don't know how important is the difference in quarter of a pixel, in this context, so  I refrain from making it a testbug. Please decide.
Comments
I've verified that -Dsun.font.layoutengine=icu makes this pass on Mac (on JDK 9, which has ICU), and that using a different font that is an OpenType font also makes it pass. So the MacOS failure really is the same as https://bugs.openjdk.java.net/browse/JDK-8144012, and similarly can't be fixed without some support in CoreText for disabling fractional metrics. The Linux failure is different since the advances are all the same. But the height is different for the outline bounds. tlbounds=java.awt.geom.Rectangle2D$Float[x=0.1875,y=-22.140625,w=75.03125,h=25.78125] gvbounds=java.awt.geom.Rectangle2D$Float[x=0.1875,y=-22.140625,w=75.03125,h=25.78125] outlineBounds=java.awt.geom.Rectangle2D$Float[x=0.1875,y=-22.140625,w=75.03125,h=25.828125] Looking at the host system the font the test would use is Utopia Bold - a Type 1 font .. and there are very few fonts on the host system which is running RHEL 7.1 $ fc-match sans:bold UTB_____.pfa: "Utopia" "Bold" $ fc-list /usr/share/X11/fonts/Type1/c0611bt_.pfb: Courier 10 Pitch:style=Bold Italic /usr/share/X11/fonts/Type1/UTBI____.pfa: Utopia:style=Bold Italic /usr/share/X11/fonts/Type1/c0419bt_.pfb: Courier 10 Pitch:style=Regular /usr/share/X11/fonts/Type1/c0648bt_.pfb: Bitstream Charter:style=Regular /usr/share/X11/fonts/Type1/cursor.pfa: Cursor:style=Regular /usr/share/X11/fonts/Type1/UTB_____.pfa: Utopia:style=Bold /usr/share/X11/fonts/Type1/c0583bt_.pfb: Courier 10 Pitch:style=Bold /usr/share/X11/fonts/Type1/UTI_____.pfa: Utopia:style=Italic /usr/share/X11/fonts/Type1/c0582bt_.pfb: Courier 10 Pitch:style=Italic /usr/share/X11/fonts/Type1/c0633bt_.pfb: Bitstream Charter:style=Bold Italic /usr/share/X11/fonts/Type1/c0649bt_.pfb: Bitstream Charter:style=Italic /usr/share/X11/fonts/Type1/c0632bt_.pfb: Bitstream Charter:style=Bold /usr/share/X11/fonts/Type1/UTRG____.pfa: Utopia:style=Regular So this may be a problem specific to the Type 1 path, but why haven't we seen it before I pulled the font from that system and ran with JDK 9 but it passed. I then tried 11 and it failed as seen above. So I tried java -Dsun.java2d.font.scaler=t2k TextLayoutBounds WARNING: t2k will be removed in JDK 11. java.awt.Font[family=Utopia,name=Utopia,style=bold,size=32] Utopia Bold tlbounds=java.awt.geom.Rectangle2D$Float[x=0.1875,y=-22.140625,w=74.03125,h=25.828125] gvbounds=java.awt.geom.Rectangle2D$Float[x=0.1875,y=-22.140625,w=74.03125,h=25.828125] outlineBounds=java.awt.geom.Rectangle2D$Float[x=0.1875,y=-22.140625,w=74.03125,h=25.828125] and it passed ! So this is a freetype specific problem. I ran the test over all the fonts on my Ubuntu 16.04 system and found 5 others that exhibited the problem .. and 4 of them were TrueType. So it isn't just T1. Although the odd one out is always the outline bounds it is not always the height. The two NanumGothic Truetype fonts differed in the width. Also ALL fonts passed with T2K. Probably need to look for a tiny rounding difference in the freetype code for getting the outline bounds which only rarely makes a difference. /usr/share/fonts/truetype/lato/Lato-HairlineItalic.ttf java.awt.Font[family=Lato Hairline,name=Lato Hairline Italic,style=plain,size=32] Lato Hairline Italic tlbounds=java.awt.geom.Rectangle2D$Float[x=-0.609375,y=-22.40625,w=67.640625,h=22.65625] gvbounds=java.awt.geom.Rectangle2D$Float[x=-0.609375,y=-22.40625,w=67.640625,h=22.65625] outlineBounds=java.awt.geom.Rectangle2D$Float[x=-0.609375,y=-22.40625,w=67.640625,h=22.671875] Bounds differ [tl != outline] /usr/share/fonts/truetype/lato/Lato-ThinItalic.ttf" java.awt.Font[family=Lato Thin,name=Lato Thin Italic,style=plain,size=32] Lato Thin Italic tlbounds=java.awt.geom.Rectangle2D$Float[x=-0.609375,y=-22.5,w=67.96875,h=22.75] gvbounds=java.awt.geom.Rectangle2D$Float[x=-0.609375,y=-22.5,w=67.96875,h=22.75] outlineBounds=java.awt.geom.Rectangle2D$Float[x=-0.609375,y=-22.5,w=67.96875,h=22.765625] Bounds differ [tl != outline] /usr/share/fonts/type1/gsfonts/p052003l.pfb java.awt.Font[family=URW Palladio L,name=URW Palladio L Roman,style=plain,size=32] URW Palladio L Roman tlbounds=java.awt.geom.Rectangle2D$Float[x=-0.484375,y=-22.40625,w=83.671875,h=28.640625] gvbounds=java.awt.geom.Rectangle2D$Float[x=-0.484375,y=-22.40625,w=83.671875,h=28.640625] outlineBounds=java.awt.geom.Rectangle2D$Float[x=-0.484375,y=-22.40625,w=83.671875,h=28.8125] Bounds differ [tl != outline] /usr/share/fonts/truetype/nanum/NanumGothic.ttf java.awt.Font[family=NanumGothic,name=NanumGothic,style=plain,size=32] NanumGothic tlbounds=java.awt.geom.Rectangle2D$Float[x=0.765625,y=-22.375,w=77.78125,h=24.171875] gvbounds=java.awt.geom.Rectangle2D$Float[x=0.765625,y=-22.375,w=77.78125,h=24.171875] outlineBounds=java.awt.geom.Rectangle2D$Float[x=0.765625,y=-22.375,w=77.890625,h=24.171875] Bounds differ [tl != outline] /usr/share/fonts/truetype/nanum/NanumGothicBold.ttf java.awt.Font[family=NanumGothic,name=NanumGothicBold,style=plain,size=32] NanumGothicBold tlbounds=java.awt.geom.Rectangle2D$Float[x=0.671875,y=-22.53125,w=78.4375,h=24.421875] gvbounds=java.awt.geom.Rectangle2D$Float[x=0.671875,y=-22.53125,w=78.4375,h=24.421875] outlineBounds=java.awt.geom.Rectangle2D$Float[x=0.671875,y=-22.53125,w=78.5625,h=24.421875] Bounds differ [tl != outline]
02-05-2018

Issue reproducible on macosx with JDK 10.0.1 b05
21-02-2018

The test will fail in headless mode as well.
17-02-2018

This could be a duplicate of (same root cause) as https://bugs.openjdk.java.net/browse/JDK-8144012
03-11-2016

RULE "java/awt/font/TextLayout/TextLayoutBounds.java" Exception java.lang.RuntimeException: Bounds differ [gvv != tl]
03-11-2016