
import java.awt.Font;
import java.awt.font.FontRenderContext;
import java.awt.font.TextAttribute;
import java.io.File;
import java.util.Collections;

public class GVT 
{ 
//Adapt FONT_DIRECTORY for other OSs or specific folders with a selected sets of fonts ("Arial" and "Arial Unicode MS" highly recommended) 
private static final String FONT_DIRECTORY = "c:\\windows\\fonts\\"; 
private static final int REPETITIONS = 5_000; 
private static final char[] TEXT = "X sosofts 0,0 Steffieie Y".toCharArray(); 
private static final FontRenderContext FRC = new FontRenderContext(null, true, true); 

public static void main(String[] args) throws Throwable 
{ 
System.out.println("Java " + System.getProperty("java.version") + " on " + System.getProperty("os.name") + "\n"); 
for (File fontFile : new File(FONT_DIRECTORY).listFiles()) 
{ 
if (fontFile.toString().toLowerCase().endsWith(".ttf")) 
{ 
Font font = Font.createFont(Font.TRUETYPE_FONT, fontFile).deriveFont(123f) 
.deriveFont(Collections.singletonMap(TextAttribute.KERNING, TextAttribute.KERNING_ON)) 
.deriveFont(Collections.singletonMap(TextAttribute.LIGATURES, TextAttribute.LIGATURES_ON)); 
System.out.print(fontFile.toString() + ";" + font.getName() + ";"); 
long start = System.nanoTime(); 
for (int i = 0; i < REPETITIONS; i++) 
{ 
font.layoutGlyphVector(FRC, TEXT, 0, TEXT.length, 0); 
} 
System.out.println((System.nanoTime() - start) / REPETITIONS / 1000); 
} 
} 
} 
} 