Example usage for org.apache.poi.hssf.usermodel HSSFFont getFontHeightInPoints

List of usage examples for org.apache.poi.hssf.usermodel HSSFFont getFontHeightInPoints

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFFont getFontHeightInPoints.

Prototype


public short getFontHeightInPoints() 

Source Link

Document

get the font height

Usage

From source file:poi.hssf.view.SVTableUtils.java

License:Apache License

/**
 *  Creates a new font for a specific cell style
 *///from www  .  ja va  2s .  com
public static Font makeFont(HSSFFont font) {
    boolean isbold = font.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
    boolean isitalics = font.getItalic();
    int fontstyle = Font.PLAIN;
    if (isbold) {
        fontstyle = Font.BOLD;
    }
    if (isitalics) {
        fontstyle = fontstyle | Font.ITALIC;
    }

    int fontheight = font.getFontHeightInPoints();
    if (fontheight == 9) {
        //fix for stupid ol Windows
        fontheight = 10;
    }

    return new Font(font.getFontName(), fontstyle, fontheight);
}

From source file:uk.ac.manchester.cs.owl.semspreadsheets.model.hssf.impl.CellHSSFImpl.java

License:BSD License

private Font getFont(HSSFFont hssfFont) {
    Font font = fontCache.get(hssfFont);
    if (font == null) {
        String name = hssfFont.getFontName();
        int size = hssfFont.getFontHeightInPoints();
        int style = Font.PLAIN;
        if (hssfFont.getBoldweight() == HSSFFont.BOLDWEIGHT_BOLD) {
            style = Font.BOLD;/*from   www  . j  a  va2s.c  o  m*/
            if (hssfFont.getItalic()) {
                style = style | Font.ITALIC;
            }
        } else if (hssfFont.getItalic()) {
            style = Font.ITALIC;
        }
        font = new Font(name, style, size);
        fontCache.put(hssfFont, font);
    }
    return font;

}