Re: [Podofo-users] PoDoFo fonts cmaps "override"

2019-11-05 Thread Pietro Paolini

Hi zyx,

I think I am one commit behind the server's trunk.

I can't tell of any bug as the mechanics are not clear to me well enough 
to understand how I am supposed to do what I want to do. I will try the 
suggestion Clayton gave me (and thanks A LOT for that) and report back 
if I found any issue.


It will take some time though as I am juggling up with many things, 
please let me know if there any specific testing I'd like to carry out, 
many I can be helpful in that way.




P.


On 05/11/2019 07:18, zyx wrote:

On Sun, 2019-11-03 at 22:40 +, Pietro Paolini wrote:

In PoDoFo terminology it seems that I'd need to create my own
PdfEncoding subclass and assign it to a font somehow, but I haven't
found any example.

Is this possible at all ?


Hi,
what is the PoDoFo version you use, please?

I recall a bug about CMap generation in the past. Maybe try svn trunk
to see whether it's fixed.
Bye,
zyx



___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users




___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users


Re: [Podofo-users] PoDoFo fonts cmaps "override"

2019-11-04 Thread zyx
On Sun, 2019-11-03 at 22:40 +, Pietro Paolini wrote:
> In PoDoFo terminology it seems that I'd need to create my own
> PdfEncoding subclass and assign it to a font somehow, but I haven't
> found any example.
>
> Is this possible at all ?

Hi,
what is the PoDoFo version you use, please?

I recall a bug about CMap generation in the past. Maybe try svn trunk
to see whether it's fixed.
Bye,
zyx



___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users


Re: [Podofo-users] PoDoFo fonts cmaps "override"

2019-11-04 Thread Clayton Wheeler
In general, what you'd need to do is to generate a new ToUnicode CMap; see
section 9.10 of the PDF spec, there's an optional ToUnicode entry in the
font dictionary. The tricky part is figuring out what the new CMap should
contain, since that's going to be specific to the encoding problem you're
encountering.

The mechanics of it are fairly simple, though; given the Font object in
question and the text of the new CMap, do something like:

PdfDictionary& fontDict = font.GetDictionary();
PdfObject* cmapObj = doc.GetObjects().CreateObject();
PdfStream* stream = cmapObj->GetStream();
stream->Set(cmapText.data(), cmapText.size());
fontDict.AddKey(PdfName("ToUnicode"), cmapObj->Reference());

On Sun, Nov 3, 2019 at 4:43 PM Pietro Paolini <
pietro.paol...@cognitivecredit.com> wrote:

> Hi everybody,
>
>  From time to time I come across PDFs whose fonts are broken and that I
> cannot paste from. I think this has to do with their cmaps and I am
> wondering if there is an example somewhere (if this is possible at all)
> where a document's font is amended, that is, its cmap is altered and its
> changes saved so that subsequent programs opening the document won't be
> affected by the problem.
>
> Sometimes it can be quite bizarre as only a handful of characters are
> not correctly mapped into unicode.
>
> In PoDoFo terminology it seems that I'd need to create my own
> PdfEncoding subclass and assign it to a font somehow, but I haven't
> found any example.
>
> Is this possible at all ?
>
>
> Thanks,
> Pietro
>
>
> ___
> Podofo-users mailing list
> Podofo-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>


-- 
Clayton Wheeler
cwhee...@genomenon.com
___
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users