Java Font.deriveFont(int style, AffineTransform trans)

Syntax

Font.deriveFont(int style, AffineTransform trans) has the following syntax.

public Font deriveFont(int style,  AffineTransform trans)

Example

In the following code shows how to use Font.deriveFont(int style, AffineTransform trans) method.


/*from  w w  w .j a  v a2 s  . c o m*/
import java.awt.Font;
import java.awt.geom.AffineTransform;
import java.io.FileInputStream;
import java.io.InputStream;

public class Main {
  public static void main(String[] args) throws Exception{
    String fontFileName = "yourfont.ttf";
    InputStream is = new FileInputStream(fontFileName);

    Font ttfBase = Font.createFont(Font.TRUETYPE_FONT, is);

    Font ttfReal = ttfBase.deriveFont(Font.BOLD,AffineTransform.getRotateInstance(0.5));
  }

}




















Home »
  Java Tutorial »
    java.awt »




BasicStroke
BorderLayout
CardLayout
Color
Cursor
Desktop
DesktopManager
DisplayMode
EventQueue
FlowLayout
FocusTraversalPolicy
Font
FontMetrics
GradientPaint
Graphics
Graphics2D
GraphicsConfiguration
GraphicsDevice
GraphicsEnvironment
GridBagConstraints
GridBagLayout
GridLayout
Image
ItemSelectable
KeyboardFocusManager
LayoutManager
LayoutManager2
Point
Rectangle
Robot
Shape
SplashScreen
SystemColor
SystemTray
TexturePaint
TrayIcon
Toolkit
Transparency