There is a bug in PdfFontMetricsObject code where it comes to Type0
CID font processing. Take a code from trunk and implement a changes
like this, or wait for an official patch.
This fonts should be supported. Some of them are TTC collections, so
it might happen that code picks a wrong font from collection. Anyhow,
PoDoFo will select first font from TrueType collection.
There is/was some work on this issue, but more changes are required
for Windows and Unix environments.


PdfFontMetricsObject::PdfFontMetricsObject( PdfObject* pFont,
PdfObject* pDescriptor, const PdfEncoding* const pEncoding )
{
    const PdfName & rSubType = pFont->GetDictionary().GetKey(
PdfName::KeySubtype )->GetName();
        if ( rSubType == PdfName("Type1") || rSubType ==
PdfName("Type3") || rSubType == PdfName("TrueType") ) {
            if ( pDescriptor ) {
                 ...
            } else {
                ...
            }
            ...
/* WRONG: Should check for Type0, and later look for CIDFontType0/2
subtype in FontDescriptor object */
        } else if ( rSubType == PdfName("CIDFontType0") || rSubType ==
PdfName("CIDFontType2") ) {
*/
/* SHOULD: be like this */
        } else if ( rSubType == PdfName("Type0") ) {
            if ( pDescriptor) {
                const PdfName & rDescSubType =
pDescriptor->GetDictionary().GetKey( PdfName::KeySubtype )->GetName();
                if ( rDescSubType == PdfName("CIDFontType0") ||
rDescSubType == PdfName("CIDFontType2") ) {
                     ...
                }
                else {
                      PODOFO_RAISE_ERROR_INFO(
ePdfError_UnsupportedFontFormat, rDescSubType.GetEscapedName().c_str()
);
                }
            }
            else {
                 PODOFO_RAISE_ERROR_INFO(
ePdfError_UnsupportedFontFormat, "Missing FontDescriptor" );
            }
    } else {
        PODOFO_RAISE_ERROR_INFO( ePdfError_UnsupportedFontFormat,
rSubType.GetEscapedName().c_str() );
}


There is also a problem with ToUnicode object generated in
PdfFontCID. PoDoFo does not process entries encoded with array, so it
has to changed like this, or add support to both types of entries

<03> <04> [ <20> <21> ] ---> <03> <04> <20>

static void
fillUnicodeStream( PdfStream* pStream , const GidToCodePoint&
gidToCodePoint, int nFirstChar, int nLastChar, bool
bSingleByteEncoding)
...
#if !defined(USE_CMAP_ARRAY)
        range << buffer << "> ";
        std::vector<FT_UInt>::const_iterator it2 = (*it).vecDest.begin();
        snprintf( buffer, BUFFER_LEN, "%04X", *it2 );
        range << "<" << buffer << ">" << std::endl;
#else
        range << buffer << "> [ ";
        std::vector<FT_UInt>::const_iterator it2 = (*it).vecDest.begin();
        while( it2 != (*it).vecDest.end() )
        {
            snprintf( buffer, BUFFER_LEN, "%04X", *it2 );
            range << "<" << buffer << "> ";
            ++it2;
        }
        range << "]" << std::endl;
#endif

I will do a patch later, but if anybody needs it now, here is how it
can be made.


Best regards,
Nenad

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to