You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2022/07/05 07:01:00 UTC

[jira] [Commented] (PDFBOX-5473) Can't get the family font name of the specified font.

    [ https://issues.apache.org/jira/browse/PDFBOX-5473?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17562398#comment-17562398 ] 

Tilman Hausherr commented on PDFBOX-5473:
-----------------------------------------

That's because it isn't in the font in the unicode platformid, which is the only one we consider.

> Can't get the family font name of the specified font.
> -----------------------------------------------------
>
>                 Key: PDFBOX-5473
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5473
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.24
>            Reporter: bai yuan
>            Priority: Major
>         Attachments: 현대하모니 L.ttf
>
>
> Run the following code, you will see the family name of this font is null.
> {code:java}
> System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");  
> PDDocument doc = new PDDocument();
> PDPage page = new PDPage(PDRectangle.A4);
> doc.addPage(page);
> PDPageContentStream contentStream = new PDPageContentStream(doc, page);        TrueTypeFont ttFont = new TTFParser().parse(new File("현대하모니 L.ttf"));
> PDFont font = PDType0Font.load(doc, ttFont, true);        
> String name = ttFont.getNaming().getFontFamily();
> contentStream.beginText();
> contentStream.newLineAtOffset(50, 800);
> contentStream.setFont(font, 48);
> contentStream.showText("abc");
> contentStream.endText();       
> contentStream.close();
> doc.save("pdfbox.pdf");
> doc.close();
> System.out.println(name); {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org