Quantcast
Channel: Adobe Community: Message List - Acrobat SDK
Viewing all articles
Browse latest Browse all 10848

Font encoding, PDEFontCreateFromSysFont, PDEFontCreateFromSysFontAndEncoding

$
0
0

Hi All,

   I want to change font of the text in a PDF. My develop the code On Mac os 10.9.

 

Here is my code:

Original:

1. PDSysFont sysFont = PDFindSysFont(&fontAttrs, attrsSize, kPDSysFontMatchFontType);   //the font name is 'helvetica', type is 'TrueType'

2. PDEFont pdeFont = PDEFontCreateFromSysFont(sysFont, kPDEFontCreateEmbedded);

3... then use the pdeFont to change the text's font Which exists in PDF.


Then I open the edited pdf file by Adobe Acrobat, It pop a warning message:

  "The font 'Helvetica' contains an invalid encoding.Some characters may not display."

 

So I changed my code in Step2:

Changed:

PDSysEncoding fontEncoding = PDSysEncodingCreateFromBaseName(fontAttrs.encoding, NULL);

PDEFont pdeFont = PDEFontCreateFromSysFontAndEncoding(sysFont, fontEncoding, fontAttrs.name, kPDEFontCreateEmbedded);


The problem looks like be resolved.

But It confused me. I don't know the change is right or not? Dose someone who can explain the difference of the two method to men. Thanks.


NOTE

I use Adobe Acrobat to open open the 'correct' and 'incorrect' file:

[File]->[Properties...]->[Fonts]

incorrect file:

  Helvetica(Embedded)

          Type:TrueType

          Encoding:Custom


correct file:

   Helvetica(Embedded)

         Type:TrueType

        Encoding:Roman



I use a tool to open the 'correct' and 'incorrect' file to see the detail information of the font. I find the encoding in file is

incorrect file:

encoding:

               Type: encoding

                baseEncoding:MacRomanEncoding

                Differences:[219 Euro]


correct file:

encoding: MacRomanEncoding;




Viewing all articles
Browse latest Browse all 10848

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>