1 34 35 package org.krysalis.jcharts.properties.util; 36 37 38 import java.awt.*; 39 import java.awt.geom.AffineTransform ; 40 41 42 47 public class ChartFont extends ChartItem 48 { 49 public static final ChartFont DEFAULT_AXIS_TITLE = new ChartFont( new Font( "Serif", Font.BOLD, 12 ), Color.black ); 50 public static final ChartFont DEFAULT_AXIS_VALUE = new ChartFont( new Font( "Serif", Font.PLAIN, 12 ), Color.black ); 51 public static final ChartFont DEFAULT_AXIS_SCALE = new ChartFont( new Font( "TimesRoman", Font.PLAIN, 12 ), Color.black ); 52 53 public static final ChartFont DEFAULT_LEGEND = new ChartFont( new Font( "Serif", Font.PLAIN, 12 ), Color.black ); 54 55 public static final ChartFont DEFAULT_PIE_VALUE = new ChartFont( new Font( "Serif", Font.PLAIN, 10 ), Color.black ); 56 57 public static final ChartFont DEFAULT_CHART_TITLE= new ChartFont( new Font( "Serif", Font.BOLD, 12 ), Color.black ); 58 59 public static final AffineTransform VERTICAL_ROTATION = AffineTransform.getRotateInstance( -Math.PI / 2 ); 60 61 62 private Font font; 63 private AffineTransform affineTransform; 65 66 71 public ChartFont( Font font, Paint paint ) 72 { 73 super( paint ); 74 this.font= font; 75 } 76 77 78 83 public void setupGraphics2D( Graphics2D graphics2D ) 84 { 85 super.setupGraphics2D( graphics2D ); 86 graphics2D.setFont( this.font ); 87 } 88 89 90 95 public Font getFont() 96 { 97 return this.font; 98 } 99 100 101 115 public Font deriveFont() 116 { 117 this.affineTransform= VERTICAL_ROTATION; 118 return this.font.deriveFont( this.affineTransform ); 119 } 120 121 122 } 123 | Popular Tags |