attributes.put(TextAttribute.FAMILY, font.getFontName()); attributes.put(TextAttribute.SIZE, new Float(font.getFontSize())); if (font.isBold()) if (font.isItalic()) if (font.isUnderline()) if (font.isStrikeThrough()) attributes.put(JRTextAttribute.PDF_FONT_NAME, font.getPdfFontName()); attributes.put(JRTextAttribute.PDF_ENCODING, font.getPdfEncoding()); if (font.isPdfEmbedded())
/** * */ private static JRFont getBaseFont(JRFont font) { if (font.getReportFont() != null) return font.getReportFont(); if (font.getDefaultStyleProvider() != null) return font.getDefaultStyleProvider().getDefaultFont(); return null; }
/** * */ public static void copyNonNullOwnProperties(JRFont srcFont, JRFont destFont) { if(srcFont != null && destFont != null) { if (srcFont.getOwnFontName() != null) destFont.setFontName(srcFont.getOwnFontName()); if (srcFont.isOwnBold() != null) destFont.setBold(srcFont.isOwnBold()); if (srcFont.isOwnItalic() != null) destFont.setItalic(srcFont.isOwnItalic()); if (srcFont.isOwnUnderline() != null) destFont.setUnderline(srcFont.isOwnUnderline()); if (srcFont.isOwnStrikeThrough() != null) destFont.setStrikeThrough(srcFont.isOwnStrikeThrough()); if (srcFont.getOwnFontSize() != null) destFont.setFontSize(srcFont.getOwnFontSize()); if (srcFont.getOwnPdfFontName() != null) destFont.setPdfFontName(srcFont.getOwnPdfFontName()); if (srcFont.getOwnPdfEncoding() != null) destFont.setPdfEncoding(srcFont.getOwnPdfEncoding()); if (srcFont.isOwnPdfEmbedded() != null) destFont.setPdfEmbedded(srcFont.isOwnPdfEmbedded()); } }
/** * @deprecated */ public void setFont(JRFont font) { reportFont = font.getReportFont(); fontName = font.getOwnFontName(); isBold = font.isOwnBold(); isItalic = font.isOwnItalic(); isUnderline = font.isOwnUnderline(); isStrikeThrough = font.isOwnStrikeThrough(); fontSize = font.getOwnSize(); pdfFontName = font.getOwnPdfFontName(); pdfEncoding = font.getOwnPdfEncoding(); isPdfEmbedded = font.isOwnPdfEmbedded(); }
private void testFont(Font djFont, JRFont jrFont) { assertEquals(djFont.getFontName(), jrFont.getFontName()); assertEquals(djFont.getFontSize(), jrFont.getFontsize()); assertEquals(djFont.isBold(), jrFont.isBold()); assertEquals(djFont.isItalic(), jrFont.isItalic()); }
int fontSize = font.getFontSize(); if (isFontSizeFixEnabled) fontSize -= 1; String fontName = font.getFontName(); if (fontMap != null && fontMap.containsKey(fontName)) && (cf.getColour().getValue() == forecolor) && (cf.getPointSize() == fontSize) && (cf.getUnderlineStyle() == UnderlineStyle.SINGLE ? (font.isUnderline()) : (!font.isUnderline())) && (cf.isStruckout() == font.isStrikeThrough()) && (cf.getBoldWeight() == BoldStyle.BOLD.getValue() ? (font.isBold()) : (!font.isBold())) && (cf.isItalic() == font.isItalic())) int fontSize = font.getFontSize(); if (isFontSizeFixEnabled) fontSize -= 1; String fontName = font.getFontName(); if (fontMap != null && fontMap.containsKey(fontName)) WritableFont.createFont(fontName), fontSize, font.isBold() ? WritableFont.BOLD : WritableFont.NO_BOLD, font.isItalic(), font.isUnderline() ? UnderlineStyle.SINGLE : UnderlineStyle.NO_UNDERLINE, Colour.getInternalColour(forecolor) ); cellFont.setStruckout(font.isStrikeThrough());
/** * */ public static Map getAttributes(Map attributes, JRFont font, Locale locale) { //Font awtFont = getAwtFont(font);//FIXMEFONT optimize so that we don't load the AWT font for all exporters. Font awtFont = getAwtFontFromBundles( font.getFontName(), ((font.isBold()?Font.BOLD:Font.PLAIN)|(font.isItalic()?Font.ITALIC:Font.PLAIN)), font.getFontSize(), locale ); if (awtFont != null) { attributes.put(TextAttribute.FONT, awtFont); } getAttributesWithoutAwtFont(attributes, font); return attributes; }
/** * */ public static boolean isBold(JRFont font) { if (font.isOwnBold() != null) return font.isOwnBold().booleanValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.isBold(); JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null && baseStyle.isBold() != null) return baseStyle.isBold().booleanValue(); return false; }
/** * */ public static boolean isItalic(JRFont font) { if (font.isOwnItalic() != null) return font.isOwnItalic().booleanValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.isItalic(); JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null && baseStyle.isItalic() != null) return baseStyle.isItalic().booleanValue(); return false; }
/** * */ public static String getFontName(JRFont font) { if (font.getOwnFontName() != null) return font.getOwnFontName(); JRFont baseFont = getBaseFont(font); if (baseFont != null && baseFont.getFontName() != null) return baseFont.getFontName(); JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null && baseStyle.getFontName() != null) return baseStyle.getFontName(); return JRProperties.getProperty(JRFont.DEFAULT_FONT_NAME); }
String fontName = defaultFont.getFontName(); excelFontName = (fontMap != null && fontMap.containsKey(fontName)) ? (String) fontMap.get(fontName) super.getId() + "|" + excelFontName + "|" + defaultFont.getFontSize() + "|" + forecolor + "|" + defaultFont.isItalic() + "|" +
/** * Return font index from the header of the .rtf file. The method is * called first when the header of the .rtf document is constructed and when a * text component needs font informations. * @param font the font for which the index is required * @return index of the font from .rtf file header */ private int getFontIndex(JRFont font) { String fontName = font.getFontName(); if(fontMap != null && fontMap.containsKey(fontName)){ fontName = (String)fontMap.get(fontName); } int fontIndex = fonts.indexOf(fontName); if(fontIndex < 0) { fontIndex = fonts.size(); fonts.add(fontName); fontBuffer.append("{\\f").append(fontIndex).append("\\fnil ").append(fontName).append(";}"); } return fontIndex; }
/** * */ public static String getPdfEncoding(JRFont font) { if (font.getOwnPdfEncoding() != null) return font.getOwnPdfEncoding(); JRFont baseFont = getBaseFont(font); if (baseFont != null && baseFont.getPdfEncoding() != null) return baseFont.getPdfEncoding(); JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null && baseStyle.getPdfEncoding() != null) return baseStyle.getPdfEncoding(); return JRProperties.getProperty(JRFont.DEFAULT_PDF_ENCODING); }
/** * */ public static String getPdfFontName(JRFont font) { if (font.getOwnPdfFontName() != null) return font.getOwnPdfFontName(); JRFont baseFont = getBaseFont(font); if (baseFont != null && baseFont.getPdfFontName() != null) return baseFont.getPdfFontName(); JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null && baseStyle.getPdfFontName() != null) return baseStyle.getPdfFontName(); return JRProperties.getProperty(JRFont.DEFAULT_PDF_FONT_NAME); }
/** * */ public static int getFontSize(JRFont font) { if (font.getOwnFontSize() != null) return font.getOwnFontSize().intValue(); JRFont baseFont = getBaseFont(font); if (baseFont != null) return baseFont.getFontSize(); JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null && baseStyle.getFontSize() != null) return baseStyle.getFontSize().intValue(); return JRProperties.getIntegerProperty(JRFont.DEFAULT_FONT_SIZE); }
/** * */ public String getOwnFontName() { return ((JRFont)parent).getOwnFontName(); }
/** * */ public String getOwnPdfFontName() { return ((JRFont)parent).getOwnPdfFontName(); }
/** * */ public String getOwnPdfEncoding() { return ((JRFont)parent).getOwnPdfEncoding(); }
/** * */ public Integer getOwnFontSize() { return ((JRFont)parent).getOwnFontSize(); }
private void testFont(Font djFont, JRFont jrFont) { assertEquals(djFont.getFontName(), jrFont.getFontName()); assertEquals(djFont.getFontSize(), jrFont.getFontsize()); assertEquals(djFont.isBold(), jrFont.isBold()); assertEquals(djFont.isItalic(), jrFont.isItalic()); }