Example usage for java.awt.font TextAttribute UNDERLINE_LOW_ONE_PIXEL

List of usage examples for java.awt.font TextAttribute UNDERLINE_LOW_ONE_PIXEL

Introduction

In this page you can find the example usage for java.awt.font TextAttribute UNDERLINE_LOW_ONE_PIXEL.

Prototype

Integer UNDERLINE_LOW_ONE_PIXEL

To view the source code for java.awt.font TextAttribute UNDERLINE_LOW_ONE_PIXEL.

Click Source Link

Document

Single pixel solid low underline.

Usage

From source file:com.pronoiahealth.olhie.server.services.BookCoverImageService.java

/**
 * Initialize the various maps, fonts, etc..
 *///from  ww w  . j  a va 2 s. c  o m
@PostConstruct
protected void postActivate() {
    try {
        // Init the coverMap and load the images
        coverMap = new HashMap<String, byte[]>();
        List<BookCover> covers = coverDisplayData.getCovers();
        for (BookCover cover : covers) {
            coverMap.put(cover.getCoverName(),
                    readResourceToByteArray("/" + cover.getImgUrl(), servletContext));
        }

        // Load needed fonts
        medulaOneRegularFont = Font.createFont(Font.TRUETYPE_FONT,
                servletContext.getResourceAsStream("/Olhie/font/MedulaOne-Regular.ttf"));
        medulaOneRegularFont48 = medulaOneRegularFont.deriveFont(new Float(48.0));
        arialBoldFont13 = new Font("Arial Bold", Font.BOLD, 13);
        arialBoldFont16 = new Font("Arial Bold", Font.ITALIC, 16);

        // Init font maps
        // author
        authorFontMap = new Hashtable<TextAttribute, Object>();
        authorFontMap.put(TextAttribute.FONT, arialBoldFont16);
        authorFontMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);

        // Title
        titleFontMap = new Hashtable<TextAttribute, Object>();
        titleFontMap.put(TextAttribute.FONT, medulaOneRegularFont48);
        titleFontMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);

        // Back cover title
        backTitleFontMap = new Hashtable<TextAttribute, Object>();
        backTitleFontMap.put(TextAttribute.FONT, arialBoldFont13);
        backTitleFontMap.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
        backTitleFontMap.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_LOW_ONE_PIXEL);

        // Build palette factory
        palFac = new PaletteFactory();

    } catch (Exception e) {
        log.log(Level.SEVERE, "Error occured during BookCoverImageService initialization.", e);
    }
}