You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Malcolm Vincent <ma...@gmail.com> on 2018/02/15 08:27:54 UTC

Font encoding when adding text

Hi,

Is there anything special you need to be aware of when using
PDFont.encode(unicode-string)

I have a PDF with a font resource and when adding to an existing PDF
PDFont.encode("unicode string") seems to be throwing a character not found
exception.

Exception 'U+041E ('Ocyrillic') is not available in this font's encoding:
WinAnsiEncoding with differences' : MyriadPro-Light

But when I look at the font in the debugger I can see

code 18
glyphname "afii10032"
unicode character "O"
glyph "O"

and I verified that O by hex'ing it and I get D0 9E which is unicode for
U+041E

Any help would be appreciated!

Cheers
Malcolm

Re: Font encoding when adding text

Posted by Malcolm Vincent <ma...@gmail.com>.
Hi - just to report back, encoding using a new font works perfectly,
and best results are achieved with Arial Unicode MS which seems to
have extensive character set support. Thanks!

I suspect that the encoding function should really check all known
names rather than accepting the first and failing when it is not
found, but I don't have time to modify the source code at this point
to check this theory out.

Once again, thanks for all the great help.

Malcolm.





On 15 February 2018 at 16:47, Tilman Hausherr <TH...@t-online.de> wrote:
> See https://pdfbox.apache.org/2.0/faq.html#fontencoding , please try with a
> new font instead of the existing font.
>
> 041E has two names in the Adobe glyphlist, "Ocyrillic" and later
> "afii10032". Ocyrillic comes first, so that one is used.
>
> Tilman
>
>
> Am 15.02.2018 um 09:27 schrieb Malcolm Vincent:
>>
>> Hi,
>>
>> Is there anything special you need to be aware of when using
>> PDFont.encode(unicode-string)
>>
>> I have a PDF with a font resource and when adding to an existing PDF
>> PDFont.encode("unicode string") seems to be throwing a character not found
>> exception.
>>
>> Exception 'U+041E ('Ocyrillic') is not available in this font's encoding:
>> WinAnsiEncoding with differences' : MyriadPro-Light
>>
>> But when I look at the font in the debugger I can see
>>
>> code 18
>> glyphname "afii10032"
>> unicode character "O"
>> glyph "O"
>>
>> and I verified that O by hex'ing it and I get D0 9E which is unicode for
>> U+041E
>>
>> Any help would be appreciated!
>>
>> Cheers
>> Malcolm
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>

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


Re: Font encoding when adding text

Posted by Tilman Hausherr <TH...@t-online.de>.
See https://pdfbox.apache.org/2.0/faq.html#fontencoding , please try 
with a new font instead of the existing font.

041E has two names in the Adobe glyphlist, "Ocyrillic" and later 
"afii10032". Ocyrillic comes first, so that one is used.

Tilman

Am 15.02.2018 um 09:27 schrieb Malcolm Vincent:
> Hi,
>
> Is there anything special you need to be aware of when using
> PDFont.encode(unicode-string)
>
> I have a PDF with a font resource and when adding to an existing PDF
> PDFont.encode("unicode string") seems to be throwing a character not found
> exception.
>
> Exception 'U+041E ('Ocyrillic') is not available in this font's encoding:
> WinAnsiEncoding with differences' : MyriadPro-Light
>
> But when I look at the font in the debugger I can see
>
> code 18
> glyphname "afii10032"
> unicode character "O"
> glyph "O"
>
> and I verified that O by hex'ing it and I get D0 9E which is unicode for
> U+041E
>
> Any help would be appreciated!
>
> Cheers
> Malcolm
>


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