本文整理匯總了Java中org.apache.pdfbox.pdmodel.font.PDType1Font.TIMES_BOLD_ITALIC屬性的典型用法代碼示例。如果您正苦於以下問題:Java PDType1Font.TIMES_BOLD_ITALIC屬性的具體用法?Java PDType1Font.TIMES_BOLD_ITALIC怎麽用?Java PDType1Font.TIMES_BOLD_ITALIC使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.pdfbox.pdmodel.font.PDType1Font
的用法示例。
在下文中一共展示了PDType1Font.TIMES_BOLD_ITALIC屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: chooseMatchingTimes
/**
* Get a PDType1Font.TIMES-variant, which matches the given font
*
* @param font
* Font to get the styles from
* @return a PDFont Times variant which matches the style in the given Font
* object.
*/
public static PDFont chooseMatchingTimes(Font font) {
if ((font.getStyle() & (Font.ITALIC | Font.BOLD)) == (Font.ITALIC | Font.BOLD))
return PDType1Font.TIMES_BOLD_ITALIC;
if ((font.getStyle() & Font.ITALIC) == Font.ITALIC)
return PDType1Font.TIMES_ITALIC;
if ((font.getStyle() & Font.BOLD) == Font.BOLD)
return PDType1Font.TIMES_BOLD;
return PDType1Font.TIMES_ROMAN;
}
示例2: 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;
}