/** * Get a Font instance with the given font family name and size. A * plain font style is assumed. * @param name the font name. Any font installed on your system should * be valid. Common examples include "Arial", "Verdana", "Tahoma", * "Times New Roman", "Georgia", and "Courier New". * @param size the size, in points, of the font * @return the requested Font instance */ public static Font getFont(String name, double size) { int iSize = (int)Math.floor(size); return getFont(name, Font.PLAIN, iSize); }
/** * Get a Font instance with the given font family name, style, and size * @param name the font name. Any font installed on your system should * be valid. Common examples include "Arial", "Verdana", "Tahoma", * "Times New Roman", "Georgia", and "Courier New". * @param style the font style, such as bold or italics. This field * uses the same style values as the Java {@link java.awt.Font} class. * @param size the size, in points, of the font * @return the requested Font instance */ public static Font getFont(String name, int style, double size) { int iSize = (int)Math.floor(size); return getFont(name, style, iSize); }
/** * Interpolate between two font instances. Font sizes are interpolated * linearly. If the interpolation fraction is under 0.5, the face and * style of the starting font are used, otherwise the face and style of * the second font are applied. * @param f1 the starting font * @param f2 the target font * @param frac a fraction between 0 and 1.0 controlling the interpolation * amount. * @return an interpolated Font instance */ public static Font getIntermediateFont(Font f1, Font f2, double frac) { String name; int size, style; if ( frac < 0.5 ) { name = f1.getName(); style = f1.getStyle(); } else { name = f2.getName(); style = f2.getStyle(); } size = (int)Math.round(frac*f2.getSize()+(1-frac)*f1.getSize()); return getFont(name,style,size); }
m_font = FontLib.getFont(m_font.getName(), m_font.getStyle(), size*m_font.getSize());
public static Schema provideFontSchema() { final Schema fontSchema = PrefuseLib.getVisualItemSchema(); fontSchema.setDefault(VisualItem.INTERACTIVE, false); fontSchema.setDefault(VisualItem.TEXTCOLOR, FONT_COLOR); Font font = FontLib.getFont(UIManager.getFont(UI_DEFAULT_FONT_KEY).getFontName(), FONT_SIZE); fontSchema.setDefault(VisualItem.FONT, font); return fontSchema; }
Font defFont = FontLib.getFont("SansSerif",Font.PLAIN,10); s.addInterpolatedColumn(VisualItem.FONT, Font.class, defFont);
filter.add(new FontAction(treeNodes, FontLib.getFont("Tahoma", 16))); filter.add(treeLayout); filter.add(subLayout);
filter.add( new FontAction( GRAPH_NODES, FontLib.getFont( "Tahoma", 14 ) ) ); filter.add( treeLayout ); filter.add( subLayout );