You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Philip Helger (Jira)" <ji...@apache.org> on 2026/09/30 12:43:00 UTC

[jira] [Comment Edited] (PDFBOX-6169) Request to make PDFont.encode public

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

Philip Helger edited comment on PDFBOX-6169 at 9/30/26 12:42 PM:
-----------------------------------------------------------------

We encode text one code point at a time and cache the result per font.

When a code point can't be encoded, we swap in a fallback character instead of failing the whole string.

The public {{encode(String)}} throws on the first character it can't map, so it can't do this.


was (Author: phax):
We encode text one code point at a time and cache the result per font.

When a code point can't be encoded, we swap in a fallback character instead of failing the whole string.

The public `encode(String)` throws on the first character it can't map, so it can't do this.

> Request to make PDFont.encode public
> ------------------------------------
>
>                 Key: PDFBOX-6169
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-6169
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: PDModel
>    Affects Versions: 3.0.6 PDFBox
>            Reporter: Philip Helger
>            Priority: Major
>
> Please make the following methods public:
> protected abstract byte[] encode(int unicode) throws IOException;
> I am using it in ph-pdf-layout for more efficient text rendering. 
> To make sure the library works in a module-based environment, I need to get rid of the package-private override: [https://github.com/phax/ph-pdf-layout/issues/62]
> Thanks, Philip



--
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