Example usage for java.awt FontMetrics getFont

List of usage examples for java.awt FontMetrics getFont

Introduction

In this page you can find the example usage for java.awt FontMetrics getFont.

Prototype

public Font getFont() 

Source Link

Document

Gets the Font described by this FontMetrics object.

Usage

From source file:com.celements.photo.image.GenerateThumbnail.java

private void drawCopyright(String copyright, Graphics2D g2d, int width, int height) {
    int bottomSpace = 5; //space between copyright and bottom border.
    int rightSpace = 5; //space between copyright and right border.
    int hSpacing = 3; //horizontal space between background and string.
    int vSpacing = 2; //vertical space between background and string.
    int rounding = 5; //rounding of the rect.

    FontMetrics metrics = calcCopyrightFontSize(copyright, width, g2d);
    g2d.setFont(metrics.getFont());
    int stringHeight = metrics.getHeight();

    drawBackground(copyright, width, height, bottomSpace, rightSpace, vSpacing, hSpacing, rounding,
            stringHeight, metrics, g2d);
    drawString(copyright, width, height, bottomSpace, rightSpace, vSpacing, hSpacing, metrics, g2d);
}