[ https://issues.apache.org/jira/browse/PDFBOX-3550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15629834#comment-15629834 ]
John Hewson edited comment on PDFBOX-3550 at 11/2/16 6:04 PM: -------------------------------------------------------------- Actually there are not so many solutions; far from it. The only decent open source text shaping engine I'm aware of is Harfbuzz. The openhtmltopdf project you link to uses the [ICU shaping engine|http://userguide.icu-project.org/layoutengine], which is deprecated due to lack of features and many bugs. I do agree that we shouldn't be doing any wheel reinvention - one pragmatic option would be to use AWT's built-in text shaping (i.e. [GlyphVector|https://docs.oracle.com/javase/7/docs/api/java/awt/font/GlyphVector.html]) (but to continue to use PDFBox's native font classes for all non-shaping responsibilities, so it won't affect rendering). Better yet, the built-in shaper [will be Harfbuzz from JDK 9 onwards|https://bugs.openjdk.java.net/browse/JDK-8064530]. [~lehmi], [~msahyoun], [~tilman], should we consider exploring the AWT option further? It looks promising. was (Author: jahewson): Actually there are not so many solutions; far from it. The only decent open source text shaping engine I'm aware of is Harfbuzz. The openhtmltopdf project you link to uses the [ICU shaping engine|http://userguide.icu-project.org/layoutengine], which is deprecated due to lack of features and many bugs. I do agree that we shouldn't be doing any wheel reinvention - one pragmatic option would be to use AWT's built-in text shaping (i.e. [GlyphVector|https://docs.oracle.com/javase/7/docs/api/java/awt/font/GlyphVector.html]) (but to continue to use PDFBox's native font classes for all non-shaping responsibilities, so it won't affect rendering). Better yet, the built-in shaper [will be Harfbuzz from JDK 9 onwards|https://bugs.openjdk.java.net/browse/JDK-8064530]. [~lehmi], [~msahyoun], [~tilman], should we consider exploring the AWT option further? > OpenType Shaping > ---------------- > > Key: PDFBOX-3550 > URL: https://issues.apache.org/jira/browse/PDFBOX-3550 > Project: PDFBox > Issue Type: New Feature > Components: FontBox, PDModel > Environment: All > Reporter: Omid Pourhadi > Labels: unicode > Attachments: BYekan.ttf > > > the problem is, in some languages letters need to be joined together for > example, consider this word > {color:red} > سلام > {color} > but after creating a pdf it contorts to > {color:red} > سلام > {color} > with extra semi-spaces. I think this is a bug in pdfbox and definetly is not > related to font. > {code:title=SampleCode.java|borderStyle=solid} > public class SampleCode > { > public static void main(String[] args) throws IOException > { > > PDDocument document = new PDDocument(); > //this font perfectly works in iText and JasperReport with the same text > PDFont titleFont = PDType0Font.load(document, > SampleCode.class.getResourceAsStream("/BYekan.ttf")); > PDPage page = new PDPage(PDRectangle.A4); > document.addPage(page); > PDPageContentStream contentStream = new PDPageContentStream(document, > page); > contentStream.beginText(); > contentStream.setFont(titleFont, 12); > contentStream.newLineAtOffset(0, 100); > contentStream.showText("سلام"); > contentStream.endText(); > contentStream.close(); > > > document.save(new File("/home/omidp/temp/htmltopdf/output.pdf")); > document.close(); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org