Java examples for 2D Graphics:Font
import Font
//package com.java2s; import java.awt.Font; import java.awt.FontFormatException; import java.awt.GraphicsEnvironment; import java.io.IOException; import java.io.InputStream; public class Main { public static void importFont(InputStream stream) { try {//from w w w .j av a 2s . co m Font font1 = Font.createFont(Font.TRUETYPE_FONT, stream); GraphicsEnvironment.getLocalGraphicsEnvironment().registerFont( font1); } catch (FontFormatException ex) { throw new RuntimeException(ex); } catch (IOException ex) { throw new RuntimeException(ex); } } }