JDK-8013716 : Renderer for Calibri and Cambria Fonts fails since update 45
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u45,7u21
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2013-04-30
  • Updated: 2013-05-07
  • Resolved: 2013-05-07
Description
FULL PRODUCT VERSION :
1.6.0_45-b06 and 1.7.0_21

ADDITIONAL OS VERSION INFORMATION :
Windows 7 64 Professional

A DESCRIPTION OF THE PROBLEM :
Apache POI uses TextLayout to determine the width of e.g. Text in Excel columns. Since Update 45 this doesn't work for the fonts Calibri and Cambria. Replacing the fontmanager.dll in the bin directory with the previous version (update 43) solves the problem.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the test code with the old and new fontmanager.dll


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For Cambria the value should be 23.955078125
ACTUAL -
For Cambria the value 0.0 is returned with the current fontmanager.dll

There is a non repeatable error message (see below) that occurred during testing only once when Cambria was calculated.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000000006d37c66f, pid=3208, tid=1588
#
# JRE version: 6.0_45-b06
# Java VM: Java HotSpot(TM) 64-Bit Server VM (20.45-b01 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [fontmanager.dll+0x3c66f]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x000000000061c000):  JavaThread  " main "  [_thread_in_native, id=1588, stack(0x0000000002210000,0x0000000002310000)]

siginfo: ExceptionCode=0xc0000005, reading address 0x0000000007b7c542

Registers:
RAX=0x0000000000000000, RBX=0x0000000000007807, RCX=0x000000000000ff00, RDX=0x000000000000ff00
RSP=0x000000000230e440, RBP=0x0000000007b6c57e, RSI=0x000000000230ede0, RDI=0x000000000230e950
R8 =0x0000000007b7c542, R9 =0x0000000000000778, R10=0x0000000000000000, R11=0x0000000000000000
R12=0x000000000000ffe7, R13=0x0000000000000000, R14=0x000000000000ffff, R15=0x0000000000000064
RIP=0x000000006d37c66f, EFLAGS=0x0000000000010246

  Top of Stack: (sp=0x000000000230e440)
0x000000000230e440:   0000000000000001 0000000000000005
0x000000000230e450:   0000000007668970 000000006d34e3ff
0x000000000230e460:   000000000230edb4 0000000000000005
0x000000000230e470:   0000000007668970 000000000000000a
0x000000000230e480:   c3f600013f800000 0000000000000005
0x000000000230e490:   0000000007668970 000000000230ede0
0x000000000230e4a0:   000000007e7e7e7e 000000000230e680
0x000000000230e4b0:   0000000000000000 0000000000000000
0x000000000230e4c0:   000000006d3a0fa0 ffffffff00000001
0x000000000230e4d0:   ffffffff00000004 000000000794d9e0
0x000000000230e4e0:   0000000007a3d350 ffffffffffffffff
0x000000000230e4f0:   04000000bbe60008 0000000000000000
0x000000000230e500:   000000000230ede0 0000000047444546
0x000000000230e510:   0000000006deda48 000000000799cb8c
0x000000000230e520:   00000000000003e2 000000000230ede0
0x000000000230e530:   0000000047444546 0000000006deda48

Instructions: (pc=0x000000006d37c66f)
0x000000006d37c64f:   7e 7e 7e 0f b7 ca 66 c1 e2 08 4c 63 d8 66 c1 e9
0x000000006d37c65f:   08 44 0f b6 c1 0f b7 ca 4c 0b c1 4c 03 c5 85 c0
0x000000006d37c66f:   41 0f b7 10 78 53 0f b7 c2 66 c1 e2 08 66 c1 e8
0x000000006d37c67f:   08 0f b6 c8 0f b7 c2 0b c8 44 3b d9 7d 3b 49 8b


Register to memory mapping:

RAX=0x0000000000000000 is an unknown value
RBX=0x0000000000007807 is an unknown value
RCX=0x000000000000ff00 is an unknown value
RDX=0x000000000000ff00 is an unknown value
RSP=0x000000000230e440 is pointing into the stack for thread: 0x000000000061c000
RBP=0x0000000007b6c57e is an unknown value
RSI=0x000000000230ede0 is pointing into the stack for thread: 0x000000000061c000
RDI=0x000000000230e950 is pointing into the stack for thread: 0x000000000061c000
R8 =0x0000000007b7c542 is an unknown value
R9 =0x0000000000000778 is an unknown value
R10=0x0000000000000000 is an unknown value
R11=0x0000000000000000 is an unknown value
R12=0x000000000000ffe7 is an unknown value
R13=0x0000000000000000 is an unknown value
R14=0x000000000000ffff is an unknown value
R15=0x0000000000000064 is an unknown value


Stack: [0x0000000002210000,0x0000000002310000],  sp=0x000000000230e440,  free space=1017k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [fontmanager.dll+0x3c66f]  Java_sun_font_FileFontStrike__1getGlyphImageFromWindows+0xf40f

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.font.SunLayoutEngine.nativeLayout(Lsun/font/Font2D;Lsun/font/FontStrike;[FII[CIIIIIIILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;)V+0
j  sun.font.SunLayoutEngine.layout(Lsun/font/FontStrikeDesc;[FIILsun/font/TextRecord;ILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;)V+70
j  sun.font.GlyphLayout$EngineRecord.layout()V+95
j  sun.font.GlyphLayout.layout(Ljava/awt/Font;Ljava/awt/font/FontRenderContext;[CIIILsun/font/StandardGlyphVector;)Lsun/font/StandardGlyphVector;+541
j  sun.font.ExtendedTextSourceLabel.createGV()Lsun/font/StandardGlyphVector;+63
j  sun.font.ExtendedTextSourceLabel.getGV()Lsun/font/StandardGlyphVector;+9
j  sun.font.ExtendedTextSourceLabel.createLogicalBounds()Ljava/awt/geom/Rectangle2D;+1
j  sun.font.ExtendedTextSourceLabel.getAdvance()F+9
j  java.awt.font.TextLine.init()V+626
j  java.awt.font.TextLine.<init>(Ljava/awt/font/FontRenderContext;[Lsun/font/TextLineComponent;[F[CII[I[BZ)V+79
j  java.awt.font.TextLine.fastCreateTextLine(Ljava/awt/font/FontRenderContext;[CLjava/awt/Font;Lsun/font/CoreMetrics;Ljava/util/Map;)Ljava/awt/font/TextLine;+337
j  java.awt.font.TextLayout.fastInit([CLjava/awt/Font;Ljava/util/Map;Ljava/awt/font/FontRenderContext;)V+83
j  java.awt.font.TextLayout.<init>(Ljava/text/AttributedCharacterIterator;Ljava/awt/font/FontRenderContext;)V+190
j  test.TestAutosize.main([Ljava/lang/String;)V+111
v  ~StubRoutines::call_stub

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )
  0x0000000005fa9800 JavaThread  " Java2D Disposer "  daemon [_thread_blocked, id=1496, stack(0x0000000006830000,0x0000000006930000)]
  0x0000000005f22000 JavaThread  " Low Memory Detector "  daemon [_thread_blocked, id=2848, stack(0x00000000064d0000,0x00000000065d0000)]
  0x0000000005f1f000 JavaThread  " C2 CompilerThread1 "  daemon [_thread_blocked, id=4436, stack(0x00000000063d0000,0x00000000064d0000)]
  0x000000000052a000 JavaThread  " C2 CompilerThread0 "  daemon [_thread_blocked, id=5476, stack(0x00000000062d0000,0x00000000063d0000)]
  0x0000000000528800 JavaThread  " Attach Listener "  daemon [_thread_blocked, id=9740, stack(0x00000000061d0000,0x00000000062d0000)]
  0x0000000005f10800 JavaThread  " Signal Dispatcher "  daemon [_thread_blocked, id=3016, stack(0x00000000060d0000,0x00000000061d0000)]
  0x0000000000512000 JavaThread  " Finalizer "  daemon [_thread_blocked, id=9932, stack(0x0000000005dd0000,0x0000000005ed0000)]
  0x0000000000508800 JavaThread  " Reference Handler "  daemon [_thread_blocked, id=8720, stack(0x0000000005cd0000,0x0000000005dd0000)]
=>0x000000000061c000 JavaThread  " main "  [_thread_in_native, id=1588, stack(0x0000000002210000,0x0000000002310000)]

Other Threads:
  0x0000000000500000 VMThread [stack: 0x0000000005bd0000,0x0000000005cd0000] [id=7516]
  0x0000000005f2b000 WatcherThread [stack: 0x00000000065d0000,0x00000000066d0000] [id=9876]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap
 PSYoungGen      total 18880K, used 7332K [0x00000000eaeb0000, 0x00000000ec3c0000, 0x0000000100000000)
  eden space 16192K, 45% used [0x00000000eaeb0000,0x00000000eb5d9178,0x00000000ebe80000)
  from space 2688K, 0% used [0x00000000ec120000,0x00000000ec120000,0x00000000ec3c0000)
  to   space 2688K, 0% used [0x00000000ebe80000,0x00000000ebe80000,0x00000000ec120000)
 PSOldGen        total 43200K, used 0K [0x00000000c0c00000, 0x00000000c3630000, 0x00000000eaeb0000)
  object space 43200K, 0% used [0x00000000c0c00000,0x00000000c0c00000,0x00000000c3630000)
 PSPermGen       total 21248K, used 5695K [0x00000000bba00000, 0x00000000bcec0000, 0x00000000c0c00000)
  object space 21248K, 26% used [0x00000000bba00000,0x00000000bbf8ffb8,0x00000000bcec0000)

Code Cache  [0x0000000002310000, 0x0000000002580000, 0x0000000005310000)
 total_blobs=333 nmethods=55 adapters=232 free_code_cache=49759040 largest_free_block=14016

Dynamic libraries:
0x0000000000400000 - 0x000000000042f000 C:\Program Files\Java\jdk1.6.0_45\bin\javaw.exe
0x00000000773d0000 - 0x0000000077579000 C:\Windows\SYSTEM32
tdll.dll
0x00000000772b0000 - 0x00000000773cf000 C:\Windows\system32\kernel32.dll
0x000007fefd450000 - 0x000007fefd4bb000 C:\Windows\system32\KERNELBASE.dll
0x000007feff520000 - 0x000007feff5fb000 C:\Windows\system32\ADVAPI32.dll
0x000007fefe0f0000 - 0x000007fefe18f000 C:\Windows\system32\msvcrt.dll
0x000007fefd5e0000 - 0x000007fefd5ff000 C:\Windows\SYSTEM32\sechost.dll
0x000007fefd670000 - 0x000007fefd79d000 C:\Windows\system32\RPCRT4.dll
0x00000000771b0000 - 0x00000000772aa000 C:\Windows\system32\USER32.dll
0x000007fefe230000 - 0x000007fefe297000 C:\Windows\system32\GDI32.dll
0x000007fefe0e0000 - 0x000007fefe0ee000 C:\Windows\system32\LPK.dll
0x000007fefd7a0000 - 0x000007fefd869000 C:\Windows\system32\USP10.dll
0x000007feff4f0000 - 0x000007feff51e000 C:\Windows\system32\IMM32.DLL
0x000007fefdce0000 - 0x000007fefdde9000 C:\Windows\system32\MSCTF.dll
0x000000006d8e0000 - 0x000000006e09c000 C:\Program Files\Java\jdk1.6.0_45\jre\bin\server\jvm.dll
0x000007fefb480000 - 0x000007fefb4bb000 C:\Windows\system32\WINMM.dll
0x000000006d850000 - 0x000000006d85e000 C:\Program Files\Java\jdk1.6.0_45\jre\bin\verify.dll
0x000000006d460000 - 0x000000006d487000 C:\Program Files\Java\jdk1.6.0_45\jre\bin\java.dll
0x000000006d8a0000 - 0x000000006d8b2000 C:\Program Files\Java\jdk1.6.0_45\jre\bin\zip.dll
0x000000006d0a0000 - 0x000000006d264000 C:\Program Files\Java\jdk1.6.0_45\jre\bin\awt.dll
0x000007fef0a20000 - 0x000007fef0a91000 C:\Windows\system32\WINSPOOL.DRV
0x000007fefdad0000 - 0x000007fefdcd3000 C:\Windows\system32\ole32.dll
0x000007fefe450000 - 0x000007feff1d8000 C:\Windows\system32\SHELL32.dll
0x000007fefda50000 - 0x000007fefdac1000 C:\Windows\system32\SHLWAPI.dll
0x000007fefbc40000 - 0x000007fefbe34000 C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.17514_none_fa396087175ac9ac\COMCTL32.dll
0x000007fefb590000 - 0x000007fefb5a8000 C:\Windows\system32\DWMAPI.DLL
0x000007fefbbe0000 - 0x000007fefbc36000 C:\Windows\system32\uxtheme.dll
0x000000006d340000 - 0x000000006d3b5000 C:\Program Files\Java\jdk1.6.0_45\jre\bin\fontmanager.dll
0x000000006d6c0000 - 0x000000006d6d7000 C:\Program Files\Java\jdk1.6.0_45\jre\bin
et.dll
0x000007fefe400000 - 0x000007fefe44d000 C:\Windows\system32\WS2_32.dll
0x000007fefd660000 - 0x000007fefd668000 C:\Windows\system32\NSI.dll
0x000007fefcb10000 - 0x000007fefcb65000 C:\Windows\system32\mswsock.dll
0x000007fefcb70000 - 0x000007fefcb77000 C:\Windows\System32\wship6.dll
0x000000006d6e0000 - 0x000000006d6ec000 C:\Program Files\Java\jdk1.6.0_45\jre\bin
io.dll
0x00000000775a0000 - 0x00000000775a7000 C:\Windows\system32\PSAPI.DLL

VM Arguments:
jvm_args: -Dfile.encoding=Cp1252
java_command: test.TestAutosize
Launcher Type: SUN_STANDARD

Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files (x86)\Bitvise SSH Client
USERNAME=xxx
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 6, GenuineIntel



---------------  S Y S T E M  ---------------

OS: Windows 7 , 64 bit Build 7601 Service Pack 1

CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 6, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1

Memory: 4k page, physical 4145068k(438040k free), swap 8288276k(2077156k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (20.45-b01) for windows-amd64 JRE (1.6.0_45-b06), built on Apr  1 2013 12:31:37 by  " java_re "  with MS VC++ 8.0 (VS2005)

time: Tue Apr 30 13:19:35 2013
elapsed time: 0 seconds


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
final java.awt.GraphicsEnvironment gEnv = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
final String envfonts[] = gEnv.getAvailableFontFamilyNames();
for(String font : envfonts) {
final String txt =  " Test " ;
final java.text.AttributedString str = new java.text.AttributedString(txt);
str.addAttribute(java.awt.font.TextAttribute.FAMILY, font, 0, txt.length());
str.addAttribute(java.awt.font.TextAttribute.SIZE, (float) 14.0);
str.addAttribute(java.awt.font.TextAttribute.WEIGHT, java.awt.font.TextAttribute.WEIGHT_BOLD, 0,
txt.length());
final java.awt.font.FontRenderContext fontRenderContext = new java.awt.font.FontRenderContext(null, true,
true);
final java.awt.font.TextLayout layout = new java.awt.font.TextLayout(str.getIterator(), fontRenderContext);
System.out.println(font +  "  :  "  + layout.getBounds().getWidth());
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Copy fontmanager.dll from version 1.6.0_43 to bin directory and replace current one