When using font created by function with signature "PdfFont* PdfMemDocument::GetFont( PdfObject* pObject )" for drawing text then are not rendered characters outside of base encoding if specified font uses difference encoding for these characters for example if font was created by using "doc.CreateFont("Verdana", false, false, false, PdfEncodingFactory::GlobalWin1250EncodingInstance())" in original pdf.
This does not happen for base 14 fonts because here are initialised all "unicodeValue" fields in m_differences during construction of base 14 font and its metrics through PdfEncodingDifference::Contains: Part of PdfEncodingDifference::Contains: ``` if( !(*(it.first)).unicodeValue ) // Field is not yet initialized, // initialize it now, so that we only // compute the value if it is needed. (*(it.first)).unicodeValue = PdfDifferenceEncoding::NameToUnicodeID( rName ); ``` Lazy initialisation could have sense but not just here because m_differences is also used in PdfEncodingDifference::ContainsUnicodeValue. Truetype fonts loaded from pdf does not have unicodeValues initialised through podofo font object construction so it will not draw all characters possible in encoding. So one solution would be to do lazy initialisation also to PdfEncodingDifference::ContainsUnicodeValue but lazy initialisation here does not make sense because you will always require this initialised when you want to use font created by "PdfFont* PdfMemDocument::GetFont( PdfObject* pObject )". Also for base 14 fonts is this actually initialised always during creation so actually this is not so lazy. The best is to initialise it during creation of PdfDifferenceEncoding. And only place which creates PdfDifferenceEncoding is "PdfFont* PdfMemDocument::GetFont( PdfObject* pObject )". Patch attached.
patch_difference_nolazy.diff
Description: Binary data
_______________________________________________ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users