com.lowagie.text.Font Java Examples
The following examples show how to use
com.lowagie.text.Font.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RtfFont.java From itext2 with GNU Lesser General Public License v3.0 | 8 votes |
/** * Sets the correct font name from the family name. * * @param familyname The family name to set the name to. */ private void setToDefaultFamily(String familyname){ switch (Font.getFamilyIndex(familyname)) { case Font.COURIER: this.fontName = "Courier"; break; case Font.HELVETICA: this.fontName = "Arial"; break; case Font.SYMBOL: this.fontName = "Symbol"; this.charset = 2; break; case Font.TIMES_ROMAN: this.fontName = "Times New Roman"; break; case Font.ZAPFDINGBATS: this.fontName = "Windings"; break; default: this.fontName = familyname; } }
Example #2
Source File: PdfOutline.java From MesquiteCore with GNU Lesser General Public License v3.0 | 6 votes |
/** * Returns the PDF representation of this <CODE>PdfOutline</CODE>. * * @param writer the encryption information * @param os * @throws IOException */ public void toPdf(PdfWriter writer, OutputStream os) throws IOException { if (color != null && !color.equals(Color.black)) { put(PdfName.C, new PdfArray(new float[]{color.getRed()/255f,color.getGreen()/255f,color.getBlue()/255f})); } int flag = 0; if ((style & Font.BOLD) != 0) flag |= 2; if ((style & Font.ITALIC) != 0) flag |= 1; if (flag != 0) put(PdfName.F, new PdfNumber(flag)); if (parent != null) { put(PdfName.PARENT, parent.indirectReference()); } if (destination != null && destination.hasPage()) { put(PdfName.DEST, destination); } if (action != null) put(PdfName.A, action); if (count != 0) { put(PdfName.COUNT, new PdfNumber(count)); } super.toPdf(writer, os); }
Example #3
Source File: ExtendedFontTest.java From itext2 with GNU Lesser General Public License v3.0 | 6 votes |
/** * Extended font example. * * */ @Test public void main() throws Exception { Document document = new Document(); RtfWriter2.getInstance(document, PdfTestBase.getOutputStream("ExtendedFont.rtf")); document.open(); // Create a RtfFont with the desired font name. RtfFont msComicSans = new RtfFont("Comic Sans MS"); // Use the RtfFont like any other Font. document.add(new Paragraph("This paragraph uses the" + " Comic Sans MS font.", msComicSans)); // Font size, font style and font colour can also be specified. RtfFont bigBoldGreenArial = new RtfFont("Arial", 36, Font.BOLD, Color.GREEN); document.add(new Paragraph("This is a really big bold green Arial text", bigBoldGreenArial)); document.close(); }
Example #4
Source File: TableBordersTest.java From itext2 with GNU Lesser General Public License v3.0 | 6 votes |
private static PdfPCell makeCell(String text, int vAlignment, int hAlignment, Font font, float leading, float padding, Rectangle borders, boolean ascender, boolean descender) { Paragraph p = new Paragraph(text, font); p.setLeading(leading); PdfPCell cell = new PdfPCell(p); cell.setLeading(leading, 0); cell.setVerticalAlignment(vAlignment); cell.setHorizontalAlignment(hAlignment); cell.cloneNonPositionParameters(borders); cell.setUseAscender(ascender); cell.setUseDescender(descender); cell.setUseBorderPadding(true); cell.setPadding(padding); return cell; }
Example #5
Source File: FixedFontWidthTest.java From itext2 with GNU Lesser General Public License v3.0 | 6 votes |
/** * Changing the width of font glyphs. * * @param args * no arguments needed */ @Test public void main() throws Exception { // step 1 Document document = new Document(PageSize.A4, 50, 50, 50, 50); // step 2 PdfWriter.getInstance(document, PdfTestBase.getOutputStream("fixedfontwidth.pdf")); // step 3 document.open(); // step 4 BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false, false, null, null); int widths[] = bf.getWidths(); for (int k = 0; k < widths.length; ++k) { if (widths[k] != 0) widths[k] = 1000; } bf.setForceWidthsOutput(true); document.add(new Paragraph("A big text to show Helvetica with fixed width.", new Font(bf))); // step 5 document.close(); }
Example #6
Source File: DefaultPdfDataEntryFormService.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void insertTable_TextRow( PdfWriter writer, PdfPTable mainTable, String text, Font font ) { boolean hasBorder = false; // Add Organization ID/Period textfield // Create A table to add for each group AT HERE PdfPTable table = new PdfPTable( 1 ); table.setHorizontalAlignment( Element.ALIGN_LEFT ); addCell_Text( table, PdfDataEntryFormUtil.getPdfPCell( hasBorder ), text, Element.ALIGN_LEFT, font ); // Add to the main table PdfPCell cell_withInnerTable = new PdfPCell( table ); cell_withInnerTable.setBorder( Rectangle.NO_BORDER ); mainTable.addCell( cell_withInnerTable ); }
Example #7
Source File: JRPdfExporter.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
protected void writePageAnchor(int pageIndex) throws DocumentException { Map<Attribute,Object> attributes = new HashMap<Attribute,Object>(); fontUtil.getAttributesWithoutAwtFont(attributes, new JRBasePrintText(jasperPrint.getDefaultStyleProvider())); Font pdfFont = getFont(attributes, getLocale(), false); Chunk chunk = new Chunk(" ", pdfFont); chunk.setLocalDestination(JR_PAGE_ANCHOR_PREFIX + reportIndex + "_" + (pageIndex + 1)); tagHelper.startPageAnchor(); ColumnText colText = new ColumnText(pdfContentByte); colText.setSimpleColumn( new Phrase(chunk), 0, pageFormat.getPageHeight(), 1, 1, 0, Element.ALIGN_LEFT ); colText.go(); tagHelper.endPageAnchor(); }
Example #8
Source File: DocExportUtil.java From DWSurvey with GNU Affero General Public License v3.0 | 6 votes |
public void createDoc() throws FileNotFoundException{ /** 创建Document对象(word文档) */ Rectangle rectPageSize = new Rectangle(PageSize.A4); rectPageSize = rectPageSize.rotate(); // 创建word文档,并设置纸张的大小 doc = new Document(PageSize.A4); file=new File(path+docFileName); fileOutputStream=new FileOutputStream(file); /** 建立一个书写器与document对象关联,通过书写器可以将文档写入到输出流中 */ RtfWriter2.getInstance(doc, fileOutputStream ); doc.open(); //设置页边距,上、下25.4毫米,即为72f,左、右31.8毫米,即为90f doc.setMargins(90f, 90f, 72f, 72f); //设置标题字体样式,粗体、二号、华文中宋 tfont = DocStyleUtils.setFontStyle("华文中宋", 22f, Font.BOLD); //设置正文内容的字体样式,常规、三号、仿宋_GB2312 bfont = DocStyleUtils.setFontStyle("仿宋_GB2312", 16f, Font.NORMAL); }
Example #9
Source File: ContractsGrantsInvoiceReportServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
/** * Generates a PDF paragraph for a given Address * @param name the name that this envelope is being sent to * @param line1Address the first line of the address * @param line2Address the second line of the address * @param cityName the name of the city to send this to * @param stateCode the code of the state or presumably province to send this to * @param postalCode the postal code/zip code to send the enveleope to * @param font the font to write in * @return a PDF Paragraph for the address */ protected Paragraph generateAddressParagraph(String name, String line1Address, String line2Address, String cityName, String stateCode, String postalCode, Font font) { Paragraph addressParagraph = new Paragraph(); addressParagraph.add(new Paragraph(name, font)); if (!StringUtils.isBlank(line1Address)) { addressParagraph.add(new Paragraph(line1Address, font)); } if (!StringUtils.isBlank(line2Address)) { addressParagraph.add(new Paragraph(line2Address, font)); } String string = ""; if (!StringUtils.isBlank(cityName)) { string += cityName; } if (!StringUtils.isBlank(stateCode)) { string += ", " + stateCode; } if (!StringUtils.isBlank(postalCode)) { string += "-" + postalCode; } if (!StringUtils.isBlank(string)) { addressParagraph.add(new Paragraph(string, font)); } return addressParagraph; }
Example #10
Source File: PdfWebTable.java From unitime with Apache License 2.0 | 6 votes |
private float addText(PdfPCell cell, String text, boolean bold, boolean italic, boolean underline, Color color, Color bgColor) { Font font = PdfFont.getFont(bold, italic, underline, color); Chunk chunk = new Chunk(text, font); if (bgColor!=null) chunk.setBackground(bgColor); if (cell.getPhrase()==null) { cell.setPhrase(new Paragraph(chunk)); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_CENTER); } else { cell.getPhrase().add(chunk); } float width = 0; if (text.indexOf('\n')>=0) { for (StringTokenizer s = new StringTokenizer(text,"\n"); s.hasMoreTokens();) width = Math.max(width,font.getBaseFont().getWidthPoint(s.nextToken(), font.getSize())); } else width = Math.max(width,font.getBaseFont().getWidthPoint(text, font.getSize())); return width; }
Example #11
Source File: CustomerLoadServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
protected void writeCustomerSectionResult(Document pdfDoc, String resultLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); paragraph.add(new Chunk(resultLine, font)); // blank line paragraph.add(new Chunk("", font)); try { pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
Example #12
Source File: CustomerInvoiceWriteoffBatchServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
protected void writeInvoiceSectionTitle(com.lowagie.text.Document pdfDoc, String customerNameLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 8, Font.BOLD + Font.UNDERLINE); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(com.lowagie.text.Element.ALIGN_LEFT); paragraph.add(new Chunk(customerNameLine, font)); // blank line paragraph.add(new Chunk("", font)); try { pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
Example #13
Source File: CustomerLoadServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
protected void writeFileNameSectionTitle(Document pdfDoc, String filenameLine) { Font font = FontFactory.getFont(FontFactory.COURIER, 10, Font.BOLD); Paragraph paragraph = new Paragraph(); paragraph.setAlignment(Element.ALIGN_LEFT); Chunk chunk = new Chunk(filenameLine, font); chunk.setBackground(Color.LIGHT_GRAY, 5, 5, 5, 5); paragraph.add(chunk); // blank line paragraph.add(new Chunk("", font)); try { pdfDoc.add(paragraph); } catch (DocumentException e) { LOG.error("iText DocumentException thrown when trying to write content.", e); throw new RuntimeException("iText DocumentException thrown when trying to write content.", e); } }
Example #14
Source File: OpenTypeFontTest.java From itext2 with GNU Lesser General Public License v3.0 | 6 votes |
/** * Using oth */ @Test public void main() throws Exception { // step 1 Document document = new Document(PageSize.A4, 50, 50, 50, 50); // step 2 PdfWriter.getInstance(document, PdfTestBase.getOutputStream("opentypefont.pdf")); // step 3 document.open(); // step 4 BaseFont bf = BaseFont.createFont(PdfTestBase.RESOURCES_DIR + "liz.otf", BaseFont.CP1252, true); String text = "Some text with the otf font LIZ."; document.add(new Paragraph(text, new Font(bf, 14))); // step 5 document.close(); }
Example #15
Source File: DefaultPdfDataEntryFormService.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void addCell_Text( PdfPTable table, PdfPCell cell, String text, int horizontalAlignment, Font font ) { cell.setHorizontalAlignment( horizontalAlignment ); cell.setPhrase( new Phrase( text, font ) ); table.addCell( cell ); // TODO: change this with cellEvent? }
Example #16
Source File: StandardType1FontsTest.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** * Generates a PDF file with the 14 standard Type 1 Fonts * */ @Test public void main() throws Exception { // step 1: creation of a document-object Document document = new Document(); // step 2: // we create a writer that listens to the document PdfWriter.getInstance(document, PdfTestBase.getOutputStream("StandardType1Fonts.pdf")); // step 3: we open the document document.open(); // step 4: // the 14 standard fonts in PDF: do not use this Font constructor! // this is for demonstration purposes only, use FontFactory! Font[] fonts = new Font[14]; fonts[0] = new Font(Font.COURIER, Font.DEFAULTSIZE, Font.NORMAL); fonts[1] = new Font(Font.COURIER, Font.DEFAULTSIZE, Font.ITALIC); fonts[2] = new Font(Font.COURIER, Font.DEFAULTSIZE, Font.BOLD); fonts[3] = new Font(Font.COURIER, Font.DEFAULTSIZE, Font.BOLD | Font.ITALIC); fonts[4] = new Font(Font.HELVETICA, Font.DEFAULTSIZE, Font.NORMAL); fonts[5] = new Font(Font.HELVETICA, Font.DEFAULTSIZE, Font.ITALIC); fonts[6] = new Font(Font.HELVETICA, Font.DEFAULTSIZE, Font.BOLD); fonts[7] = new Font(Font.HELVETICA, Font.DEFAULTSIZE, Font.BOLDITALIC); fonts[8] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL); fonts[9] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.ITALIC); fonts[10] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD); fonts[11] = new Font(Font.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC); fonts[12] = new Font(Font.SYMBOL); fonts[13] = new Font(Font.ZAPFDINGBATS); // add the content for (int i = 0; i < 14; i++) { document.add(new Paragraph("quick brown fox jumps over the lazy dog", fonts[i])); } // step 5: we close the document document.close(); }
Example #17
Source File: MultiColumnR2LTest.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** * An example using MultiColumnText with irregular columns. */ @Test public void main() throws Exception { Document document = new Document(); OutputStream out = PdfTestBase.getOutputStream("multicolumnR2L.pdf"); PdfWriter.getInstance(document, out); document.open(); MultiColumnText mct = new MultiColumnText(); mct.setColumnsRightToLeft(true); // set up 3 even columns with 10pt space between mct.addRegularColumns(document.left(), document.right(), 10f, 3); // Write some iText poems for (int i = 0; i < 30; i++) { mct.addElement(new Paragraph(String.valueOf(i + 1))); mct.addElement(newPara(randomWord(noun), Element.ALIGN_CENTER, Font.BOLDITALIC)); for (int j = 0; j < 4; j++) { mct.addElement(newPara(poemLine(), Element.ALIGN_LEFT, Font.NORMAL)); } mct.addElement(newPara(randomWord(adverb), Element.ALIGN_LEFT, Font.NORMAL)); mct.addElement(newPara("\n\n", Element.ALIGN_LEFT, Font.NORMAL)); } document.add(mct); document.close(); }
Example #18
Source File: FontInfo.java From birt with Eclipse Public License 1.0 | 5 votes |
public int getItalicAdjust( ) { // get width for text with simulated italic font. if ( simulation && ( Font.ITALIC == fontStyle || Font.BOLDITALIC == fontStyle ) ) { return (int) ( fontHeight * EmitterUtil.getItalicHorizontalCoefficient( ) ); } return 0; }
Example #19
Source File: InvestmentSummaryController.java From primefaces-blueprints with The Unlicense | 5 votes |
public void postProcessPDF(Object document) throws IOException, BadElementException, DocumentException { Document pdf = (Document) document; pdf.add( Chunk.NEWLINE ); Font fontbold = FontFactory.getFont("Times-Roman", 14, Font.BOLD); pdf.add(new Paragraph("Disclaimer",fontbold)); pdf.add( Chunk.NEWLINE ); pdf.add(new Paragraph("The information contained in this website is for information purposes only, and does not constitute, nor is it intended to constitute, the provision of financial product advice.")); pdf.add(new Paragraph("This website is intended to track the investor account summary information,investments and transaction in a partcular period of time. ")); }
Example #20
Source File: PDFPrinter.java From unitime with Apache License 2.0 | 5 votes |
@Override public void printHeader(String... fields) { iTable = new PdfPTable(fields.length - iHiddenColumns.size()); iMaxWidth = new float[fields.length]; iTable.setHeaderRows(1); iTable.setWidthPercentage(100); for (int idx = 0; idx < fields.length; idx++) { if (iHiddenColumns.contains(idx)) continue; String f = fields[idx]; PdfPCell cell = new PdfPCell(); cell.setBorder(Rectangle.BOTTOM); cell.setVerticalAlignment(Element.ALIGN_TOP); cell.setHorizontalAlignment(Element.ALIGN_LEFT); Font font = PdfFont.getFont(true); Paragraph ch = new Paragraph(f, font); ch.setLeading(0f, 1f); cell.addElement(ch); iTable.addCell(cell); float width = 0; if (f.indexOf('\n')>=0) { for (StringTokenizer s = new StringTokenizer(f,"\n"); s.hasMoreTokens();) width = Math.max(width,font.getBaseFont().getWidthPoint(s.nextToken(), font.getSize())); } else width = Math.max(width,font.getBaseFont().getWidthPoint(f, font.getSize())); iMaxWidth[idx] = width; } }
Example #21
Source File: RtfListLevel.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
public RtfListLevel(RtfDocument doc, RtfList parent) { super(doc); this.parent = parent; templateID = document.getRandomInt(); setFontNumber( new RtfFont(document, new Font(Font.TIMES_ROMAN, 10, Font.NORMAL, new Color(0, 0, 0)))); setBulletFont(new Font(Font.SYMBOL, 10, Font.NORMAL, new Color(0, 0, 0))); }
Example #22
Source File: FontHandler.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * If the BaseFont can NOT find the correct physical glyph, we need to * simulate the proper style for the font. The "simulate" flag will be set * if we need to simulate it. */ private boolean needSimulate( BaseFont font ) { if ( fontStyle == Font.NORMAL ) { return false; } String[][] fullNames = bf.getFullFontName( ); String fullName = getEnglishName( fullNames ); String lcf = fullName.toLowerCase( ); int fs = Font.NORMAL; if ( lcf.indexOf( "bold" ) != -1 ) { fs |= Font.BOLD; } if ( lcf.indexOf( "italic" ) != -1 || lcf.indexOf( "oblique" ) != -1 ) { fs |= Font.ITALIC; } if ( ( fontStyle & Font.BOLDITALIC ) == fs ) { if ( fontWeight > 400 && fontWeight != 700 ) { // not a regular bold font. return true; } else { return false; } } return true; }
Example #23
Source File: CounterRequestUsagesPanel.java From javamelody with Apache License 2.0 | 5 votes |
CounterRequestUsagesPanel(RemoteCollector remoteCollector, CounterRequest request) { super(remoteCollector); final String graphLabel = truncate(getString("Utilisations_de") + ' ' + request.getName(), 50); setName(graphLabel); final JLabel label = new JLabel( ' ' + getString("Utilisations_de") + ' ' + request.getName()); label.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0)); label.setFont(label.getFont().deriveFont(Font.BOLD)); add(label, BorderLayout.NORTH); final MTableScrollPane<CounterRequest> scrollPane = createScrollPane(); final List<CounterRequest> requests = new ArrayList<>(); for (final Counter counter : getCounters()) { for (final CounterRequest counterRequest : counter.getOrderedRequests()) { if (counterRequest.containsChildRequest(request.getId())) { requests.add(counterRequest); } } } getTable().setList(requests); add(scrollPane, BorderLayout.CENTER); add(createButtonsPanel(true), BorderLayout.SOUTH); }
Example #24
Source File: PdfFormFontSettings.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
private Font createFont( int fontType ) { Font font = new Font(); font.setFamily( FONTFAMILY ); switch ( fontType ) { case FONTTYPE_BODY: font.setSize( FONTSIZE_BODY ); font.setColor( Color.BLACK ); break; case FONTTYPE_TITLE: font.setSize( FONTSIZE_TITLE ); font.setStyle( java.awt.Font.BOLD ); font.setColor( new Color( 0, 0, 128 ) ); // Navy Color break; case FONTTYPE_DESCRIPTION: font.setSize( FONTSIZE_DESCRIPTION ); font.setColor( Color.DARK_GRAY ); break; case FONTTYPE_SECTIONHEADER: font.setSize( FONTSIZE_SECTIONHEADER ); font.setStyle( java.awt.Font.BOLD ); font.setColor( new Color( 70, 130, 180 ) ); // Steel Blue Color break; case FONTTYPE_FOOTER: font.setSize( FONTSIZE_FOOTER ); break; default: font.setSize( FONTSIZE_BODY ); break; } return font; }
Example #25
Source File: RtfTOCEntry.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** * Constructs a RtfTOCEntry with a certain entry text. * * @param entry The entry text to display */ public RtfTOCEntry(String entry) { super(null, new Font()); if(entry != null) { this.entry = entry; } }
Example #26
Source File: AccountSummaryController.java From primefaces-blueprints with The Unlicense | 5 votes |
public void postProcessPDF(Object document) throws IOException, BadElementException, DocumentException { Document pdf = (Document) document; pdf.add( Chunk.NEWLINE ); Font fontbold = FontFactory.getFont("Times-Roman", 14, Font.BOLD); pdf.add(new Paragraph("Disclaimer",fontbold)); pdf.add( Chunk.NEWLINE ); pdf.add(new Paragraph("The information contained in this website is for information purposes only, and does not constitute, nor is it intended to constitute, the provision of financial product advice.")); pdf.add(new Paragraph("This website is intended to track the investor account summary information,investments and transaction in a partcular period of time. ")); }
Example #27
Source File: HtmlWriter.java From itext2 with GNU Lesser General Public License v3.0 | 5 votes |
/** * Checks if a given font is the same as the font that was last used. * * @param font the font of an object * @return true if the font differs */ public boolean isOtherFont(Font font) { try { Font cFont = (Font) currentfont.peek(); if (cFont.compareTo(font) == 0) return false; return true; } catch(EmptyStackException ese) { if (standardfont.compareTo(font) == 0) return false; return true; } }
Example #28
Source File: ItextPDFWatermarkWriter.java From website with GNU Affero General Public License v3.0 | 5 votes |
public void addLineText(Font font, String text) { PDFLineText lineText = new PDFLineText(); lineText.setFont(font); //lineText.setFontSize(fontSize); lineText.setText(text); addLineText(lineText); }
Example #29
Source File: Coversheet.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * Helper method to create a Header Cell from text * * @returns {@link Cell} with the header flag set */ protected Cell getHeaderCell(final String text) throws BadElementException { final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD); final Cell retval = new Cell(new Chunk(text, headerFont)); retval.setBorder(NO_BORDER); retval.setHeader(true); return retval; }
Example #30
Source File: FontConfigReaderTest.java From birt with Eclipse Public License 1.0 | 5 votes |
private boolean isMappedTo( char c, String from, String to ) { FontHandler handler = new FontHandler( fontMappingManager, new String[]{from}, Font.NORMAL, true ); BaseFont font = handler.getMappedFont( c ); return hasName( font, to ); }