The small program below crashes processing the 'kern' table since JDK 7 b123 ..
import java.io.*;
import java.awt.*;
import java.awt.font.*;
import java.util.*;
public class KernCrash extends Frame {
private static Font font;
public static void main(String[] args) throws Exception {
HashMap attrs = new HashMap();
attrs.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
attrs.put(TextAttribute.SIZE, new Float(48f));
font = Font.createFont(Font.TRUETYPE_FONT, new File("Vera.ttf"));
font = font.deriveFont(attrs);
System.out.println("using " + font);
KernCrash f = new KernCrash();
f.setTitle("Kerning Crash");
f.setSize(600, 300);
f.setForeground(Color.black);
f.show();
}
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D)g;
FontRenderContext frc = g2.getFontRenderContext();
TextLayout layout = new TextLayout("text", font, frc);
layout.draw(g2, 10, 100);
}
}
I've attached the Vera.ttf font and the full hs log but the
top of the native stack looks like this :
Stack: [0xd6b00000,0xd6b80000], sp=0xd6b7e1d8, free space=504k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libfontmanager.so+0x1744c] void KernTable::process(LEGlyphStorage&)+0x90
C [libfontmanager.so+0x22fac] void LayoutEngine::adjustGlyphPositions(const unsigned short*,long,long,char,LEGlyphStorage&,LEErrorCode&)+0x1f0
C [libfontmanager.so+0x233fc] long LayoutEngine::layoutChars(const unsigned short*,long,long,long,char,float,float,LEErrorCode&)+0xf4
C [libfontmanager.so+0x24a0c] Java_sun_font_SunLayoutEngine_nativeLayout+0x1e8
j sun.font.SunLayoutEngine.nativeLayout(Lsun/font/Font2D;Lsun/font/FontStrike;[FII[CIIIIIIILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;JJ)V+669586304
j sun.font.SunLayoutEngine.nativeLayout(Lsun/font/Font2D;Lsun/font/FontStrike;[FII[CIIIIIIILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;JJ)V+0
j sun.font.SunLayoutEngine.layout(Lsun/font/FontStrikeDesc;[FIILsun/font/TextRecord;ILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;)V+98
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
-----