Java Code Examples for com.lowagie.text.Font#setStyle()

The following examples show how to use com.lowagie.text.Font#setStyle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PdfFormFontSettings.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private Font createFont( int fontType )
{
    Font font = new Font();
    font.setFamily( FONTFAMILY );

    switch ( fontType )
    {
    case FONTTYPE_BODY:
        font.setSize( FONTSIZE_BODY );
        font.setColor( Color.BLACK );
        break;
    case FONTTYPE_TITLE:
        font.setSize( FONTSIZE_TITLE );
        font.setStyle( java.awt.Font.BOLD );
        font.setColor( new Color( 0, 0, 128 ) ); // Navy Color
        break;
    case FONTTYPE_DESCRIPTION:
        font.setSize( FONTSIZE_DESCRIPTION );
        font.setColor( Color.DARK_GRAY );
        break;
    case FONTTYPE_SECTIONHEADER:
        font.setSize( FONTSIZE_SECTIONHEADER );
        font.setStyle( java.awt.Font.BOLD );
        font.setColor( new Color( 70, 130, 180 ) ); // Steel Blue Color
        break;
    case FONTTYPE_FOOTER:
        font.setSize( FONTSIZE_FOOTER );
        break;
    default:
        font.setSize( FONTSIZE_BODY );
        break;
    }

    return font;
}
 
Example 2
Source File: PdfExportService.java    From fredbet with Creative Commons Attribution Share Alike 4.0 International 5 votes vote down vote up
private Paragraph createHeadline(PdfTableData pdfTableData) {
    Font font = fontCreator.createFont();
    font.setSize(18);
    font.setStyle(Font.BOLD);
    Paragraph headline = new Paragraph(pdfTableData.getTitle(), font);
    headline.setSpacingAfter(20);
    return headline;
}
 
Example 3
Source File: PdfFont.java    From unitime with Apache License 2.0 4 votes vote down vote up
public static Font getFont(boolean bold, boolean italic, boolean underline, Color color) {
	Font font = getFont(bold, italic);
	if (underline) font.setStyle(font.getStyle() + Font.UNDERLINE);
	if (color != null) font.setColor(color);
	return font;
}
 
Example 4
Source File: PdfFont.java    From unitime with Apache License 2.0 4 votes vote down vote up
public static Font getSmallFont(boolean bold, boolean italic, boolean underline, Color color) {
	Font font = getSmallFont(bold, italic);
	if (underline) font.setStyle(font.getStyle() + Font.UNDERLINE);
	if (color != null) font.setColor(color);
	return font;
}
 
Example 5
Source File: DocStyleUtils.java    From DWSurvey with GNU Affero General Public License v3.0 3 votes vote down vote up
/** 
 * 功能说明:设置字体的样式</BR> 
 * 修改日期:2011-04-27 
 * @author myclover 
 * @param family  字体类型 
 * @param color   字体颜色 
 * @param size    字体大小,22f为二号,18f为小二号,16f为三号 
 * @param style   字体样式 
 * @return 
 */  
public static Font setFontStyle(String family , Color color , float size , int style){  
    Font font = new Font();  
    font.setFamily(family);  
    font.setColor(color);  
    font.setSize(size);  
    font.setStyle(style);  
    return font;  
}