[ https://issues.apache.org/jira/browse/FOP-2884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16938513#comment-16938513 ]
Andreas Joseph Krogh commented on FOP-2884: ------------------------------------------- I don't understand. There's no output that glyphs are missing: {code:java} 2019.09.26 13:30:08 [INFO] org.apache.fop.apps.FOUserAgent - Rendered page #1. {code} All apps I've tried on my Kubuntu-system is able to display the smiley, so I find it very strange that FOP is unable to. If I use the font "Klavika" (and specify fop to auto-lookup all fonts) I get this in the logs where it complains: {code:java} 2019.09.26 13:34:59 [INFO] org.apache.fop.apps.FopConfParser - Default page-height set to: 297mm 2019.09.26 13:34:59 [INFO] org.apache.fop.apps.FopConfParser - Default page-width set to: 210mm 2019.09.26 13:35:01 [WARN] org.apache.fop.apps.FOUserAgent - Glyph "" (0xf603) not available in font "Klavika-Regular". 2019.09.26 13:35:01 [INFO] org.apache.fop.apps.FOUserAgent - Rendered page #1. {code} How come it doesn't complain when using "Times"? I interpret the lack of warning as a sign the the font **_does_ have the glyph/smiley. Do you have a working example with a working font? > Rendering emoji doesn't work > ---------------------------- > > Key: FOP-2884 > URL: https://issues.apache.org/jira/browse/FOP-2884 > Project: FOP > Issue Type: Bug > Components: font/unqualified > Affects Versions: 2.3 > Environment: oracle-jdk-11, ubuntu Linux > Reporter: Andreas Joseph Krogh > Priority: Major > Attachments: pdf_with_smiley_test.pdf > > > The following code (in Scala, but it's easy enough to understand for > Java-devs) renders the smiley-emoji 😃 as '#'-character. > > {code:java} > import java.io.ByteArrayInputStream > import java.nio.file.{Files, Paths, StandardOpenOption} > import javax.xml.transform.sax.SAXResult > import javax.xml.transform.stream.StreamSource > import javax.xml.transform.{Result, Transformer, TransformerFactory} > import org.apache.fop.apps.{Fop, FopFactoryBuilder} > import org.apache.xmlgraphics.util.MimeConstants > import org.testng.annotations.Test > class PdfWithSmileyTest { > @Test > def generatePdfWithSmileyTets(): Unit = { > val xml = > """<?xml version="1.0" encoding="utf-8"?> > |<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> > |<fo:layout-master-set> > | <fo:simple-page-master > | margin-right="17mm" > | margin-left="17mm" > | margin-bottom="0cm" > | margin-top="14mm" > | page-width="29.1cm" > | page-height="21cm" > | master-name="document"> > | <fo:region-body margin-top="13mm" margin-bottom="20mm" > background-color="#ffffff"/> > | <fo:region-before extent="10mm" region-name="header" > background-color="#ffffff"/> > | <fo:region-after extent="15mm" region-name="footer" > background-color="#ffffff"/> > | </fo:simple-page-master> > |</fo:layout-master-set> > |<fo:page-sequence master-reference="document"> > |<fo:flow flow-name="xsl-region-body" font-family="Times"> > |<fo:block linefeed-treatment="preserve">Hi 😃 smile!</fo:block> > |</fo:flow> > |</fo:page-sequence> > |</fo:root> > |""".stripMargin > val tmpFilePath = Paths.get("/tmp/pdf_with_smiley_test.pdf") > val out = Files.newOutputStream(tmpFilePath, > StandardOpenOption.TRUNCATE_EXISTING) > val fopFactory = new > FopFactoryBuilder(getClass.getResource("/").toURI).build > val agent = fopFactory.newFOUserAgent() > val fop: Fop = fopFactory.newFop(MimeConstants.MIME_PDF, agent, out) > val transformer: Transformer = > TransformerFactory.newInstance.newTransformer > val res: Result = new SAXResult(fop.getDefaultHandler) > val source = new StreamSource(new ByteArrayInputStream(xml.getBytes())) > transformer.transform(source, res) > } > } > {code} > The output in the PDF is "Hi # smile!" instead of "Hi 😃 smile!" > -- This message was sent by Atlassian Jira (v8.3.4#803005)