@Override public JRStyledText getFullStyledText(JRStyledTextAttributeSelector attributeSelector) { if (getFullText() == null) { return null; } return JRStyledTextParser.getInstance().getStyledText( attributeSelector.getStyledTextAttributes(this), getFullText(), !JRCommonText.MARKUP_NONE.equals(getMarkup()), JRStyledTextAttributeSelector.getTextLocale(this) ); }
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; }
/** * */ protected void exportStyledText(JRStyledText styledText, Locale locale, boolean startedHyperlink, boolean isIgnoreTextFormatting) { String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { exportStyledTextRun( iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit), locale, startedHyperlink, isIgnoreTextFormatting ); iterator.setIndex(runLimit); } }
protected AbstractPdfTextRenderer getTextRenderer(JRPrintText text, JRStyledText styledText) { AbstractPdfTextRenderer textRenderer; if (toUseGlyphRenderer(text) && PdfGlyphRenderer.supported() && canUseGlyphRendering(text, styledText)) { textRenderer = new PdfGlyphRenderer(jasperReportsContext, awtIgnoreMissingFont, glyphRendererAddActualText && !tagHelper.isTagged); } else if (text.getLeadingOffset() == 0) { textRenderer = new PdfTextRenderer(jasperReportsContext, awtIgnoreMissingFont); } else { textRenderer = new SimplePdfTextRenderer(jasperReportsContext, awtIgnoreMissingFont);//FIXMETAB optimize this } return textRenderer; }
@Override protected JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor) { JRStyledText styledText = styledTextUtil.getProcessedStyledText(textElement, setBackcolor ? allSelector : noBackcolorSelector, getExporterKey()); if (styledText != null) { short[] lineBreakOffsets = textElement.getLineBreakOffsets(); if (lineBreakOffsets != null && lineBreakOffsets.length > 0) { //insert new lines at the line break positions saved at fill time //cloning the text first //FIXME do we need this? styled text instances are no longer shared styledText = styledText.cloneText(); styledText.insert("\n", lineBreakOffsets); } } return styledText; }
/** * */ public DrawVisitor(ReportConverter reportConverter, Graphics2D grx) { this.convertVisitor = new ConvertVisitor(reportConverter); JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext(); JRReport report = reportConverter.getReport(); JRPropertiesUtil propUtil = JRPropertiesUtil.getInstance(jasperReportsContext); this.drawVisitor = new PrintDrawVisitor( jasperReportsContext, new RenderersCache(jasperReportsContext), propUtil.getBooleanProperty(report, Graphics2DReportConfiguration.MINIMIZE_PRINTER_JOB_SIZE, true), propUtil.getBooleanProperty(report, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false) ); setGraphics2D(grx); this.drawVisitor.setClip(true); }
/** * */ protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale) { String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { runHelper.export( style, iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit), locale, invalidCharReplacement ); iterator.setIndex(runLimit); } }
/** * */ protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale, boolean isStyledText) { String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { runHelper.export( style, iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit), locale, invalidCharReplacement, isStyledText ); iterator.setIndex(runLimit); } }
/** * */ protected JRStyledText getStyledText() { if (styledText == null) { String text = getRawText(); if (text != null) { styledText = filler.getStyledTextParser().getStyledText( getStyledTextAttributes(), text, !JRCommonText.MARKUP_NONE.equals(getMarkup()), filler.getLocale() ); } processedStyledText = null; } return styledText; }
protected void addContentField(int pageNo, JRPrintText element) throws IOException { String allText; JRStyledText styledText = getStyledText(element); if (styledText == null) { allText = ""; } else { allText = styledText.getText(); } if (allText != null && allText.length() > 0) { Field tf = new Field(CONTENT_FIELD, allText, fieldType); Document doc = new Document(); doc.add(new IntField("pageNo", pageNo, Field.Store.YES)); PrintElementId peid = PrintElementId.forElement(element); doc.add(new StringField("uid", peid.toString(), Field.Store.YES)); displayTokens(allText, peid.toString()); doc.add(tf); writer.addDocument(doc); } }
@Override public String getTextValue(JRCsvExporterContext exporterContext, JRGenericPrintElement element) { JRPrintText labelPrintText = (JRPrintText)element.getParameterValue(IconLabelElement.PARAMETER_LABEL_TEXT_ELEMENT); if (labelPrintText == null) { return null; } String text = null; JRStyledText styledText = ((JRCsvExporter)exporterContext.getExporterRef()).getStyledText(labelPrintText); if (styledText == null) { text = ""; } else { text = styledText.getText(); } return text; }
/** * */ public JSSDrawVisitor(ReportConverter reportConverter, Graphics2D grx) { this.reportConverter = reportConverter; this.convertVisitor = new JSSConvertVisitor(reportConverter); final JasperReportsContext jasperReportsContext = reportConverter.getJasperReportsContext(); this.drawVisitor = new PrintDrawVisitor(jasperReportsContext) { @Override public void setTextRenderer(JRReport report) { AwtTextRenderer textRenderer = new AwtTextRenderer(jasperReportsContext, JRPropertiesUtil.getInstance( jasperReportsContext).getBooleanProperty(report, JRGraphics2DExporter.MINIMIZE_PRINTER_JOB_SIZE, true), JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(report, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false)); setTextDrawer(new TextDrawer(jasperReportsContext, textRenderer)); setFrameDrawer(new FrameDrawer(jasperReportsContext, null, textRenderer)); } }; setTextRenderer(reportConverter.getReport()); this.grx = grx; setGraphics2D(grx); this.drawVisitor.setClip(true); }
/** * */ protected Phrase getPhrase(JRStyledText styledText, JRPrintText textElement) { String text = styledText.getText(); AttributedString as = styledText.getAttributedString(); return pdfExporter.getPhrase(as, text, textElement); }
protected final void setRichTextStringCellValue(JRStyledText styledText, short forecolor, JRFont defaultFont, Locale locale) { if(styledText != null) { cell.setCellValue(getRichTextString(styledText, forecolor, defaultFont, locale)); } }
/** * */ protected void exportStyledText(JRPrintText text, boolean startedHyperlink, boolean isIgnoreTextFormatting) { JRStyledText styledText = documentBuilder.getStyledText(text); if (styledText != null && styledText.length() > 0) { exportStyledText(styledText, documentBuilder.getTextLocale(text), startedHyperlink, isIgnoreTextFormatting); } }
@Override protected void initExport() { super.initExport(); PdfExporterConfiguration configuration = getCurrentConfiguration(); Boolean isTagged = configuration.isTagged(); if (isTagged != null) { tagHelper.setTagged(isTagged); } tagHelper.setLanguage(configuration.getTagLanguage()); this.permissions = getIntegerPermissions(configuration.getAllowedPermissions()) & (~getIntegerPermissions(configuration.getDeniedPermissions())); crtDocumentPageNumber = 0; awtIgnoreMissingFont = getPropertiesUtil().getBooleanProperty( JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT);//FIXMECONTEXT replace with getPropertiesUtil in all exporters glyphRendererAddActualText = propertiesUtil.getBooleanProperty( PdfReportConfiguration.PROPERTY_GLYPH_RENDERER_ADD_ACTUAL_TEXT, false); if (glyphRendererAddActualText && !tagHelper.isTagged && PdfGlyphRenderer.supported()) { minimalVersion = PdfVersionEnum.VERSION_1_5; } }
protected boolean canUseGlyphRendering(JRPrintText text, JRStyledText styledText) { Locale locale = getTextLocale(text); AttributedCharacterIterator attributesIterator = styledText.getAttributedString().getIterator(); int index = 0; while (index < styledText.length()) { FontKey fontKey = extractFontKey(attributesIterator.getAttributes(), locale); if (!fontKey.fontAttribute.hasAttribute()) { return false; } Boolean canUse = glyphRendererFonts.get(fontKey); if (canUse == null) { canUse = canUseGlyphRendering(fontKey); glyphRendererFonts.put(fontKey, canUse); } if (!canUse) { return false; } index = attributesIterator.getRunLimit(); attributesIterator.setIndex(index); } return true; }
private void addSearchAttributes(JRStyledText styledText, JRPrintText textElement) { ReportContext reportContext = getReportContext(); if (reportContext != null) { SpansInfo spansInfo = (SpansInfo) reportContext.getParameterValue("net.sf.jasperreports.search.term.highlighter"); PrintElementId pei = PrintElementId.forElement(textElement); if (spansInfo != null && spansInfo.hasHitTermsInfo(pei.toString())) { List<HitTermInfo> hitTermInfos = JRCloneUtils.cloneList(spansInfo.getHitTermsInfo(pei.toString())); short[] lineBreakOffsets = textElement.getLineBreakOffsets(); if (lineBreakOffsets != null && lineBreakOffsets.length > 0) { int sz = lineBreakOffsets.length; for (HitTermInfo ti: hitTermInfos) { for (int i = 0; i < sz; i++) { if (lineBreakOffsets[i] <= ti.getStart()) { ti.setStart(ti.getStart() + 1); ti.setEnd(ti.getEnd() + 1); } else { break; } } } } AttributedString attributedString = styledText.getAttributedString(); for (int i = 0, ln = hitTermInfos.size(); i < ln; i = i + spansInfo.getTermsPerQuery()) { attributedString.addAttribute(JRTextAttribute.SEARCH_HIGHLIGHT, Color.yellow, hitTermInfos.get(i).getStart(), hitTermInfos.get(i + spansInfo.getTermsPerQuery() - 1).getEnd()); } } } else { if (log.isDebugEnabled()) { log.debug("No ReportContext to hold search data!"); } } }
/** * @deprecated Replaced by {@link #PrintDrawVisitor(JasperReportsContext, RenderersCache, boolean, boolean)}. */ public void setTextRenderer(JRReport report) { AwtTextRenderer textRenderer = new AwtTextRenderer( jasperReportsContext, JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(report, Graphics2DReportConfiguration.MINIMIZE_PRINTER_JOB_SIZE, true), JRPropertiesUtil.getInstance(jasperReportsContext).getBooleanProperty(report, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false) ); textDrawer = new TextDrawer(jasperReportsContext, textRenderer); frameDrawer = new FrameDrawer(jasperReportsContext, null, textRenderer); }
/** * */ public void initialize(Graphics2D grx, JRPrintText text, int offsetX, int offsetY) { JRStyledText styledText = styledTextUtil.getProcessedStyledText(text, noBackcolorSelector, null); if (styledText == null) { return; } this.grx = grx; super.initialize(text, styledText, offsetX, offsetY); }
@Override protected JRStyledText getStyledText(JRPrintText textElement) { JRStyledTextAttributeSelector selector = textElement.getModeValue() == ModeEnum.OPAQUE ? allSelector : noBackcolorSelector; return textElement.getFullStyledText(selector); }
protected JRStyledText getProcessedStyledText() { if (processedStyledText == null) { JRStyledText text = getStyledText(); if (text != null) { processedStyledText = filler.getStyledTextUtil().resolveFonts(text, filler.getLocale()); } } return processedStyledText; }
/** * */ public String getText() { JRStyledText tmpStyledText = getStyledText(); if (tmpStyledText == null) { return null; } return tmpStyledText.getText(); }
@Override public boolean start(JRStyledText styledText) { globalAttributes = styledText.getGlobalAttributes(); allParagraphs = styledText.getAwtAttributedString(context.getJasperReportsContext(), context.isIgnoreMissingFont()).getIterator(); return true; }
/** * */ public TextMeasurer(JasperReportsContext jasperReportsContext, JRCommonText textElement) { this.jasperReportsContext = jasperReportsContext; this.textElement = textElement; this.propertiesHolder = textElement instanceof JRPropertiesHolder ? (JRPropertiesHolder) textElement : null;//FIXMENOW all elements are now properties holders, so interfaces might be rearranged if (textElement.getDefaultStyleProvider() instanceof JRPropertiesHolder) { this.propertiesHolder = new DelegatePropertiesHolder( propertiesHolder, (JRPropertiesHolder)textElement.getDefaultStyleProvider() ); } if (textElement instanceof DynamicPropertiesHolder) { this.dynamicPropertiesHolder = (DynamicPropertiesHolder) textElement; // we can check this from the beginning this.hasDynamicIgnoreMissingFontProp = this.dynamicPropertiesHolder.hasDynamicProperty( JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT); this.hasDynamicSaveLineBreakOffsetsProp = this.dynamicPropertiesHolder.hasDynamicProperty( JRTextElement.PROPERTY_SAVE_LINE_BREAKS); } // read static property values JRPropertiesUtil propertiesUtil = JRPropertiesUtil.getInstance(jasperReportsContext); defaultIgnoreMissingFont = propertiesUtil.getBooleanProperty(propertiesHolder, JRStyledText.PROPERTY_AWT_IGNORE_MISSING_FONT, false); defaultSaveLineBreakOffsets = propertiesUtil.getBooleanProperty(propertiesHolder, JRTextElement.PROPERTY_SAVE_LINE_BREAKS, false); Context measureContext = new Context(); simpleLineWrapper = new SimpleTextLineWrapper(); simpleLineWrapper.init(measureContext); complextLineWrapper = new ComplexTextLineWrapper(); complextLineWrapper.init(measureContext); }
/** * */ protected JRStyledText getStyledText(JRPrintText textElement, boolean setBackcolor) { return styledTextUtil.getStyledText(textElement, setBackcolor ? allSelector : noBackcolorSelector); }
protected JRStyledText getStyledText(JRPrintText textElement) { return getStyledText(textElement, true); }
@Override public void exportText(JRPrintText textElement, JRExporterGridCell gridCell, int colIndex, int rowIndex) throws JRException { JRStyledText styledText = getStyledText(textElement); if (styledText == null) { return; } short forecolor = getWorkbookColor(textElement.getForecolor()).getIndex(); TextAlignHolder textAlignHolder = getTextAlignHolder(textElement); HorizontalAlignment horizontalAlignment = getHorizontalAlignment(textAlignHolder); VerticalAlignment verticalAlignment = getVerticalAlignment(textAlignHolder); short rotation = getRotation(textAlignHolder); FillPatternType mode = backgroundMode; short backcolor = whiteIndex; if (!Boolean.TRUE.equals(sheetInfo.ignoreCellBackground) && gridCell.getCellBackcolor() != null) { mode = FillPatternType.SOLID_FOREGROUND; backcolor = getWorkbookColor(gridCell.getCellBackcolor()).getIndex(); } StyleInfo baseStyle = isIgnoreTextFormatting(textElement) ? new StyleInfo( mode, whiteIndex, horizontalAlignment, verticalAlignment, (short)0, null, (JRExporterGridCell)null, isWrapText(textElement) || Boolean.TRUE.equals(((JRXlsExporterNature)nature).getColumnAutoFit(textElement)), isCellLocked(textElement), isCellHidden(textElement), isShrinkToFit(textElement) ) : new StyleInfo( mode, backcolor, horizontalAlignment, verticalAlignment, rotation, getLoadedFont(textElement, forecolor, null, getTextLocale(textElement)), gridCell, isWrapText(textElement) || Boolean.TRUE.equals(((JRXlsExporterNature)nature).getColumnAutoFit(textElement)), isCellLocked(textElement), isCellHidden(textElement), isShrinkToFit(textElement) ); createTextCell(textElement, gridCell, colIndex, rowIndex, styledText, baseStyle, forecolor); }
@Override public JRStyledText getStyledText(JRPrintText text) { return JROdtExporter.this.getStyledText(text); }
@Override public JRStyledText getStyledText(JRPrintText text) { return JROdsExporter.this.getStyledText(text); }
@Override protected void exportTextContents(JRPrintText textElement) { String href = null; String ignLnkPropName = getIgnoreHyperlinkProperty(); Boolean ignoreHyperlink = HyperlinkUtil.getIgnoreHyperlink(ignLnkPropName, textElement); boolean isIgnoreTextFormatting = isIgnoreTextFormatting(textElement); if (ignoreHyperlink == null) { ignoreHyperlink = getPropertiesUtil().getBooleanProperty(jasperPrint, ignLnkPropName, false); } if (!ignoreHyperlink) { href = documentBuilder.getHyperlinkURL(textElement, getCurrentItemConfiguration().isOnePagePerSheet()); } if (href == null) { exportStyledText(textElement, false, isIgnoreTextFormatting); } else { JRStyledText styledText = getStyledText(textElement); if (styledText != null && styledText.length() > 0) { String text = styledText.getText(); Locale locale = getTextLocale(textElement); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { // ODS does not like text:span inside text:a // writing one text:a inside text:span for each style run String runText = text.substring(iterator.getIndex(), runLimit); startTextSpan( iterator.getAttributes(), runText, locale, isIgnoreTextFormatting); writeHyperlink(textElement, href, true); writeText(runText); endHyperlink(true); endTextSpan(); iterator.setIndex(runLimit); } } } }
@Override protected JRStyledText getStyledText(JRPrintText textElement) { return textElement.getFullStyledText(noneSelector); }
protected void exportStyledText(JRPrintText printText, JRStyledText styledText, String tooltip, boolean hyperlinkStarted) throws IOException { Locale locale = getTextLocale(printText); LineSpacingEnum lineSpacing = printText.getParagraph().getLineSpacing(); Float lineSpacingSize = printText.getParagraph().getLineSpacingSize(); float lineSpacingFactor = printText.getLineSpacingFactor(); Color backcolor = printText.getBackcolor(); String text = styledText.getText(); int runLimit = 0; addSearchAttributes(styledText, printText); AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); boolean first = true; boolean startedSpan = false; boolean highlightStarted = false; while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { //if there are several text runs, write the tooltip into a parent <span> if (first && runLimit < styledText.length() && tooltip != null) { startedSpan = true; writer.write("<span title=\""); writer.write(JRStringUtil.xmlEncode(tooltip)); writer.write("\">"); //reset the tooltip so that inner <span>s to not use it tooltip = null; } first = false; Map<Attribute,Object> attributes = iterator.getAttributes(); Color highlightColor = (Color) attributes.get(JRTextAttribute.SEARCH_HIGHLIGHT); if (highlightColor != null && !highlightStarted) { highlightStarted = true; writer.write("<span class=\"jr_search_result\">"); } else if (highlightColor == null && highlightStarted) { highlightStarted = false; writer.write("</span>"); } exportStyledTextRun( attributes, text.substring(iterator.getIndex(), runLimit), tooltip, locale, lineSpacing, lineSpacingSize, lineSpacingFactor, backcolor, hyperlinkStarted ); iterator.setIndex(runLimit); } if (highlightStarted) { writer.write("</span>"); } if (startedSpan) { writer.write("</span>"); } }
/** * */ public JRStyledText getStyledText() { return styledText; }
@Override public void draw(Graphics2D grx, JRPrintText text, int offsetX, int offsetY) { textRenderer.initialize(grx, text, offsetX, offsetY); JRStyledText styledText = textRenderer.getStyledText(); if (styledText == null) { return; } double angle = 0; switch (text.getRotationValue()) { case LEFT : { angle = - Math.PI / 2; break; } case RIGHT : { angle = Math.PI / 2; break; } case UPSIDE_DOWN : { angle = Math.PI; break; } case NONE : default : { } } grx.rotate(angle, textRenderer.getX(), textRenderer.getY()); if (text.getModeValue() == ModeEnum.OPAQUE) { grx.setColor(text.getBackcolor()); grx.fillRect(textRenderer.getX(), textRenderer.getY(), textRenderer.getWidth(), textRenderer.getHeight()); } // else // { // /* // grx.setColor(text.getForecolor()); // grx.setStroke(new BasicStroke(1)); // grx.drawRect(x, y, width, height); // */ // } String allText = textRenderer.getPlainText(); if (allText.length() > 0) { grx.setColor(text.getForecolor()); /* */ textRenderer.render(); } grx.rotate(-angle, textRenderer.getX(), textRenderer.getY()); /* */ drawBox(grx, text.getLineBox(), text, offsetX, offsetY); }
/** * */ public void exportText(DocxTableHelper tableHelper, JRPrintText text, JRExporterGridCell gridCell) { tableHelper.getCellHelper().exportHeader(text, gridCell); JRStyledText styledText = getStyledText(text); int textLength = 0; if (styledText != null) { textLength = styledText.length(); } // if (styleBuffer.length() > 0) // { // writer.write(" style=\""); // writer.write(styleBuffer.toString()); // writer.write("\""); // } // // writer.write(">"); docHelper.write(" <w:p>\n"); tableHelper.getParagraphHelper().exportProps(text); if (startPage) { insertBookmark(pageAnchor, docHelper); } if (text.getAnchorName() != null) { insertBookmark(text.getAnchorName(), docHelper); } boolean startedHyperlink = startHyperlink(text, true); boolean isNewLineAsParagraph = false; if (HorizontalTextAlignEnum.JUSTIFIED.equals(text.getHorizontalTextAlign())) { if (text.hasProperties() && text.getPropertiesMap().containsProperty(DocxReportConfiguration.PROPERTY_NEW_LINE_AS_PARAGRAPH)) { isNewLineAsParagraph = getPropertiesUtil().getBooleanProperty(text, DocxReportConfiguration.PROPERTY_NEW_LINE_AS_PARAGRAPH, false); } else { isNewLineAsParagraph = getCurrentItemConfiguration().isNewLineAsParagraph(); } } if (textLength > 0) { exportStyledText( getCurrentJasperPrint().getDefaultStyleProvider().getStyleResolver().getBaseStyle(text), styledText, getTextLocale(text), getPropertiesUtil().getBooleanProperty(text, PROPERTY_HIDDEN_TEXT, false), startedHyperlink, isNewLineAsParagraph ); } if (startedHyperlink) { endHyperlink(true); } docHelper.write(" </w:p>\n"); tableHelper.getCellHelper().exportFooter(); }
/** * */ protected void exportStyledText(JRStyle style, JRStyledText styledText, Locale locale, boolean hiddenText, boolean startedHyperlink, boolean isNewLineJustified) { Color elementBackcolor = null; Map<AttributedCharacterIterator.Attribute, Object> globalAttributes = styledText.getGlobalAttributes(); if (globalAttributes != null) { elementBackcolor = (Color)styledText.getGlobalAttributes().get(TextAttribute.BACKGROUND); } String text = styledText.getText(); int runLimit = 0; AttributedCharacterIterator iterator = styledText.getAttributedString().getIterator(); while(runLimit < styledText.length() && (runLimit = iterator.getRunLimit()) <= styledText.length()) { Map<Attribute,Object> attributes = iterator.getAttributes(); boolean localHyperlink = false; if (!startedHyperlink) { JRPrintHyperlink hyperlink = (JRPrintHyperlink)attributes.get(JRTextAttribute.HYPERLINK); if (hyperlink != null) { localHyperlink = startHyperlink(hyperlink, true); } } runHelper.export( style, iterator.getAttributes(), text.substring(iterator.getIndex(), runLimit), locale, hiddenText, invalidCharReplacement, elementBackcolor, isNewLineJustified ); if (localHyperlink) { endHyperlink(true); } iterator.setIndex(runLimit); } }