/** * */ public boolean isStrikeThrough(JRFont font) { Boolean ownStrikeThrough = font.isOwnStrikeThrough(); if (ownStrikeThrough != null) { return ownStrikeThrough.booleanValue(); } JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null) { Boolean strikeThrough = baseStyle.isStrikeThrough(); if (strikeThrough != null) { return strikeThrough.booleanValue(); } } return false; }
@Override public void setStyle(JRFont font, Attributes atts) { JRDesignFont designFont = (JRDesignFont)font; String styleName = atts.getValue(JRXmlConstants.ATTRIBUTE_reportFont); if (styleName != null) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); Map<String,JRStyle> stylesMap = jasperDesign.getStylesMap(); if (stylesMap.containsKey(styleName)) { JRStyle style = stylesMap.get(styleName); designFont.setStyle(style); } else { designFont.setStyleNameReference(styleName); } } }
public static void addSortComponentRules(Digester digester) { String componentNamespace = digester.getRuleNamespaceURI(); String sortComponentPattern = "*/componentElement/sort"; digester.addObjectCreate(sortComponentPattern, SortComponent.class.getName()); digester.addSetProperties(sortComponentPattern, new String[] { SortComponent.PROPERTY_EVALUATION_TIME, }, new String[0]); digester.addRule(sortComponentPattern, new XmlConstantPropertyRule( SortComponent.PROPERTY_EVALUATION_TIME, EvaluationTimeEnum.values())); digester.addFactoryCreate(sortComponentPattern + "/symbol", SortComponentSymbolFactory.class.getName()); digester.setRuleNamespaceURI(JRXmlConstants.JASPERREPORTS_NAMESPACE); digester.addFactoryCreate(sortComponentPattern + "/symbol/font", SortComponentSymbolFontFactory.class.getName()); digester.addSetNext(sortComponentPattern + "/symbol/font", "setSymbolFont", JRFont.class.getName()); digester.setRuleNamespaceURI(componentNamespace); }
/** * */ public int getFont(JRExporterGridCell gridCell, Locale locale) { JRFont font = gridCell.getElement() instanceof JRFont ? (JRFont)gridCell.getElement() : null; if (font == null) { return -1; } String fontName = fontUtil.getExportFontFamily(font.getFontName(), locale, exporterKey); XlsxFontInfo xlsxFontInfo = new XlsxFontInfo(gridCell, fontName, configuration.isFontSizeFixEnabled()); Integer fontIndex = fontCache.get(xlsxFontInfo.getId()); if (fontIndex == null) { fontIndex = Integer.valueOf(fontCache.size()); export(xlsxFontInfo); fontCache.put(xlsxFontInfo.getId(), fontIndex); } return fontIndex.intValue(); }
/** * */ public XlsxFontInfo(JRExporterGridCell gridCell, String fontName, boolean isFontSizeFixEnabled) { JRPrintElement element = gridCell.getElement(); if (element != null) { this.color = JRColorUtil.getColorHexa(element.getForecolor()); } JRFont font = element instanceof JRFont ? (JRFont)element : null; if (font != null) { this.fontName = fontName; this.fontSize = font.getFontsize() + (isFontSizeFixEnabled ? -1 : 0); this.isBold = font.isBold(); this.isItalic = font.isItalic(); this.isUnderline = font.isUnderline(); this.isStrikeThrough = font.isStrikeThrough(); } }
/** * */ protected void exportFont(JRFont font) throws IOException { if (font != null) { xmlWriter.startElement(JRXmlConstants.ELEMENT_font); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_fontName, font.getOwnFontName()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_size, font.getOwnFontsize(), true); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isBold, font.isOwnBold()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isItalic, font.isOwnItalic()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isUnderline, font.isOwnUnderline()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isStrikeThrough, font.isOwnStrikeThrough()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pdfFontName, font.getOwnPdfFontName()); xmlWriter.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_pdfEncoding, font.getOwnPdfEncoding()); xmlWriter.addAttribute(JRXmlConstants.ATTRIBUTE_isPdfEmbedded, font.isOwnPdfEmbedded()); xmlWriter.closeElement(true); } }
/** * */ public String getPdfEncoding(JRStyle style) { String ownPdfEncoding = style.getOwnPdfEncoding(); if (ownPdfEncoding != null) { return ownPdfEncoding; } JRStyle baseStyle = getBaseStyle(style); if (baseStyle != null) { String pdfEncoding = baseStyle.getPdfEncoding(); if (pdfEncoding != null) { return pdfEncoding; } } return propertiesUtil.getProperty(JRFont.DEFAULT_PDF_ENCODING); }
protected HSSFRichTextString getRichTextString(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale) { String text = styledText.getText(); HSSFRichTextString richTextStr = new HSSFRichTextString(text); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { Map<Attribute,Object> attributes = iterator.getAttributes(); JRFont runFont = attributes.isEmpty()? defaultFont : new JRBaseFont(attributes); short runForecolor = attributes.get(TextAttribute.FOREGROUND) != null ? getWorkbookColor((Color)attributes.get(TextAttribute.FOREGROUND)).getIndex() : forecolor; HSSFFont font = getLoadedFont(runFont, runForecolor, attributes, locale); richTextStr.applyFont(iterator.getIndex(), runLimit, font); iterator.setIndex(runLimit); } return richTextStr; }
/** * */ public String getPdfEncoding(JRFont font) { String ownPdfEncoding = font.getOwnPdfEncoding(); if (ownPdfEncoding != null) { return ownPdfEncoding; } JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null) { String pdfEncoding = baseStyle.getPdfEncoding(); if (pdfEncoding != null) { return pdfEncoding; } } return propertiesUtil.getProperty(JRFont.DEFAULT_PDF_ENCODING); }
/** * */ public String getFontName(JRFont font) { String ownFontName = font.getOwnFontName(); if (ownFontName != null) { return ownFontName; } JRStyle baseStyle = getBaseStyle(font); if (baseStyle != null) { String fontName = baseStyle.getFontName(); if (fontName != null) { return fontName; } } return propertiesUtil.getProperty(JRFont.DEFAULT_FONT_NAME); }
/** * */ public void setValueAxisLabelFont(JRFont valueAxisLabelFont) { Object old = this.valueAxisLabelFont; this.valueAxisLabelFont = valueAxisLabelFont; getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_LABEL_FONT, old, this.valueAxisLabelFont); }
/** * */ protected JRFont getFont(JRFont font) { if (font == null) { return new JRBaseFont(getChart()); } return font; }
/** * */ public void setValueAxisTickLabelFont(JRFont valueAxisTickLabelFont) { Object old = this.valueAxisTickLabelFont; this.valueAxisTickLabelFont = valueAxisTickLabelFont; getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_TICK_LABEL_FONT, old, this.valueAxisTickLabelFont); }
/** * @param tickLabelFont the tickLabelFont to set */ public void setTickLabelFont(JRFont tickLabelFont) { JRFont old = getTickLabelFont(); this.tickLabelFont = tickLabelFont; getEventSupport().firePropertyChange(PROPERTY_tickLabelFont, old, getTickLabelFont()); }
/** * @param displayFont the displayFont to set */ public void setDisplayFont(JRFont displayFont) { JRFont old = getDisplayFont(); this.displayFont = displayFont; getEventSupport().firePropertyChange(PROPERTY_displayFont, old, getDisplayFont()); }
private void writeLabelFont(JRFont labelFont, JRXmlWriteHelper writer) throws IOException { if (labelFont != null) { writer.startElement(JRXmlConstants.ELEMENT_labelFont, JRXmlWriter.JASPERREPORTS_NAMESPACE); writeFont(labelFont, writer); writer.closeElement(); } }
/** * */ public Map<Attribute,Object> getAttributesWithoutAwtFont(Map<Attribute,Object> attributes, JRFont font) { attributes.put(TextAttribute.FAMILY, font.getFontName()); attributes.put(TextAttribute.SIZE, font.getFontsize()); if (font.isBold()) { attributes.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); } if (font.isItalic()) { attributes.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE); } if (font.isUnderline()) { attributes.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON); } if (font.isStrikeThrough()) { attributes.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON); } attributes.put(JRTextAttribute.PDF_FONT_NAME, font.getPdfFontName()); attributes.put(JRTextAttribute.PDF_ENCODING, font.getPdfEncoding()); if (font.isPdfEmbedded()) { attributes.put(JRTextAttribute.IS_PDF_EMBEDDED, Boolean.TRUE); } return attributes; }
/** * */ public void setTimeAxisLabelFont(JRFont timeAxisLabelFont) { Object old = this.timeAxisLabelFont; this.timeAxisLabelFont = timeAxisLabelFont; getEventSupport().firePropertyChange(PROPERTY_TIME_AXIS_LABEL_FONT, old, this.timeAxisLabelFont); }
@Override public JRFont getFont() { int i = 0; JRComponentElement component = null; while (component == null && i < digester.getCount()) { Object obj = digester.peek(i); component = obj instanceof JRComponentElement ? (JRComponentElement)obj : null; i++; } return new JRDesignFont(component); }
/** * */ public void setTitleFont(JRFont font)//FIXMEFONT embedded fonts should never be null so these font setting methods should be deprecated; check iR impact { Object old = this.titleFont; this.titleFont = font; getEventSupport().firePropertyChange(PROPERTY_TITLE_FONT, old, this.titleFont); }
/** * */ public void setTimeAxisTickLabelFont(JRFont timeAxisTickLabelFont) { Object old = this.timeAxisTickLabelFont; this.timeAxisTickLabelFont = timeAxisTickLabelFont; getEventSupport().firePropertyChange(PROPERTY_TIME_AXIS_TICK_LABEL_FONT, old, this.timeAxisTickLabelFont); }
@Override public void setStyle(JRFont font, Attributes atts) { JRDesignElement element = (JRDesignElement)font; if ( element.getStyle() == null && element.getStyleNameReference() == null ) { String styleName = atts.getValue(JRXmlConstants.ATTRIBUTE_reportFont); if (styleName != null) { JasperDesign jasperDesign = (JasperDesign)digester.peek(digester.getCount() - 2); Map<String,JRStyle> stylesMap = jasperDesign.getStylesMap(); if (stylesMap.containsKey(styleName)) { JRStyle style = stylesMap.get(styleName); element.setStyle(style); } else { element.setStyleNameReference(styleName); } } } }
/** * */ public void setCategoryAxisLabelFont(JRFont categoryAxisLabelFont) { Object old = this.categoryAxisLabelFont; this.categoryAxisLabelFont = categoryAxisLabelFont; getEventSupport().firePropertyChange(PROPERTY_CATEGORY_AXIS_LABEL_FONT, old, this.categoryAxisLabelFont); }
/** * */ public void setLabelFont(JRFont labelFont) { Object old = this.labelFont; this.labelFont = labelFont; getEventSupport().firePropertyChange(PROPERTY_LABEL_FONT, old, this.labelFont); }
/** * */ public void setFont(JRFont font) { fontName = font.getOwnFontName(); isBold = font.isOwnBold(); isItalic = font.isOwnItalic(); isUnderline = font.isOwnUnderline(); isStrikeThrough = font.isOwnStrikeThrough(); fontsize = font.getOwnFontsize(); pdfFontName = font.getOwnPdfFontName(); pdfEncoding = font.getOwnPdfEncoding(); isPdfEmbedded = font.isOwnPdfEmbedded(); }
/** * */ // public String getMask(){ // return parent.getMask(); // } @Override public JRFont getFont() { return parent.getFont(); }
/** * */ public void setCategoryAxisTickLabelFont(JRFont categoryAxisTickLabelFont) { Object old = this.categoryAxisTickLabelFont; this.categoryAxisTickLabelFont = categoryAxisTickLabelFont; getEventSupport().firePropertyChange(PROPERTY_CATEGORY_AXIS_TICK_LABEL_FONT, old, this.categoryAxisTickLabelFont); }
/** * Sets the font to use when displaying the tick label. * * @param tickLabelFont the font to use when displaying the tick label */ public void setTickLabelFont(JRFont tickLabelFont) { Object old = this.tickLabelFont; this.tickLabelFont = tickLabelFont; getEventSupport().firePropertyChange(PROPERTY_TICK_LABEL_FONT, old, this.tickLabelFont); }
/** * */ public void setXAxisTickLabelFont(JRFont xAxisTickLabelFont) { Object old = this.xAxisTickLabelFont; this.xAxisTickLabelFont = xAxisTickLabelFont; getEventSupport().firePropertyChange(PROPERTY_X_AXIS_TICK_LABEL_FONT, old, this.xAxisTickLabelFont); }
/** * Sets the font to use when displaying the value. * * @param font the font to use when displaying the value */ public void setFont(JRFont font) { Object old = this.font; this.font = font; getEventSupport().firePropertyChange(PROPERTY_FONT, old, this.font); }
/** * */ public void setXAxisLabelFont(JRFont xAxisLabelFont) { Object old = this.xAxisLabelFont; this.xAxisLabelFont = xAxisLabelFont; getEventSupport().firePropertyChange(PROPERTY_X_AXIS_LABEL_FONT, old, this.xAxisLabelFont); }