Java 类net.sf.jasperreports.engine.JRFont 实例源码

项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
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;
}
项目:jasperreports    文件:SortComponentSymbolFontFactory.java   
@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);
            }
        }
}
项目:jasperreports    文件:SortComponentDigester.java   
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);
}
项目:jasperreports    文件:XlsxFontHelper.java   
/**
 *
 */
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();
}
项目:jasperreports    文件:XlsxFontInfo.java   
/**
 *
 */
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();
    }
}
项目:jasperreports    文件:JRXmlExporter.java   
/**
 *
 */
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);
    }
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
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);
}
项目:jasperreports    文件:JRXlsMetadataExporter.java   
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;
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
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);
}
项目:jasperreports    文件:StyleResolver.java   
/**
 *
 */
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);
}
项目:jasperreports    文件:JRDesignBarPlot.java   
/**
 *
 */
public void setValueAxisLabelFont(JRFont valueAxisLabelFont)
{
    Object old = this.valueAxisLabelFont;
    this.valueAxisLabelFont = valueAxisLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_LABEL_FONT, old, this.valueAxisLabelFont);
}
项目:jasperreports    文件:GenericChartTheme.java   
/**
 *
 */
protected JRFont getFont(JRFont font)
{
    if (font == null)
    {
        return new JRBaseFont(getChart());
    }
    return font;
}
项目:jasperreports    文件:JRDesignTimeSeriesPlot.java   
/**
 *
 */
public void setValueAxisTickLabelFont(JRFont valueAxisTickLabelFont)
{
    Object old = this.valueAxisTickLabelFont;
    this.valueAxisTickLabelFont = valueAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_TICK_LABEL_FONT, old, this.valueAxisTickLabelFont);
}
项目:jasperreports    文件:PlotSettings.java   
/**
 * @param tickLabelFont the tickLabelFont to set
 */
public void setTickLabelFont(JRFont tickLabelFont)
{
    JRFont old = getTickLabelFont();
    this.tickLabelFont = tickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_tickLabelFont, old, getTickLabelFont());
}
项目:jasperreports    文件:PlotSettings.java   
/**
 * @param displayFont the displayFont to set
 */
public void setDisplayFont(JRFont displayFont)
{
    JRFont old = getDisplayFont();
    this.displayFont = displayFont;
    getEventSupport().firePropertyChange(PROPERTY_displayFont, old, getDisplayFont());
}
项目:jasperreports    文件:SpiderChartXmlWriter.java   
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();
    }
}
项目:jasperreports    文件:FontUtil.java   
/**
 *
 */
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;
}
项目:jasperreports    文件:JRDesignTimeSeriesPlot.java   
/**
 *
 */
public void setTimeAxisLabelFont(JRFont timeAxisLabelFont)
{
    Object old = this.timeAxisLabelFont;
    this.timeAxisLabelFont = timeAxisLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_TIME_AXIS_LABEL_FONT, old, this.timeAxisLabelFont);
}
项目:jasperreports    文件:SortComponentSymbolFontFactory.java   
@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);
}
项目:jasperreports    文件:JRDesignChart.java   
/**
 *
 */
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);
}
项目:jasperreports    文件:JRDesignLinePlot.java   
/**
 *
 */
public void setValueAxisTickLabelFont(JRFont valueAxisTickLabelFont)
{
    Object old = this.valueAxisTickLabelFont;
    this.valueAxisTickLabelFont = valueAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_TICK_LABEL_FONT, old, this.valueAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignTimeSeriesPlot.java   
/**
 *
 */
public void setTimeAxisTickLabelFont(JRFont timeAxisTickLabelFont)
{
    Object old = this.timeAxisTickLabelFont;
    this.timeAxisTickLabelFont = timeAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_TIME_AXIS_TICK_LABEL_FONT, old, this.timeAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignTimeSeriesPlot.java   
/**
 *
 */
public void setValueAxisLabelFont(JRFont valueAxisLabelFont)
{
    Object old = this.valueAxisLabelFont;
    this.valueAxisLabelFont = valueAxisLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_LABEL_FONT, old, this.valueAxisLabelFont);
}
项目:jasperreports    文件:JRFontFactory.java   
@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);
            }
        }
    }
}
项目:jasperreports    文件:JRDesignLinePlot.java   
/**
 *
 */
public void setCategoryAxisLabelFont(JRFont categoryAxisLabelFont)
{
    Object old = this.categoryAxisLabelFont;
    this.categoryAxisLabelFont = categoryAxisLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_CATEGORY_AXIS_LABEL_FONT, old, this.categoryAxisLabelFont);
}
项目:jasperreports    文件:StandardSpiderPlot.java   
/**
 *
 */
public void setLabelFont(JRFont labelFont)
{
    Object old = this.labelFont;
    this.labelFont = labelFont;
    getEventSupport().firePropertyChange(PROPERTY_LABEL_FONT, old, this.labelFont);
}
项目:jasperreports    文件:JRBasePrintText.java   
/**
 *
 */
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();
}
项目:jasperreports    文件:JRFillItemLabel.java   
/**
     *
     */
//  public String getMask(){
//      return parent.getMask();
//  }

    @Override
    public JRFont getFont()
    {
        return parent.getFont();
    }
项目:jasperreports    文件:JRDesignCandlestickPlot.java   
/**
 *
 */
public void setValueAxisTickLabelFont(JRFont valueAxisTickLabelFont)
{
    Object old = this.valueAxisTickLabelFont;
    this.valueAxisTickLabelFont = valueAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_TICK_LABEL_FONT, old, this.valueAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignAreaPlot.java   
/**
 *
 */
public void setCategoryAxisTickLabelFont(JRFont categoryAxisTickLabelFont)
{
    Object old = this.categoryAxisTickLabelFont;
    this.categoryAxisTickLabelFont = categoryAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_CATEGORY_AXIS_TICK_LABEL_FONT, old, this.categoryAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignAreaPlot.java   
/**
 *
 */
public void setValueAxisLabelFont(JRFont valueAxisLabelFont)
{
    Object old = this.valueAxisLabelFont;
    this.valueAxisLabelFont = valueAxisLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_LABEL_FONT, old, this.valueAxisLabelFont);
}
项目:jasperreports    文件:JRDesignMeterPlot.java   
/**
 * 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);
}
项目:jasperreports    文件:JRDesignBar3DPlot.java   
/**
 *
 */
public void setValueAxisLabelFont(JRFont valueAxisLabelFont)
{
    Object old = this.valueAxisLabelFont;
    this.valueAxisLabelFont = valueAxisLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_LABEL_FONT, old, this.valueAxisLabelFont);
}
项目:jasperreports    文件:JRDesignBar3DPlot.java   
/**
 *
 */
public void setValueAxisTickLabelFont(JRFont valueAxisTickLabelFont)
{
    Object old = this.valueAxisTickLabelFont;
    this.valueAxisTickLabelFont = valueAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_VALUE_AXIS_TICK_LABEL_FONT, old, this.valueAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignBubblePlot.java   
/**
 *
 */
public void setXAxisTickLabelFont(JRFont xAxisTickLabelFont)
{
    Object old = this.xAxisTickLabelFont;
    this.xAxisTickLabelFont = xAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_X_AXIS_TICK_LABEL_FONT, old, this.xAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignHighLowPlot.java   
/**
 *
 */
public void setTimeAxisTickLabelFont(JRFont timeAxisTickLabelFont)
{
    Object old = this.timeAxisTickLabelFont;
    this.timeAxisTickLabelFont = timeAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_TIME_AXIS_TICK_LABEL_FONT, old, this.timeAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignValueDisplay.java   
/**
 * 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);
}
项目:jasperreports    文件:JRDesignScatterPlot.java   
/**
 *
 */
public void setXAxisLabelFont(JRFont xAxisLabelFont)
{
    Object old = this.xAxisLabelFont;
    this.xAxisLabelFont = xAxisLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_X_AXIS_LABEL_FONT, old, this.xAxisLabelFont);
}
项目:jasperreports    文件:JRDesignScatterPlot.java   
/**
 *
 */
public void setXAxisTickLabelFont(JRFont xAxisTickLabelFont)
{
    Object old = this.xAxisTickLabelFont;
    this.xAxisTickLabelFont = xAxisTickLabelFont;
    getEventSupport().firePropertyChange(PROPERTY_X_AXIS_TICK_LABEL_FONT, old, this.xAxisTickLabelFont);
}
项目:jasperreports    文件:JRDesignItemLabel.java   
/**
 * 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);
}