當前位置: 首頁>>代碼示例>>Java>>正文


Java PDType1Font.COURIER_BOLD屬性代碼示例

本文整理匯總了Java中org.apache.pdfbox.pdmodel.font.PDType1Font.COURIER_BOLD屬性的典型用法代碼示例。如果您正苦於以下問題:Java PDType1Font.COURIER_BOLD屬性的具體用法?Java PDType1Font.COURIER_BOLD怎麽用?Java PDType1Font.COURIER_BOLD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.apache.pdfbox.pdmodel.font.PDType1Font的用法示例。


在下文中一共展示了PDType1Font.COURIER_BOLD屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: generateBillHeader

private void generateBillHeader(PDPage firstPage, PDPageContentStream contentStream)
        throws IOException {
    // Add header text
    PDFont currentFont;
    int currentFontSize;
    String headerLine1 = "Git Rekt Resort";
    String headerLine2 = "Customer Bill";
    contentStream.setLeading(10);
    currentFont = BOLD;
    currentFontSize = 14;
    contentStream.setFont(currentFont, currentFontSize);
    contentStream.beginText();
    float offsetX = getCenteredTextXPos(firstPage, headerLine1, currentFont, currentFontSize);
    contentStream.newLineAtOffset(offsetX, 750f);
    contentStream.showText(headerLine1);
    currentFont = PDType1Font.COURIER_BOLD;
    currentFontSize = 12;
    contentStream.setFont(currentFont, currentFontSize);
    float offsetX2 = getCenteredTextXPos(firstPage, headerLine2, currentFont, currentFontSize);
    contentStream.newLineAtOffset(-offsetX + offsetX2, -5f);
    contentStream.newLine();
    contentStream.showText(headerLine2);
    contentStream.endText();
}
 
開發者ID:maillouxc,項目名稱:git-rekt,代碼行數:24,代碼來源:BillPdfGenerator.java

示例2: chooseMatchingCourier

/**
 * Get a PDType1Font.COURIER-variant, which matches the given font
 * 
 * @param font
 *            Font to get the styles from
 * @return a PDFont Courier variant which matches the style in the given Font
 *         object.
 */
public static PDFont chooseMatchingCourier(Font font) {
	if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
		return PDType1Font.COURIER_BOLD_OBLIQUE;
	if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
		return PDType1Font.COURIER_OBLIQUE;
	if ((font.getStyle() & Font.BOLD) == Font.BOLD)
		return PDType1Font.COURIER_BOLD;
	return PDType1Font.COURIER;
}
 
開發者ID:rototor,項目名稱:pdfbox-graphics2d,代碼行數:17,代碼來源:PdfBoxGraphics2DFontTextDrawerDefaultFonts.java

示例3: tryBuiltinFallback

private PDFont tryBuiltinFallback(String fontFamily, boolean isItalic, boolean isBold)
{
    PDFont font;
    
    fontFamily = fontFamily.toLowerCase();
    switch (fontFamily) {
    case "courier":
    case "courier new":
    case "lucida console":
        if (isBold && isItalic) { font = PDType1Font.COURIER_BOLD_OBLIQUE;}
        else if (isBold) { font = PDType1Font.COURIER_BOLD;}
        else if (isItalic) { font = PDType1Font.COURIER_OBLIQUE;}
        else { font = PDType1Font.COURIER;}
        break;
    case "times":
    case "garamond":
    case "georgia":
    case "times new roman":
    case "serif":
        if (isBold && isItalic) { font = PDType1Font.TIMES_BOLD_ITALIC;}
        else if (isBold) { font = PDType1Font.TIMES_BOLD;}
        else if (isItalic) { font = PDType1Font.TIMES_ITALIC;}
        else { font = PDType1Font.TIMES_ROMAN;}
        break;
    default:
        if (isBold && isItalic) { font = PDType1Font.HELVETICA_BOLD_OBLIQUE;}
        else if (isBold) { font = PDType1Font.HELVETICA_BOLD;}
        else if (isItalic) { font = PDType1Font.HELVETICA_OBLIQUE;}
        else { font = PDType1Font.HELVETICA;}
        break;
    }
    return font;
}
 
開發者ID:radkovo,項目名稱:CSSBoxPdf,代碼行數:33,代碼來源:PDFRenderer.java


注:本文中的org.apache.pdfbox.pdmodel.font.PDType1Font.COURIER_BOLD屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。