Merge two patches already upstream:

- use a more compact encoding for reals by dropping trailing zeros after
  the decimal point.
- ensure the BaseFont property of the standard PS fonts is preserved.

Bump revision.
This commit is contained in:
joerg 2013-07-16 21:28:43 +00:00
parent de5853ccaf
commit 609739ab94
5 changed files with 86 additions and 2 deletions

View file

@ -1,7 +1,8 @@
# $NetBSD: Makefile,v 1.17 2013/07/05 21:12:45 joerg Exp $
# $NetBSD: Makefile,v 1.18 2013/07/16 21:28:43 joerg Exp $
#
DISTNAME= podofo-0.9.2
PKGREVISION= 1
CATEGORIES= print
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=podofo/}

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.6 2013/07/05 21:12:45 joerg Exp $
$NetBSD: distinfo,v 1.7 2013/07/16 21:28:43 joerg Exp $
SHA1 (podofo-0.9.2.tar.gz) = 8a6e27e17e0ed9f12e1a999cff66eae8eb97a4bc
RMD160 (podofo-0.9.2.tar.gz) = 69bf1035f2466ba95208830038c6f8e303580a5b
@ -7,4 +7,7 @@ SHA1 (patch-aa) = 83740cf59f1c86b07e7ce498e19efe627c0b249e
SHA1 (patch-ab) = 86ef3d5f6fced669cbeeae95890c046489467e69
SHA1 (patch-ac) = b184fa648407141a373451334790aada66cc2ae2
SHA1 (patch-src_base_PdfLocale.h) = ba209173509f1109d305765ae7dd56d8266a97d8
SHA1 (patch-src_base_PdfVariant.cpp) = 849374c8111175cc8875bce0f0b7656bfd1ba5b3
SHA1 (patch-src_doc_PdfFontType1Base14.cpp) = fa0452ad11e01a3706b9ad81d649dcc088493638
SHA1 (patch-src_doc_PdfFontType1Base14.h) = 6467317f8b3818ec4da86e938f44b1d7eb4fd6af
SHA1 (patch-test_CMakeLists.txt) = 846871dac995ff80544ad9096574eddd776e324f

View file

@ -0,0 +1,30 @@
$NetBSD: patch-src_base_PdfVariant.cpp,v 1.1 2013/07/16 21:28:43 joerg Exp $
--- src/base/PdfVariant.cpp.orig 2011-04-19 17:34:25.000000000 +0000
+++ src/base/PdfVariant.cpp
@@ -267,8 +267,24 @@ void PdfVariant::Write( PdfOutputDevice*
std::ostringstream oss;
PdfLocaleImbue(oss);
oss << std::fixed << m_Data.dNumber;
+ size_t len = oss.str().size();
- pDevice->Write( oss.str().c_str(), oss.str().size() );
+ if( (eWriteMode & ePdfWriteMode_Compact) == ePdfWriteMode_Compact &&
+ oss.str().find('.') != string::npos )
+ {
+ const char *str = oss.str().c_str();
+ while( str[len - 1] == '0' )
+ --len;
+ if( str[len - 1] == '.' )
+ --len;
+ if( len == 0 )
+ {
+ pDevice->Write( "0", 1 );
+ break;
+ }
+ }
+
+ pDevice->Write( oss.str().c_str(), len );
break;
}
case ePdfDataType_HexString:

View file

@ -0,0 +1,37 @@
$NetBSD: patch-src_doc_PdfFontType1Base14.cpp,v 1.1 2013/07/16 21:28:43 joerg Exp $
--- src/doc/PdfFontType1Base14.cpp.orig 2010-10-21 17:09:00.000000000 +0000
+++ src/doc/PdfFontType1Base14.cpp
@@ -31,7 +31,7 @@ PdfFontType1Base14::PdfFontType1Base14(
PdfVecObjects* pParent )
: PdfFontSimple( pMetrics, pEncoding, pParent )
{
- InitBase14Font();
+ InitBase14Font( pMetrics );
}
// OC 13.08.2010 New:
@@ -39,7 +39,7 @@ PdfFontType1Base14::PdfFontType1Base14(
PdfObject* pObject )
: PdfFontSimple( pMetrics, pEncoding, pObject )
{
- InitBase14Font();
+ InitBase14Font( pMetrics );
}
PdfFontType1Base14::~PdfFontType1Base14()
@@ -52,12 +52,12 @@ PdfFontType1Base14::~PdfFontType1Base14(
kausik : April 12th 2010
This is the font dictionary. It gets added to the page resources dictionary of the pdf.
*/
-void PdfFontType1Base14::InitBase14Font( )
+void PdfFontType1Base14::InitBase14Font( PdfFontMetrics* pMetrics )
{
PdfVariant var;
this->GetObject()->GetDictionary().AddKey( PdfName::KeySubtype, PdfName("Type1"));
- this->GetObject()->GetDictionary().AddKey("BaseFont", this->GetBaseFont() );
+ this->GetObject()->GetDictionary().AddKey("BaseFont", PdfName( pMetrics->GetFontname() ) );
m_pEncoding->AddToDictionary( this->GetObject()->GetDictionary() ); // Add encoding key
// pDescriptor->GetDictionary().AddKey( "FontName", this->GetBaseFont() );

View file

@ -0,0 +1,13 @@
$NetBSD: patch-src_doc_PdfFontType1Base14.h,v 1.1 2013/07/16 21:28:43 joerg Exp $
--- src/doc/PdfFontType1Base14.h.orig 2013-07-08 13:31:23.631273082 +0000
+++ src/doc/PdfFontType1Base14.h
@@ -66,7 +66,7 @@ class PdfFontType1Base14 : public PdfFon
virtual void EmbedFontFile( PdfObject* pDescriptor );
private:
- void InitBase14Font();
+ void InitBase14Font( PdfFontMetrics* pMetrics );
};