PdfAnnotation.h   PdfAnnotation.h 
skipping to change at line 74 skipping to change at line 74
ePdfAnnotation_Popup, // PDF 1.3 // - supported ePdfAnnotation_Popup, // PDF 1.3 // - supported
ePdfAnnotation_FileAttachement,// PDF 1.3 ePdfAnnotation_FileAttachement,// PDF 1.3
ePdfAnnotation_Sound, // PDF 1.2 ePdfAnnotation_Sound, // PDF 1.2
ePdfAnnotation_Movie, // PDF 1.2 ePdfAnnotation_Movie, // PDF 1.2
ePdfAnnotation_Widget, // PDF 1.2 // - supported ePdfAnnotation_Widget, // PDF 1.2 // - supported
ePdfAnnotation_Screen, // PDF 1.5 ePdfAnnotation_Screen, // PDF 1.5
ePdfAnnotation_PrinterMark, // PDF 1.4 ePdfAnnotation_PrinterMark, // PDF 1.4
ePdfAnnotation_TrapNet, // PDF 1.3 ePdfAnnotation_TrapNet, // PDF 1.3
ePdfAnnotation_Watermark, // PDF 1.6 ePdfAnnotation_Watermark, // PDF 1.6
ePdfAnnotation_3D, // PDF 1.6 ePdfAnnotation_3D, // PDF 1.6
ePdfAnnotation_RichMedia, // PDF 1.? ALX: Petr P. Petrov
ePdfAnnotation_Unknown = 0xff ePdfAnnotation_Unknown = 0xff
}; };
/** Flags that control the appearance of a PdfAnnotation. /** Flags that control the appearance of a PdfAnnotation.
* You can OR them together and pass it to * You can OR them together and pass it to
* PdfAnnotation::SetFlags. * PdfAnnotation::SetFlags.
*/ */
enum EPdfAnnotationFlags { enum EPdfAnnotationFlags {
ePdfAnnotationFlags_Invisible = 0x0001, ePdfAnnotationFlags_Invisible = 0x0001,
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 PdfDefines.h   PdfDefines.h 
skipping to change at line 202 skipping to change at line 202
ePdfFilter_FlateDecode, /**< Compress data using the Flat e algorithm of ZLib. This filter is recommended to be used always. \see Pdf FlateFilter */ ePdfFilter_FlateDecode, /**< Compress data using the Flat e algorithm of ZLib. This filter is recommended to be used always. \see Pdf FlateFilter */
ePdfFilter_RunLengthDecode, /**< Run length decode data. \see PdfRLEFilter */ ePdfFilter_RunLengthDecode, /**< Run length decode data. \see PdfRLEFilter */
ePdfFilter_CCITTFaxDecode, ePdfFilter_CCITTFaxDecode,
ePdfFilter_JBIG2Decode, ePdfFilter_JBIG2Decode,
ePdfFilter_DCTDecode, ePdfFilter_DCTDecode,
ePdfFilter_JPXDecode, ePdfFilter_JPXDecode,
ePdfFilter_Crypt ePdfFilter_Crypt
}; };
/** /**
* Enum for the different font formats supported by PoDoFo
*/
enum EPdfFontType {
ePdfFontType_TrueType,
ePdfFontType_Type1Pfa,
ePdfFontType_Type1Pfb,
ePdfFontType_Type1Base14,
ePdfFontType_Unknown = 0xff
};
/**
* Enum for the colorspaces supported * Enum for the colorspaces supported
* by PDF. * by PDF.
*/ */
enum EPdfColorSpace { enum EPdfColorSpace {
ePdfColorSpace_DeviceGray, /**< Gray */ ePdfColorSpace_DeviceGray, /**< Gray */
ePdfColorSpace_DeviceRGB, /**< RGB */ ePdfColorSpace_DeviceRGB, /**< RGB */
ePdfColorSpace_DeviceCMYK, /**< CMYK */ ePdfColorSpace_DeviceCMYK, /**< CMYK */
ePdfColorSpace_Separation, /**< Separation */ ePdfColorSpace_Separation, /**< Separation */
ePdfColorSpace_CieLab /**< CIE-Lab */ ePdfColorSpace_CieLab /**< CIE-Lab */
}; };
skipping to change at line 426 skipping to change at line 437
/** /**
* PDF_MIN(x,y) * PDF_MIN(x,y)
* \returns the minimum of x and y * \returns the minimum of x and y
*/ */
// Not actually a macro, because function-like macros are evil and // Not actually a macro, because function-like macros are evil and
// prone to nasty issues with double-evaluation of arguments. // prone to nasty issues with double-evaluation of arguments.
template <typename T> const T PDF_MIN ( const T a, const T b ) { template <typename T> const T PDF_MIN ( const T a, const T b ) {
return (a<b)?a:b; return (a<b)?a:b;
} }
#ifndef PODOFO_CONVERSION_CONSTANT
#define PODOFO_CONVERSION_CONSTANT 0.002834645669291339
#endif // PODOFO_CONVERSION_CONSTANT
}; // end namespace PoDoFo }; // end namespace PoDoFo
/** /**
* \mainpage * \mainpage
* *
* <b>PoDoFo</b> is a library to work with the PDF file format and includes also a few * <b>PoDoFo</b> is a library to work with the PDF file format and includes also a few
* tools. The name comes from the first letter of PDF (Portable Document * tools. The name comes from the first letter of PDF (Portable Document
* Format). * Format).
* *
* The <b>PoDoFo</b> library is a free portable C++ library which includes * The <b>PoDoFo</b> library is a free portable C++ library which includes
 End of changes. 2 change blocks. 
0 lines changed or deleted 15 lines changed or added


 PdfDestination.h   PdfDestination.h 
skipping to change at line 27 skipping to change at line 27
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_DESTINATION_H_ #ifndef _PDF_DESTINATION_H_
#define _PDF_DESTINATION_H_ #define _PDF_DESTINATION_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfArray.h" #include "PdfArray.h"
#include "PdfRect.h"
#include "PdfReference.h" #include "PdfReference.h"
namespace PoDoFo { namespace PoDoFo {
class PdfAction; class PdfAction;
class PdfPage; class PdfPage;
class PdfRect; class PdfRect;
enum EPdfDestinationFit { enum EPdfDestinationFit {
ePdfDestinationFit_Fit, ePdfDestinationFit_Fit,
ePdfDestinationFit_FitH, ePdfDestinationFit_FitH,
ePdfDestinationFit_FitV, ePdfDestinationFit_FitV,
ePdfDestinationFit_FitB, ePdfDestinationFit_FitB,
ePdfDestinationFit_FitBH, ePdfDestinationFit_FitBH,
ePdfDestinationFit_FitBV, ePdfDestinationFit_FitBV,
ePdfDestinationFit_Unknown = 0xFF ePdfDestinationFit_Unknown = 0xFF
}; };
/** Destination type, as per 12.3.2.2 of the Pdf spec.
*
* (see table 151 in the pdf spec)
*/
enum EPdfDestinationType {
ePdfDestinationType_XYZ,
ePdfDestinationType_Fit,
ePdfDestinationType_FitH,
ePdfDestinationType_FitV,
ePdfDestinationType_FitR,
ePdfDestinationType_FitB,
ePdfDestinationType_FitBH,
ePdfDestinationType_FitBV,
ePdfDestinationType_Unknown = 0xFF
};
/** A destination in a PDF file. /** A destination in a PDF file.
* A destination can either be a page or an action. * A destination can either be a page or an action.
* *
* \see PdfOutlineItem \see PdfAnnotation \see PdfDocument * \see PdfOutlineItem \see PdfAnnotation \see PdfDocument
*/ */
class PODOFO_API PdfDestination { class PODOFO_API PdfDestination {
public: public:
/** Create an empty destination - points to nowhere /** Create an empty destination - points to nowhere
*/ */
skipping to change at line 111 skipping to change at line 129
const PdfDestination & operator=( const PdfDestination & rhs ); const PdfDestination & operator=( const PdfDestination & rhs );
/** Get the page that this destination points to /** Get the page that this destination points to
* Requires that this PdfDestination was somehow * Requires that this PdfDestination was somehow
* created by or from a PdfDocument. Won't work otherwise. * created by or from a PdfDocument. Won't work otherwise.
* *
* \returns the referenced PdfPage * \returns the referenced PdfPage
*/ */
PdfPage* GetPage(); PdfPage* GetPage();
/** Get the destination fit type
*
* \returns the fit type
*/
inline EPdfDestinationType GetType() const;
/** Get the destination zoom
* Destination must be of type XYZ
* otherwise exception is thrown.
*
* \returns the zoom
*/
inline double GetZoom() const;
/** Get the destination rect
* Destination must be of type FirR
* otherwise exception is thrown
*
* \returns the destination rect
*/
inline PdfRect GetRect() const;
/** Get the destination Top position
* Destination must be of type XYZ, FitH, FitR, FitBH
* otherwise exception is thrown.
*
* \returns the Top position
*/
inline double GetTop() const;
/** Get the destination Left position
* Destination must be of type XYZ, FitV or FitR
* otherwise exception is thrown.
*
* \returns the Left position
*/
inline double GetLeft() const;
/** Get the destination Value
* Destination must be of type FitH, FitV
* or FitBH, otherwise exception is thrown
*
* \returns the destination Value
*/
inline double GetDValue() const;
/** Get access to the internal object /** Get access to the internal object
*
* \returns the internal PdfObject * \returns the internal PdfObject
*/ */
inline PdfObject* GetObject(); inline PdfObject* GetObject();
/** Get access to the internal object /** Get access to the internal object
* This is an overloaded member function. * This is an overloaded member function.
* *
* \returns the internal PdfObject * \returns the internal PdfObject
*/ */
inline const PdfObject* GetObject() const; inline const PdfObject* GetObject() const;
/** Get access to the internal array
* \returns the internal PdfArray
*/
inline PdfArray &GetArray();
/** Get access to the internal array
* This is an overloaded member function.
*
* \returns the internal PdfArray
*/
inline const PdfArray &GetArray() const;
/** Adds this destination to an dictionary. /** Adds this destination to an dictionary.
* This method handles the all the complexities of making sure it's ad ded correctly * This method handles the all the complexities of making sure it's ad ded correctly
* *
* If this destination is empty. Nothing will be added. * If this destination is empty. Nothing will be added.
* *
* \param dictionary the destination will be added to this dictionary * \param dictionary the destination will be added to this dictionary
*/ */
void AddToDictionary( PdfDictionary & dictionary ) const; void AddToDictionary( PdfDictionary & dictionary ) const;
private: private:
skipping to change at line 161 skipping to change at line 238
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfObject* PdfDestination::GetObject() const inline const PdfObject* PdfDestination::GetObject() const
{ {
return m_pObject; return m_pObject;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfArray &PdfDestination::GetArray()
{
return m_array;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline const PdfArray &PdfDestination::GetArray() const
{
return m_array;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline EPdfDestinationType PdfDestination::GetType() const
{
if ( !m_array.size() )
return ePdfDestinationType_Unknown;
PdfName tp = m_array[1].GetName();
if ( tp == PdfName("XYZ") ) return ePdfDestinationType_XYZ;
if ( tp == PdfName("Fit") ) return ePdfDestinationType_Fit;
if ( tp == PdfName("FitH") ) return ePdfDestinationType_FitH;
if ( tp == PdfName("FitV") ) return ePdfDestinationType_FitV;
if ( tp == PdfName("FitR") ) return ePdfDestinationType_FitR;
if ( tp == PdfName("FitB") ) return ePdfDestinationType_FitB;
if ( tp == PdfName("FitBH") ) return ePdfDestinationType_FitBH;
if ( tp == PdfName("FitBV") ) return ePdfDestinationType_FitBV;
return ePdfDestinationType_Unknown;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline double PdfDestination::GetDValue() const
{
EPdfDestinationType tp = GetType();
if ( tp != ePdfDestinationType_FitH
&& tp != ePdfDestinationType_FitV
&& tp != ePdfDestinationType_FitBH )
{
PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
}
return m_array[2].GetReal();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline double PdfDestination::GetLeft() const
{
EPdfDestinationType tp = GetType();
if ( tp != ePdfDestinationType_FitV
&& tp != ePdfDestinationType_XYZ
&& tp != ePdfDestinationType_FitR )
{
PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
}
return m_array[2].GetReal();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfRect PdfDestination::GetRect() const
{
if ( GetType() != ePdfDestinationType_FitR )
{
PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
}
return PdfRect(m_array[2].GetReal(), m_array[3].GetReal(),
m_array[4].GetReal(), m_array[5].GetReal());
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline double PdfDestination::GetTop() const
{
EPdfDestinationType tp = GetType();
switch (tp)
{
case ePdfDestinationType_XYZ:
return m_array[3].GetReal();
case ePdfDestinationType_FitH:
case ePdfDestinationType_FitBH:
return m_array[2].GetReal();
case ePdfDestinationType_FitR:
return m_array[5].GetReal();
case ePdfDestinationType_Fit:
case ePdfDestinationType_FitV:
case ePdfDestinationType_FitB:
case ePdfDestinationType_FitBV:
case ePdfDestinationType_Unknown:
default:
{
PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
}
};
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline double PdfDestination::GetZoom() const
{
if ( GetType() != ePdfDestinationType_XYZ )
{
PODOFO_RAISE_ERROR( ePdfError_WrongDestinationType );
}
return m_array[4].GetReal();
}
}; };
#endif // _PDF_DESTINATION_H_ #endif // _PDF_DESTINATION_H_
 End of changes. 6 change blocks. 
0 lines changed or deleted 204 lines changed or added


 PdfDifferenceEncoding.h   PdfDifferenceEncoding.h 
skipping to change at line 224 skipping to change at line 224
* *
* \returns an unicode PdfString. * \returns an unicode PdfString.
*/ */
virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const; virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const;
/** Convert a unicode PdfString to a string encoded with this encoding. /** Convert a unicode PdfString to a string encoded with this encoding.
* *
* \param an unicode PdfString. * \param an unicode PdfString.
* \param pFont the font for which this string is converted * \param pFont the font for which this string is converted
* *
* \returns an encoded PdfString. The PdfString is treated as a series * \returns an encoded PdfRefCountedBuffer. The PdfRefCountedBuffer is
of bytes treated as a series of bytes
* and is allowed to have 0 bytes. The returned string must n * and is allowed to have 0 bytes. The returned buffer must n
ot be a unicode string. ot be a unicode string.
*/ */
virtual PdfString ConvertToEncoding( const PdfString & rString, const P dfFont* pFont ) const; virtual PdfRefCountedBuffer ConvertToEncoding( const PdfString & rStrin g, const PdfFont* pFont ) const;
/** /**
* \returns true if this encoding should be deleted automatically with the * \returns true if this encoding should be deleted automatically with the
* font. * font.
*/ */
virtual bool IsAutoDelete() const; virtual bool IsAutoDelete() const;
/** /**
* \returns true if this is a single byte encoding with a maximum of 2 56 values. * \returns true if this is a single byte encoding with a maximum of 2 56 values.
*/ */
 End of changes. 2 change blocks. 
5 lines changed or deleted 5 lines changed or added


 PdfElement.h   PdfElement.h 
skipping to change at line 130 skipping to change at line 130
/** Convert a string type to an array index or enum. /** Convert a string type to an array index or enum.
* *
* This is a helper function for various PdfElement * This is a helper function for various PdfElement
* subclasses that need strings and enums for their * subclasses that need strings and enums for their
* SubTypes keys. * SubTypes keys.
* *
* \param pszType the type as string * \param pszType the type as string
* \param ppTypes an array of strings containing * \param ppTypes an array of strings containing
* the string mapping of the index * the string mapping of the index
* \param lLen the length of the string array * \param lLen the length of the string array
* \param nUnknownValue the value that is returned when the type is un known
* *
* \returns the index of the string in the array * \returns the index of the string in the array
*/ */
int TypeNameToIndex( const char* pszType, const char** ppTypes, long lL en ) const; int TypeNameToIndex( const char* pszType, const char** ppTypes, long lL en, int nUnknownValue ) const;
/** Create a PdfObject in the parent of this PdfElement which /** Create a PdfObject in the parent of this PdfElement which
* might either be a PdfStreamedDocument, a PdfDocument or * might either be a PdfStreamedDocument, a PdfDocument or
* a PdfVecObjects * a PdfVecObjects
* *
* Use this function in an own subclass of PdfElement to create new * Use this function in an own subclass of PdfElement to create new
* PdfObjects. * PdfObjects.
* *
* \param pszType an optional /Type key of the created object * \param pszType an optional /Type key of the created object
* *
* \returns a PdfObject which is owned by the parent * \returns a PdfObject which is owned by the parent
*/ */
PdfObject* CreateObject( const char* pszType = NULL ); PdfObject* CreateObject( const char* pszType = NULL );
protected: /** Get access to the internal object.
* Use this method if you need access to the internal
* object in a const-method without having to do a const cast.
*
* \returns the internal PdfObject
*/
inline PdfObject* GetNonConstObject() const;
private:
PdfObject* m_pObject; PdfObject* m_pObject;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfObject* PdfElement::GetObject() inline PdfObject* PdfElement::GetObject()
{ {
return m_pObject; return m_pObject;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline const PdfObject* PdfElement::GetObject() const inline const PdfObject* PdfElement::GetObject() const
{ {
return m_pObject; return m_pObject;
} }
// -----------------------------------------------------
//
// -----------------------------------------------------
inline PdfObject* PdfElement::GetNonConstObject() const
{
return const_cast<PdfElement*>(this)->m_pObject;
}
}; };
#endif // PDF_ELEMENT_H_ #endif // PDF_ELEMENT_H_
 End of changes. 4 change blocks. 
2 lines changed or deleted 19 lines changed or added


 PdfEncoding.h   PdfEncoding.h 
skipping to change at line 53 skipping to change at line 53
* PDF file back into a PdfString. * PDF file back into a PdfString.
*/ */
class PODOFO_API PdfEncoding { class PODOFO_API PdfEncoding {
protected: protected:
/** /**
* Create a new PdfEncoding. * Create a new PdfEncoding.
* *
* \param nFirstChar the first supported character code * \param nFirstChar the first supported character code
* (either a byte value in the current encoding or a unicode value) * (either a byte value in the current encoding or a unicode value)
* \param nLastChar the last supported character code, must be larger than nFirstChar * \param nLastChar the last supported character code, must be larger than nFirstChar
* (either a byte value in the current encoding or a unicode value) - * (either a byte value in the current encoding or a unicode value)
* *
*/ */
PdfEncoding( int nFirstChar, int nLastChar ); PdfEncoding( int nFirstChar, int nLastChar );
/** Get a unique ID for this encoding /** Get a unique ID for this encoding
* which can used for comparisons! * which can used for comparisons!
* *
* \returns a unique id for this encoding! * \returns a unique id for this encoding!
*/ */
virtual const PdfName & GetID() const = 0; virtual const PdfName & GetID() const = 0;
skipping to change at line 163 skipping to change at line 163
* *
* \returns an unicode PdfString. * \returns an unicode PdfString.
*/ */
virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const = 0; virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const = 0;
/** Convert a unicode PdfString to a string encoded with this encoding. /** Convert a unicode PdfString to a string encoded with this encoding.
* *
* \param an unicode PdfString. * \param an unicode PdfString.
* \param pFont the font for which this string is converted * \param pFont the font for which this string is converted
* *
* \returns an encoded PdfString. The PdfString is treated as a series * \returns an encoded PdfRefCountedBuffer. The PdfRefCountedBuffer is
of bytes treated as a series of bytes
* and is allowed to have 0 bytes. The returned string must n * and is allowed to have 0 bytes. The returned buffer must n
ot be a unicode string. ot be a unicode string.
*/ */
virtual PdfString ConvertToEncoding( const PdfString & rString, const P dfFont* pFont ) const = 0; virtual PdfRefCountedBuffer ConvertToEncoding( const PdfString & rStrin g, const PdfFont* pFont ) const = 0;
/** /**
* \returns true if this encoding should be deleted automatically with the * \returns true if this encoding should be deleted automatically with the
* font. * font.
*/ */
virtual bool IsAutoDelete() const = 0; virtual bool IsAutoDelete() const = 0;
/** /**
* \returns true if this is a single byte encoding with a maximum of 2 56 values. * \returns true if this is a single byte encoding with a maximum of 2 56 values.
*/ */
skipping to change at line 335 skipping to change at line 335
* *
* \returns an unicode PdfString. * \returns an unicode PdfString.
*/ */
virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const; virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const;
/** Convert a unicode PdfString to a string encoded with this encoding. /** Convert a unicode PdfString to a string encoded with this encoding.
* *
* \param an unicode PdfString. * \param an unicode PdfString.
* \param pFont the font for which this string is converted * \param pFont the font for which this string is converted
* *
* \returns an encoded PdfString. The PdfString is treated as a series * \returns an encoded PdfRefCountedBuffer. The PdfRefCountedBuffer is
of bytes treated as a series of bytes
* and is allowed to have 0 bytes. The returned string must n * and is allowed to have 0 bytes. The returned buffer must n
ot be a unicode string. ot be a unicode string.
*/ */
virtual PdfString ConvertToEncoding( const PdfString & rString, const P dfFont* pFont ) const; virtual PdfRefCountedBuffer ConvertToEncoding( const PdfString & rStrin g, const PdfFont* pFont ) const;
/** /**
* PdfSimpleEncoding subclasses are usuylla not auto-deleted, as * PdfSimpleEncoding subclasses are usuylla not auto-deleted, as
* they are allocated statically only once. * they are allocated statically only once.
* *
* \returns true if this encoding should be deleted automatically with the * \returns true if this encoding should be deleted automatically with the
* font. * font.
* *
* \see PdfFont::WinAnsiEncoding * \see PdfFont::WinAnsiEncoding
* \see PdfFont::MacRomanEncoding * \see PdfFont::MacRomanEncoding
skipping to change at line 613 skipping to change at line 613
* *
* \returns an unicode PdfString. * \returns an unicode PdfString.
*/ */
virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const; virtual PdfString ConvertToUnicode( const PdfString & rEncodedString, c onst PdfFont* pFont ) const;
/** Convert a unicode PdfString to a string encoded with this encoding. /** Convert a unicode PdfString to a string encoded with this encoding.
* *
* \param an unicode PdfString. * \param an unicode PdfString.
* \param pFont the font for which this string is converted * \param pFont the font for which this string is converted
* *
* \returns an encoded PdfString. The PdfString is treated as a series * \returns an encoded PdfRefCountedBuffer. The PdfRefCountedBuffer is
of bytes treated as a series of bytes
* and is allowed to have 0 bytes. The returned string must n * and is allowed to have 0 bytes. The returned buffer must n
ot be a unicode string. ot be a unicode string.
*/ */
virtual PdfString ConvertToEncoding( const PdfString & rString, const P dfFont* pFont ) const; virtual PdfRefCountedBuffer ConvertToEncoding( const PdfString & rStrin g, const PdfFont* pFont ) const;
/** /**
* PdfIdentityEncoding is usually delete along with the font. * PdfIdentityEncoding is usually delete along with the font.
* *
* \returns true if this encoding should be deleted automatically with the * \returns true if this encoding should be deleted automatically with the
* font. * font.
*/ */
virtual bool IsAutoDelete() const; virtual bool IsAutoDelete() const;
/** /**
 End of changes. 7 change blocks. 
16 lines changed or deleted 16 lines changed or added


 PdfEncodingFactory.h   PdfEncodingFactory.h 
skipping to change at line 83 skipping to change at line 83
* *
* PoDoFo will reallocated these encodings as soon * PoDoFo will reallocated these encodings as soon
* as they are needed again. * as they are needed again.
* *
+ Only call this method if no other class + Only call this method if no other class
* of PoDoFo exists anymore, as PdfString etc * of PoDoFo exists anymore, as PdfString etc
* contain pointers to the global instances. * contain pointers to the global instances.
*/ */
static void FreeGlobalEncodingInstances(); static void FreeGlobalEncodingInstances();
static void PoDoFoClientAttached();
private: private:
/** Always use this static declaration, /** Always use this static declaration,
* if you need an instance of PdfDocEncoding * if you need an instance of PdfDocEncoding
* as heap allocation is expensive for PdfDocEncoding. * as heap allocation is expensive for PdfDocEncoding.
*/ */
static const PdfDocEncoding* s_pDocEncoding; static const PdfDocEncoding* s_pDocEncoding;
/** Always use this static declaration, /** Always use this static declaration,
* if you need an instance of PdfWinAnsiEncoding * if you need an instance of PdfWinAnsiEncoding
* as heap allocation is expensive for PdfWinAnsiEncoding. * as heap allocation is expensive for PdfWinAnsiEncoding.
 End of changes. 1 change blocks. 
0 lines changed or deleted 2 lines changed or added


 PdfEncrypt.h   PdfEncrypt.h 
skipping to change at line 91 skipping to change at line 91
ePdfPermissions_Edit = 0x00000008, ///< Allow modifying the document besides annotations, form fields or chaning pages ePdfPermissions_Edit = 0x00000008, ///< Allow modifying the document besides annotations, form fields or chaning pages
ePdfPermissions_Copy = 0x00000010, ///< Allow text and g raphic extraction ePdfPermissions_Copy = 0x00000010, ///< Allow text and g raphic extraction
ePdfPermissions_EditNotes = 0x00000020, ///< Add or modify te xt annoations or form fields (if ePdfPermissions_Edit is set also allow to create interactive form fields including signature) ePdfPermissions_EditNotes = 0x00000020, ///< Add or modify te xt annoations or form fields (if ePdfPermissions_Edit is set also allow to create interactive form fields including signature)
ePdfPermissions_FillAndSign = 0x00000100, ///< Fill in existing form or signature fields ePdfPermissions_FillAndSign = 0x00000100, ///< Fill in existing form or signature fields
ePdfPermissions_Accessible = 0x00000200, ///< Extract text and graphics to support user with disabillities ePdfPermissions_Accessible = 0x00000200, ///< Extract text and graphics to support user with disabillities
ePdfPermissions_DocAssembly = 0x00000400, ///< Assemble the doc ument: insert, create, rotate delete pages or add bookmarks ePdfPermissions_DocAssembly = 0x00000400, ///< Assemble the doc ument: insert, create, rotate delete pages or add bookmarks
ePdfPermissions_HighPrint = 0x00000800 ///< Print a high res olution version of the document ePdfPermissions_HighPrint = 0x00000800 ///< Print a high res olution version of the document
} EPdfPermissions; } EPdfPermissions;
typedef enum { typedef enum {
ePdfEncryptAlgorithm_RC4V1, ///< RC4 Version 1 encryption using a 4 ePdfEncryptAlgorithm_RC4V1 = 1, ///< RC4 Version 1 encryption using
0bit key a 40bit key
ePdfEncryptAlgorithm_RC4V2, ///< RC4 Version 2 encryption using a k ePdfEncryptAlgorithm_RC4V2 = 2, ///< RC4 Version 2 encryption using
ey with 40-128bit a key with 40-128bit
ePdfEncryptAlgorithm_AESV2 ///< AES encryption with an 128 bit key ePdfEncryptAlgorithm_AESV2 = 4 ///< AES encryption with an 128 bit
(PDF1.6) key (PDF1.6)
} EPdfEncryptAlgorithm; } EPdfEncryptAlgorithm;
/** Create a PdfEncrypt object which can be used to encrypt a PDF file. /** Create a PdfEncrypt object which can be used to encrypt a PDF file.
* *
* \param userPassword the user password (if empty the user does not h ave * \param userPassword the user password (if empty the user does not h ave
* to enter a password to open the document) * to enter a password to open the document)
* \param ownerPassword the owner password * \param ownerPassword the owner password
* \param protection several EPdfPermissions values or'ed together to set * \param protection several EPdfPermissions values or'ed together to set
* the users permissions for this document * the users permissions for this document
* \param eRevision the revision of the encryption algorithm to be use d * \param eRevision the revision of the encryption algorithm to be use d
skipping to change at line 128 skipping to change at line 128
ePdfPermissions_DocAssembly | ePdfPermissions_DocAssembly |
ePdfPermissions_HighPrint, ePdfPermissions_HighPrint,
EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_RC4V1, EPdfEncryptAlgorithm eAlgorithm = ePdfEncryptAlgorithm_RC4V1,
EPdfKeyLength eKeyLength = ePdfKe yLength_40 ); EPdfKeyLength eKeyLength = ePdfKe yLength_40 );
/** Initialize a PdfEncrypt object from an encryption dictionary in a P DF file. /** Initialize a PdfEncrypt object from an encryption dictionary in a P DF file.
* *
* This is required for encrypting a PDF file, but handled internally in PdfParser * This is required for encrypting a PDF file, but handled internally in PdfParser
* for you. * for you.
* *
* Will use only encrypting algorithms that are enabled.
*
* \param pObject a PDF encryption dictionary * \param pObject a PDF encryption dictionary
*
* \see GetEnabledEncryptionAlgorithms
*/ */
static PdfEncrypt * CreatePdfEncrypt( const PdfObject* pObject ); static PdfEncrypt * CreatePdfEncrypt( const PdfObject* pObject );
/** Copy constructor /** Copy constructor
* *
* \param rhs another PdfEncrypt object which is copied * \param rhs another PdfEncrypt object which is copied
*/ */
static PdfEncrypt * CreatePdfEncrypt( const PdfEncrypt & rhs ); static PdfEncrypt * CreatePdfEncrypt( const PdfEncrypt & rhs );
/**
* Retrieve the list of encryption algorithms that are used
* when loading a PDF document.
*
* By default all alogrithms are enabled.
*
* \see IsEncryptionEnabled
* \see SetEnabledEncryptionAlgorithms
*
* \return an or'ed together list of all enabled encryption algorithms
*/
static int GetEnabledEncryptionAlgorithms();
/**
* Specify the list of encryption algorithms that should be used by PoD
oFo
* when loading a PDF document.
*
* This can be used to disable for example AES encryption/decryption
* which is unstable in certain cases.
*
* \see GetEnabledEncryptionAlgorithms
* \see IsEncryptionEnabled
*/
static void SetEnabledEncryptionAlgorithms(int nEncryptionAlgorithms);
/**
* Test if a certain encryption algorithm is enabled for loading PDF do
cuments.
*
* \returns ture if the encryption algorithm is enabled
* \see GetEnabledEncryptionAlgorithms
* \see SetEnabledEncryptionAlgorithms
*/
static bool IsEncryptionEnabled(EPdfEncryptAlgorithm eAlgorithm);
/** Destruct the PdfEncrypt object /** Destruct the PdfEncrypt object
*/ */
virtual ~PdfEncrypt(); virtual ~PdfEncrypt();
/** Assignment operator /** Assignment operator
* *
* \param rhs another PdfEncrypt object which is copied * \param rhs another PdfEncrypt object which is copied
*/ */
const PdfEncrypt & operator=( const PdfEncrypt & rhs ); const PdfEncrypt & operator=( const PdfEncrypt & rhs );
skipping to change at line 371 skipping to change at line 409
int m_pValue; ///< P entry in pdf document int m_pValue; ///< P entry in pdf document
EPdfKeyLength m_eKeyLength; ///< The key length EPdfKeyLength m_eKeyLength; ///< The key length
std::string m_userPass; ///< User password std::string m_userPass; ///< User password
std::string m_ownerPass; ///< Owner password std::string m_ownerPass; ///< Owner password
unsigned char m_rc4key[16]; ///< last RC4 key unsigned char m_rc4key[16]; ///< last RC4 key
unsigned char m_rc4last[256]; ///< last RC4 state table unsigned char m_rc4last[256]; ///< last RC4 state table
unsigned char m_uValue[32]; ///< U entry in pdf document unsigned char m_uValue[32]; ///< U entry in pdf document
unsigned char m_oValue[32]; ///< O entry in pdf document unsigned char m_oValue[32]; ///< O entry in pdf document
private: private:
static int s_nEnabledEncryptionAlgorithms; ///< Or'ed int containing
the enabled encryption algorithms
unsigned char m_encryptionKey[16]; ///< Encryption key unsigned char m_encryptionKey[16]; ///< Encryption key
PdfReference m_curReference; ///< Reference of the current PdfObj ect PdfReference m_curReference; ///< Reference of the current PdfObj ect
std::string m_documentId; ///< DocumentID of the current docum ent std::string m_documentId; ///< DocumentID of the current docum ent
}; };
/** A class that is used to encrypt a PDF file (AES-128) /** A class that is used to encrypt a PDF file (AES-128)
* *
* Client code is working only with PdfEncrypt class and knows nothing * Client code is working only with PdfEncrypt class and knows nothing
 End of changes. 5 change blocks. 
6 lines changed or deleted 49 lines changed or added


 PdfError.h   PdfError.h 
skipping to change at line 92 skipping to change at line 92
ePdfError_InvalidKey, /**< The specified key is invalid * / ePdfError_InvalidKey, /**< The specified key is invalid * /
ePdfError_InvalidName, /**< The specified Name is not vali d in this context */ ePdfError_InvalidName, /**< The specified Name is not vali d in this context */
ePdfError_InvalidEncryptionDict, /**< The encryption dictionary is i nvalid or misses a required key */ ePdfError_InvalidEncryptionDict, /**< The encryption dictionary is i nvalid or misses a required key */
ePdfError_InvalidPassword, /**< The password used to open the PDF file was invalid */ ePdfError_InvalidPassword, /**< The password used to open the PDF file was invalid */
ePdfError_InvalidFontFile, /**< The font file is invalid */ ePdfError_InvalidFontFile, /**< The font file is invalid */
ePdfError_InvalidContentStream, /**< The content stream is invalid due to mismatched context pairing or other problems */ ePdfError_InvalidContentStream, /**< The content stream is invalid due to mismatched context pairing or other problems */
ePdfError_UnsupportedFilter, /**< The requested filter is not ye t implemented. */ ePdfError_UnsupportedFilter, /**< The requested filter is not ye t implemented. */
ePdfError_UnsupportedFontFormat, /**< This font format is not suppor ted by PoDoFO. */ ePdfError_UnsupportedFontFormat, /**< This font format is not suppor ted by PoDoFO. */
ePdfError_ActionAlreadyPresent, /**< An Action was already present when trying to add a Destination */ ePdfError_ActionAlreadyPresent, /**< An Action was already present when trying to add a Destination */
ePdfError_WrongDestinationType, /**< The requested field is not ava ilable for the given destination type */
ePdfError_MissingEndStream, /**< The required token endstream w as not found. */ ePdfError_MissingEndStream, /**< The required token endstream w as not found. */
ePdfError_Date, /**< Date/time error */ ePdfError_Date, /**< Date/time error */
ePdfError_Flate, /**< Error in zlib */ ePdfError_Flate, /**< Error in zlib */
ePdfError_FreeType, /**< Error in FreeType */ ePdfError_FreeType, /**< Error in FreeType */
ePdfError_SignatureError, /**< Error in signature */ ePdfError_SignatureError, /**< Error in signature */
ePdfError_MutexError, /**< Error during a mutex operation */ ePdfError_MutexError, /**< Error during a mutex operation */
ePdfError_UnsupportedImageFormat, /**< This image format is not suppo rted by PoDoFO. */ ePdfError_UnsupportedImageFormat, /**< This image format is not suppo rted by PoDoFO. */
 End of changes. 1 change blocks. 
0 lines changed or deleted 1 lines changed or added


 PdfFileSpec.h   PdfFileSpec.h 
skipping to change at line 45 skipping to change at line 45
* A file specification is used in the PDF file to referr to another file. * A file specification is used in the PDF file to referr to another file.
* The other file can be a file outside of the PDF or can be embedded into * The other file can be a file outside of the PDF or can be embedded into
* the PDF file itself. * the PDF file itself.
*/ */
class PODOFO_API PdfFileSpec : public PdfElement { class PODOFO_API PdfFileSpec : public PdfElement {
public: public:
PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfDocument* pParen t ); PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfDocument* pParen t );
PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfVecObjects* pPar ent ); PdfFileSpec( const char* pszFilename, bool bEmbedd, PdfVecObjects* pPar ent );
/* Petr P. Petrov 17 September 2009*/
/** Embeds the file in memory from "data" buffer under "pszFileName" fi
e name.
*/
PdfFileSpec( const char* pszFilename, const unsigned char* data, ptrdif
f_t size, PdfVecObjects* pParent);
PdfFileSpec( PdfObject* pObject ); PdfFileSpec( PdfObject* pObject );
/** \returns the filename of this file specification. /** \returns the filename of this file specification.
* if no general name is available * if no general name is available
* it will try the Unix, Mac and DOS keys too. * it will try the Unix, Mac and DOS keys too.
*/ */
const PdfString & GetFilename() const; const PdfString & GetFilename() const;
private: private:
skipping to change at line 66 skipping to change at line 71
* \param pszFilename filename * \param pszFilename filename
* \returns a file specification string * \returns a file specification string
*/ */
PdfString CreateFileSpecification( const char* pszFilename ) const; PdfString CreateFileSpecification( const char* pszFilename ) const;
/** Embedd a file into a stream object /** Embedd a file into a stream object
* \param pStream write the file to this objects stream * \param pStream write the file to this objects stream
* \param pszFilename the file to embedd * \param pszFilename the file to embedd
*/ */
void EmbeddFile( PdfObject* pStream, const char* pszFilename ) const; void EmbeddFile( PdfObject* pStream, const char* pszFilename ) const;
/* Petr P. Petrov 17 September 2009*/
/** Embeds the file from memory
*/
void EmbeddFileFromMem( PdfObject* pStream, const unsigned char* data,
ptrdiff_t size ) const;
}; };
}; };
#endif // _PDF_FILE_SPEC_H_ #endif // _PDF_FILE_SPEC_H_
 End of changes. 2 change blocks. 
0 lines changed or deleted 14 lines changed or added


 PdfFilter.h   PdfFilter.h 
skipping to change at line 397 skipping to change at line 397
PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EndDecode() without BeginDeco de() or on failed filter" ) PODOFO_RAISE_LOGIC_IF( !m_pOutputStream, "EndDecode() without BeginDeco de() or on failed filter" )
try { try {
EndDecodeImpl(); EndDecodeImpl();
} catch( const PdfError & e ) { } catch( const PdfError & e ) {
// Clean up and close stream // Clean up and close stream
this->FailEncodeDecode(); this->FailEncodeDecode();
throw e; throw e;
} }
m_pOutputStream->Close(); if( m_pOutputStream )
m_pOutputStream = NULL; {
m_pOutputStream->Close();
m_pOutputStream = NULL;
}
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFilter::FailEncodeDecode() void PdfFilter::FailEncodeDecode()
{ {
m_pOutputStream->Close(); m_pOutputStream->Close();
m_pOutputStream = NULL; m_pOutputStream = NULL;
} }
 End of changes. 1 change blocks. 
2 lines changed or deleted 5 lines changed or added


 PdfFont.h   PdfFont.h 
skipping to change at line 192 skipping to change at line 192
*/ */
virtual void EmbedFont(); virtual void EmbedFont();
protected: protected:
/** Get the base font name of this font /** Get the base font name of this font
* *
* \returns the base font name * \returns the base font name
*/ */
inline const PdfName& GetBaseFont() const; inline const PdfName& GetBaseFont() const;
void InitBase14Font();
private: private:
/** Initialize all variables /** Initialize all variables
*/ */
void InitVars(); void InitVars();
/** Used to specify if this represents a bold font /** Used to specify if this represents a bold font
* \param bBold if true this is a bold font. * \param bBold if true this is a bold font.
* *
* \see IsBold * \see IsBold
* *
skipping to change at line 230 skipping to change at line 232
protected: protected:
const PdfEncoding* const m_pEncoding; const PdfEncoding* const m_pEncoding;
PdfFontMetrics* m_pMetrics; PdfFontMetrics* m_pMetrics;
bool m_bBold; bool m_bBold;
bool m_bItalic; bool m_bItalic;
bool m_bUnderlined; bool m_bUnderlined;
bool m_bStrikedOut; bool m_bStrikedOut;
bool m_bWasEmbedded; bool m_bWasEmbedded;
bool m_isBase14;
PdfName m_Identifier; PdfName m_Identifier;
}; };
PdfFont* CreateBase14Font(const char* pszFontName, const PdfEncoding * cons
t pEncoding,PdfVecObjects *pvecObjects);
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFont::SetBold( bool bBold ) void PdfFont::SetBold( bool bBold )
{ {
m_bBold = bBold; m_bBold = bBold;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
skipping to change at line 295 skipping to change at line 299
void PdfFont::SetFontScale( float fScale ) void PdfFont::SetFontScale( float fScale )
{ {
m_pMetrics->SetFontScale( fScale ); m_pMetrics->SetFontScale( fScale );
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
float PdfFont::GetFontScale() const float PdfFont::GetFontScale() const
{ {
return m_pMetrics->GetFontScale(); return m_pMetrics->GetFontScale();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
void PdfFont::SetFontCharSpace( float fCharSpace ) void PdfFont::SetFontCharSpace( float fCharSpace )
{ {
m_pMetrics->SetFontCharSpace( fCharSpace ); m_pMetrics->SetFontCharSpace( fCharSpace );
} }
skipping to change at line 320 skipping to change at line 324
{ {
return m_pMetrics->GetFontCharSpace(); return m_pMetrics->GetFontCharSpace();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const PdfEncoding* PdfFont::GetEncoding() const const PdfEncoding* PdfFont::GetEncoding() const
{ {
return m_pEncoding; return m_pEncoding;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
PdfFontMetrics* PdfFont::GetFontMetrics2() PdfFontMetrics* PdfFont::GetFontMetrics2()
{ {
return m_pMetrics; return m_pMetrics;
} }
 End of changes. 5 change blocks. 
2 lines changed or deleted 8 lines changed or added


 PdfFontCID.h   PdfFontCID.h 
skipping to change at line 29 skipping to change at line 29
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_FONT_CID_H_ #ifndef _PDF_FONT_CID_H_
#define _PDF_FONT_CID_H_ #define _PDF_FONT_CID_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfFont.h" #include "PdfFont.h"
namespace PoDoFo { namespace PoDoFo {
class PdfFontMetricsFreetype;
/** A PdfFont that represents a CID font. /** A PdfFont that represents a CID font.
*/ */
class PdfFontCID : public PdfFont { class PdfFontCID : public PdfFont {
public: public:
/** Create a new CID font. /** Create a new CID font.
* *
* \param pMetrics pointer to a font metrics object. The font in the P DF * \param pMetrics pointer to a font metrics object. The font in the P DF
* file will match this fontmetrics object. The metrics object is * file will match this fontmetrics object. The metrics object is
* deleted along with the font. * deleted along with the font.
skipping to change at line 92 skipping to change at line 94
* \param bEmbed if true embed the font data into the PDF file. * \param bEmbed if true embed the font data into the PDF file.
*/ */
void Init( bool bEmbed ); void Init( bool bEmbed );
/** Embed the font file directly into the PDF file. /** Embed the font file directly into the PDF file.
* *
* \param pDescriptor font descriptor object * \param pDescriptor font descriptor object
*/ */
void EmbedFont( PdfObject* pDescriptor ); void EmbedFont( PdfObject* pDescriptor );
protected:
// Peter Petrov 24 September 2008 // Peter Petrov 24 September 2008
PdfObject* m_pDescriptor; PdfObject* m_pDescriptor;
}; };
}; };
#endif // _PDF_FONT_CID_H_ #endif // _PDF_FONT_CID_H_
 End of changes. 3 change blocks. 
1 lines changed or deleted 3 lines changed or added


 PdfFontFactory.h   PdfFontFactory.h 
skipping to change at line 72 skipping to change at line 72
/** Create a new PdfFont from an existing /** Create a new PdfFont from an existing
* font in a PDF file. * font in a PDF file.
* *
* \param pLibrary handle to the FreeType library, so that a PdfFontMe trics * \param pLibrary handle to the FreeType library, so that a PdfFontMe trics
* can be constructed for this font * can be constructed for this font
* \param pObject a PDF font object * \param pObject a PDF font object
*/ */
static PdfFont* CreateFont( FT_Library* pLibrary, PdfObject* pObject ); static PdfFont* CreateFont( FT_Library* pLibrary, PdfObject* pObject );
// static PdfFont* CreateBase14Font(const char* pszFontName, const PdfE
ncoding * const pEncoding,PdfVecObjects *pvecObjects);
/** Try to guess the fonttype from a the filename of a font file. /** Try to guess the fonttype from a the filename of a font file.
* *
* \param pszFilename filename of a fontfile * \param pszFilename filename of a fontfile
* \returns the font type * \returns the font type
*/ */
static EPdfFontType GetFontType( const char* pszFilename ); static EPdfFontType GetFontType( const char* pszFilename );
private: private:
/** Actually creates the font object for the requested type. /** Actually creates the font object for the requested type.
* Throws an exception in case of an error. * Throws an exception in case of an error.
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added


 PdfFontMetrics.h   PdfFontMetrics.h 
skipping to change at line 28 skipping to change at line 28
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_FONT_METRICS_H_ #ifndef _PDF_FONT_METRICS_H_
#define _PDF_FONT_METRICS_H_ #define _PDF_FONT_METRICS_H_
#include "PdfDefines.h" #include "PdfDefines.h"
#include "Pdf3rdPtyForwardDecl.h" #include "Pdf3rdPtyForwardDecl.h"
#include "PdfString.h" #include "PdfString.h"
#ifndef PODOFO_CONVERSION_CONSTANT
#define PODOFO_CONVERSION_CONSTANT 0.002834645669291339
#endif // PODOFO_CONVERSION_CONSTANT
namespace PoDoFo { namespace PoDoFo {
class PdfArray; class PdfArray;
class PdfObject; class PdfObject;
class PdfVariant; class PdfVariant;
/** /**
* Enum for the different font formats supported by PoDoFo * This abstract class provides access
* to fontmetrics informations.
*/ */
enum EPdfFontType {
ePdfFontType_TrueType,
ePdfFontType_Type1Pfa,
ePdfFontType_Type1Pfb,
ePdfFontType_Unknown = 0xff
};
class PODOFO_API PdfFontMetrics { class PODOFO_API PdfFontMetrics {
public: public:
/** Create a font metrics object for a given true type file PdfFontMetrics( EPdfFontType eFontType, const char* pszFilename, const
* \param pLibrary handle to an initialized FreeType2 library handle char* pszSubsetPrefix );
* \param pszFilename filename of a truetype file
* \param pszSubsetPrefix unique prefix for font subsets (see GetFontS
ubsetPrefix)
*/
PdfFontMetrics( FT_Library* pLibrary, const char* pszFilename,
const char* pszSubsetPrefix = NULL );
/** Create a font metrics object for a given memory buffer
* \param pLibrary handle to an initialized FreeType2 library handle
* \param pBuffer block of memory representing the font data (PdfFontM
etrics will copy the buffer)
* \param nBufLen the length of the buffer
* \param pszSubsetPrefix unique prefix for font subsets (see GetFontS
ubsetPrefix)
*/
PdfFontMetrics( FT_Library* pLibrary, const char* pBuffer, unsigned int
nBufLen,
const char* pszSubsetPrefix = NULL);
/** Create a font metrics object for a given true type file
* \param pLibrary handle to an initialized FreeType2 library handle
* \param rBuffer a buffer containing a font file
* \param pszSubsetPrefix unique prefix for font subsets (see GetFontS
ubsetPrefix)
*/
PdfFontMetrics( FT_Library* pLibrary, const PdfRefCountedBuffer & rBuff
er,
const char* pszSubsetPrefix = NULL);
/** Create a font metrics object for a given freetype font.
* \param pLibrary handle to an initialized FreeType2 library handle
* \param face a valid freetype font face
* \param pszSubsetPrefix unique prefix for font subsets (see GetFontS
ubsetPrefix)
*/
PdfFontMetrics( FT_Library* pLibrary, FT_Face face,
const char* pszSubsetPrefix = NULL);
/** Create a font metrics object based on an existing PdfObject
*
* \param pLibrary handle to an initialized FreeType2 library handle
* \param pObject an existing font descriptor object
*/
PdfFontMetrics( FT_Library* pLibrary, PdfObject* pDescriptor );
virtual ~PdfFontMetrics(); virtual ~PdfFontMetrics();
/** Create a width array for this font which is a required part /** Create a width array for this font which is a required part
* of every font dictionary. * of every font dictionary.
* \param var the final width array is written to this PdfVariant * \param var the final width array is written to this PdfVariant
* \param nFirst first character to be in the array * \param nFirst first character to be in the array
* \param nLast last character code to be in the array * \param nLast last character code to be in the array
*/ */
void GetWidthArray( PdfVariant & var, unsigned int nFirst, unsigned int nLast ) const; virtual void GetWidthArray( PdfVariant & var, unsigned int nFirst, unsi gned int nLast ) const = 0;
/** Get the width of a single glyph id /** Get the width of a single glyph id
* *
* \returns the width of a single glyph id * \returns the width of a single glyph id
*/ */
double GetGlyphWidth( int nGlyphId ) const; virtual double GetGlyphWidth( int nGlyphId ) const = 0;
/** Create the bounding box array as required by the PDF reference /** Create the bounding box array as required by the PDF reference
* so that it can be written directly to a PDF file. * so that it can be written directly to a PDF file.
* *
* \param array write the bounding box to this array. * \param array write the bounding box to this array.
*/ */
void GetBoundingBox( PdfArray & array ) const; virtual void GetBoundingBox( PdfArray & array ) const = 0;
/** Retrieve the width of a given text string in PDF units when /** Retrieve the width of a given text string in PDF units when
* drawn with the current font * drawn with the current font
* \param rsString a PdfString from which the width shall be calculate d * \param rsString a PdfString from which the width shall be calculate d
* \returns the width in PDF units * \returns the width in PDF units
* *
* This is an overloaded method for your convinience! * This is an overloaded method for your convinience!
*/ */
inline double StringWidth( const PdfString & rsString ) const; inline double StringWidth( const PdfString & rsString ) const;
skipping to change at line 139 skipping to change at line 90
double StringWidth( const char* pszText, pdf_long nLength = 0 ) const; double StringWidth( const char* pszText, pdf_long nLength = 0 ) const;
/** Retrieve the width of a given text string in PDF units when /** Retrieve the width of a given text string in PDF units when
* drawn with the current font * drawn with the current font
* \param pszText a text string of which the width should be calculate d * \param pszText a text string of which the width should be calculate d
* \param nLength if != 0 only the width of the nLength first characte rs is calculated * \param nLength if != 0 only the width of the nLength first characte rs is calculated
* \returns the width in PDF units * \returns the width in PDF units
*/ */
double StringWidth( const pdf_utf16be* pszText, unsigned int nLength = 0 ) const; double StringWidth( const pdf_utf16be* pszText, unsigned int nLength = 0 ) const;
#ifndef _WCHAR_T_DEFINED
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f #if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else #else
/** Retrieve the width of a given text string in PDF units when /** Retrieve the width of a given text string in PDF units when
* drawn with the current font * drawn with the current font
* \param pszText a text string of which the width should be calculate d * \param pszText a text string of which the width should be calculate d
* \param nLength if != 0 only the width of the nLength first characte rs is calculated * \param nLength if != 0 only the width of the nLength first characte rs is calculated
* \returns the width in PDF units * \returns the width in PDF units
*/ */
double StringWidth( const wchar_t* pszText, unsigned int nLength = 0 ) const; double StringWidth( const wchar_t* pszText, unsigned int nLength = 0 ) const;
#endif #endif
#endif
/** Retrieve the width of a given text string in 1/1000th mm when /** Retrieve the width of a given text string in 1/1000th mm when
* drawn with the current font * drawn with the current font
* \param pszText a text string of which the width should be calculate d * \param pszText a text string of which the width should be calculate d
* \param nLength if != 0 only the width of the nLength first characte rs is calculated * \param nLength if != 0 only the width of the nLength first characte rs is calculated
* \returns the width in 1/1000th mm * \returns the width in 1/1000th mm
*/ */
unsigned long StringWidthMM( const char* pszText, unsigned int nLength = 0 ) const; inline unsigned long StringWidthMM( const char* pszText, unsigned int n Length = 0 ) const;
/** Retrieve the width of a given text string in 1/1000th mm when /** Retrieve the width of a given text string in 1/1000th mm when
* drawn with the current font * drawn with the current font
* \param pszText a text string of which the width should be calculate d * \param pszText a text string of which the width should be calculate d
* \param nLength if != 0 only the width of the nLength first characte rs is calculated * \param nLength if != 0 only the width of the nLength first characte rs is calculated
* \returns the width in 1/1000th mm * \returns the width in 1/1000th mm
*/ */
unsigned long StringWidthMM( const pdf_utf16be* pszText, unsigned int n Length = 0 ) const; inline unsigned long StringWidthMM( const pdf_utf16be* pszText, unsigne d int nLength = 0 ) const;
#ifndef _WCHAR_T_DEFINED
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f #if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else #else
/** Retrieve the width of a given text string in 1/1000th mm when /** Retrieve the width of a given text string in 1/1000th mm when
* drawn with the current font * drawn with the current font
* \param pszText a text string of which the width should be calculate d * \param pszText a text string of which the width should be calculate d
* \param nLength if != 0 only the width of the nLength first characte rs is calculated * \param nLength if != 0 only the width of the nLength first characte rs is calculated
* \returns the width in 1/1000th mm * \returns the width in 1/1000th mm
*/ */
unsigned long StringWidthMM( const wchar_t* pszText, unsigned int nLeng inline unsigned long StringWidthMM( const wchar_t* pszText, unsigned in
th = 0 ) const; t nLength = 0 ) const;
#endif
#endif #endif
/** Retrieve the width of the given character in PDF units in the curre nt font /** Retrieve the width of the given character in PDF units in the curre nt font
* \param c character * \param c character
* \returns the width in PDF units * \returns the width in PDF units
*/ */
double CharWidth( unsigned char c ) const; virtual double CharWidth( unsigned char c ) const = 0;
// Peter Petrov 20 March 2009 // Peter Petrov 20 March 2009
/** Retrieve the width of the given character in PDF units in the curre nt font /** Retrieve the width of the given character in PDF units in the curre nt font
* \param c character * \param c character
* \returns the width in PDF units * \returns the width in PDF units
*/ */
double UnicodeCharWidth( unsigned short c ) const; virtual double UnicodeCharWidth( unsigned short c ) const = 0;
/** Retrieve the width of the given character in 1/1000th mm in the cur rent font /** Retrieve the width of the given character in 1/1000th mm in the cur rent font
* \param c character * \param c character
* \returns the width in 1/1000th mm * \returns the width in 1/1000th mm
*/ */
unsigned long CharWidthMM( unsigned char c ) const; inline unsigned long CharWidthMM( unsigned char c ) const;
/** Retrieve the line spacing for this font /** Retrieve the line spacing for this font
* \returns the linespacing in PDF units * \returns the linespacing in PDF units
*/ */
inline double GetLineSpacing() const; virtual double GetLineSpacing() const = 0;
/** Retrieve the line spacing for this font /** Retrieve the line spacing for this font
* \returns the linespacing in 1/1000th mm * \returns the linespacing in 1/1000th mm
*/ */
inline unsigned long GetLineSpacingMM() const; inline unsigned long GetLineSpacingMM() const;
/** Get the width of the underline for the current /** Get the width of the underline for the current
* font size in PDF units * font size in PDF units
* \returns the thickness of the underline in PDF units * \returns the thickness of the underline in PDF units
*/ */
inline double GetUnderlineThickness() const; virtual double GetUnderlineThickness() const = 0;
/** Get the width of the underline for the current /** Get the width of the underline for the current
* font size in 1/1000th mm * font size in 1/1000th mm
* \returns the thickness of the underline in 1/1000th mm * \returns the thickness of the underline in 1/1000th mm
*/ */
inline unsigned long GetUnderlineThicknessMM() const; inline unsigned long GetUnderlineThicknessMM() const;
/** Return the position of the underline for the current font /** Return the position of the underline for the current font
* size in PDF units * size in PDF units
* \returns the underline position in PDF units * \returns the underline position in PDF units
*/ */
inline double GetUnderlinePosition() const; virtual double GetUnderlinePosition() const = 0;
/** Return the position of the underline for the current font /** Return the position of the underline for the current font
* size in 1/1000th mm * size in 1/1000th mm
* \returns the underline position in 1/1000th mm * \returns the underline position in 1/1000th mm
*/ */
inline long GetUnderlinePositionMM() const; inline long GetUnderlinePositionMM() const;
/** Return the position of the strikeout for the current font /** Return the position of the strikeout for the current font
* size in PDF units * size in PDF units
* \returns the underline position in PDF units * \returns the underline position in PDF units
*/ */
inline double GetStrikeOutPosition() const; virtual double GetStrikeOutPosition() const = 0;
/** Return the position of the strikeout for the current font /** Return the position of the strikeout for the current font
* size in 1/1000th mm * size in 1/1000th mm
* \returns the underline position in 1/1000th mm * \returns the underline position in 1/1000th mm
*/ */
inline unsigned long GetStrikeOutPositionMM() const; inline unsigned long GetStrikeOutPositionMM() const;
/** Get the width of the strikeout for the current /** Get the width of the strikeout for the current
* font size in PDF units * font size in PDF units
* \returns the thickness of the strikeout in PDF units * \returns the thickness of the strikeout in PDF units
*/ */
inline double GetStrikeoutThickness() const; virtual double GetStrikeoutThickness() const = 0;
/** Get the width of the strikeout for the current /** Get the width of the strikeout for the current
* font size in 1/1000th mm * font size in 1/1000th mm
* \returns the thickness of the strikeout in 1/1000th mm * \returns the thickness of the strikeout in 1/1000th mm
*/ */
inline unsigned long GetStrikeoutThicknessMM() const; inline unsigned long GetStrikeoutThicknessMM() const;
/** Get a pointer to the path of the font file. /** Get a pointer to the path of the font file.
* \returns a zero terminated string containing the filename of the fo nt file * \returns a zero terminated string containing the filename of the fo nt file
*/ */
inline const char* GetFilename() const; inline const char* GetFilename() const;
/** Get a pointer to the actual font data - if it was loaded from memor y. /** Get a pointer to the actual font data - if it was loaded from memor y.
* \returns a binary buffer of data containing the font data * \returns a binary buffer of data containing the font data
*/ */
inline const char* GetFontData() const; virtual const char* GetFontData() const = 0;
/** Get the length of the actual font data - if it was loaded from memo ry. /** Get the length of the actual font data - if it was loaded from memo ry.
* \returns a the length of the font data * \returns a the length of the font data
*/ */
inline pdf_long GetFontDataLen() const; virtual pdf_long GetFontDataLen() const = 0;
/** Get a string with the postscript name of the font. /** Get a string with the postscript name of the font.
* \returns the postscript name of the font or NULL string if no posts cript name is available. * \returns the postscript name of the font or NULL string if no posts cript name is available.
*/ */
const char* GetFontname() const; virtual const char* GetFontname() const = 0;
/** /**
* \returns NULL or a 6 uppercase letter and "+" sign prefix * \returns NULL or a 6 uppercase letter and "+" sign prefix
* used for font subsets * used for font subsets
*/ */
const char* GetSubsetFontnamePrefix() const; inline const char* GetSubsetFontnamePrefix() const;
/** Get the weight of this font. /** Get the weight of this font.
* Used to build the font dictionay * Used to build the font dictionay
* \returns the weight of this font (500 is normal). * \returns the weight of this font (500 is normal).
*/ */
inline unsigned int GetWeight() const; virtual unsigned int GetWeight() const = 0;
/** Get the ascent of this font in PDF /** Get the ascent of this font in PDF
* units for the current font size. * units for the current font size.
* *
* \returns the ascender for this font * \returns the ascender for this font
* *
* \see GetPdfAscent * \see GetPdfAscent
*/ */
inline double GetAscent() const; virtual double GetAscent() const = 0;
/** Get the ascent of this font /** Get the ascent of this font
* Used to build the font dictionay * Used to build the font dictionay
* \returns the ascender for this font * \returns the ascender for this font
* *
* \see GetAscent * \see GetAscent
*/ */
inline double GetPdfAscent() const; virtual double GetPdfAscent() const = 0;
/** Get the descent of this font in PDF /** Get the descent of this font in PDF
* units for the current font size. * units for the current font size.
* This value is usually negative! * This value is usually negative!
* *
* \returns the descender for this font * \returns the descender for this font
* *
* \see GetPdfDescent * \see GetPdfDescent
*/ */
inline double GetDescent() const; virtual double GetDescent() const = 0;
/** Get the descent of this font /** Get the descent of this font
* Used to build the font dictionay * Used to build the font dictionay
* \returns the descender for this font * \returns the descender for this font
* *
* \see GetDescent * \see GetDescent
*/ */
inline double GetPdfDescent() const; virtual double GetPdfDescent() const = 0;
/** Get the italic angle of this font. /** Get the italic angle of this font.
* Used to build the font dictionay * Used to build the font dictionay
* \returns the italic angle of this font. * \returns the italic angle of this font.
*/ */
inline int GetItalicAngle() const; virtual int GetItalicAngle() const = 0;
/** Set the font size of this metrics object for width and height /** Set the font size of this metrics object for width and height
* calculations. * calculations.
* This is typically called from PdfFont for you. * This is typically called from PdfFont for you.
* *
* \param fSize font size in points * \param fSize font size in points
*/ */
void SetFontSize( float fSize ); inline void SetFontSize( float fSize );
/** Retrieve the current font size of this metrics object /** Retrieve the current font size of this metrics object
* \returns the current font size * \returns the current font size
*/ */
inline float GetFontSize() const; inline float GetFontSize() const;
/** Set the horizontal scaling of the font for compressing (< 100) and expanding (>100) /** Set the horizontal scaling of the font for compressing (< 100) and expanding (>100)
* This is typically called from PdfFont for you. * This is typically called from PdfFont for you.
* *
* \param fScale scaling in percent * \param fScale scaling in percent
*/ */
void SetFontScale( float fScale ); inline void SetFontScale( float fScale );
/** Retrieve the current horizontal scaling of this metrics object /** Retrieve the current horizontal scaling of this metrics object
* \returns the current font scaling * \returns the current font scaling
*/ */
inline float GetFontScale() const; inline float GetFontScale() const;
/** Set the character spacing of this metrics object /** Set the character spacing of this metrics object
* \param fCharSpace character spacing in percent * \param fCharSpace character spacing in percent
*/ */
void SetFontCharSpace( float fCharSpace ); inline void SetFontCharSpace( float fCharSpace );
/** Retrieve the current character spacing of this metrics object /** Retrieve the current character spacing of this metrics object
* \returns the current font character spacing * \returns the current font character spacing
*/ */
inline float GetFontCharSpace() const; inline float GetFontCharSpace() const;
/** /**
* \returns the fonttype of the loaded font * \returns the fonttype of the loaded font
*/ */
inline EPdfFontType GetFontType() const; inline EPdfFontType GetFontType() const;
/** Get the glyph id for a unicode character /** Get the glyph id for a unicode character
* in the current font. * in the current font.
* *
* \param lUnicode the unicode character value * \param lUnicode the unicode character value
* \returns the glyhph id for the character or 0 if the glyph was not found. * \returns the glyhph id for the character or 0 if the glyph was not found.
*/ */
long GetGlyphId( long lUnicode ) const; virtual long GetGlyphId( long lUnicode ) const = 0;
/** Get direct access to the internal FreeType handle
*
* \returns the internal freetype handle
*/
inline FT_Face GetFace();
/** Symbol fonts do need special treatment in a few cases. /** Symbol fonts do need special treatment in a few cases.
* Use this method to check if the current font is a symbol * Use this method to check if the current font is a symbol
* font. Symbold fonts are detected by checking * font. Symbold fonts are detected by checking
* if they use FT_ENCODING_MS_SYMBOL as internal encoding. * if they use FT_ENCODING_MS_SYMBOL as internal encoding.
* *
* \returns true if this is a symbol font * \returns true if this is a symbol font
*/ */
inline bool IsSymbol() const; virtual bool IsSymbol() const = 0;
private:
/** Initialize this object from an in memory buffer
* Called internally by the constructors
*/
void InitFromBuffer();
/** Load the metric data from the FTFace data
* Called internally by the constructors
*/
void InitFromFace();
/** Try to detect the internal fonttype from /** Try to detect the internal fonttype from
* the file extension of a fontfile. * the file extension of a fontfile.
* *
* This function will set the member m_eFontType.
*
* \param pszFilename must be the filename of a font file * \param pszFilename must be the filename of a font file
*
* \return font type
*/ */
void SetFontTypeFromFilename( const char* pszFilename ); static EPdfFontType FontTypeFromFilename( const char* pszFilename );
public:
FT_Face m_face;
// Peter Petrov 19 March 2009
std::string m_sFilename;
protected: protected:
FT_Library* m_pLibrary; /**
* Set the fonttype.
private: * \param eFontType fonttype
bool m_bSymbol; ///< Internal member to singnal a symbol font */
inline void SetFontType(EPdfFontType eFontType);
unsigned int m_nWeight;
int m_nItalicAngle;
double m_dAscent;
double m_dPdfAscent;
double m_dDescent;
double m_dPdfDescent;
double m_dLineSpacing;
double m_dUnderlineThickness;
double m_dUnderlinePosition;
double m_dStrikeOutThickness;
double m_dStrikeOutPosition;
PdfRefCountedBuffer m_bufFontData; protected:
std::string m_sFilename;
float m_fFontSize; float m_fFontSize;
float m_fFontScale; float m_fFontScale;
float m_fFontCharSpace; float m_fFontCharSpace;
std::vector<double> m_vecWidth; std::vector<double> m_vecWidth;
EPdfFontType m_eFontType; EPdfFontType m_eFontType;
std::string m_sFontSubsetPrefix; std::string m_sFontSubsetPrefix;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::StringWidth( const PdfString & rsString ) const unsigned long PdfFontMetrics::CharWidthMM( unsigned char c ) const
{ {
return (rsString.IsUnicode() ? this->StringWidth( rsString.GetUnicode( ) ) : this->StringWidth( rsString.GetString() )); return static_cast<unsigned long>(this->CharWidth( c ) / PODOFO_CONVERS ION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::GetLineSpacing() const double PdfFontMetrics::StringWidth( const PdfString & rsString ) const
{ {
return m_dLineSpacing; return (rsString.IsUnicode() ? this->StringWidth( rsString.GetUnicode( ) ) : this->StringWidth( rsString.GetString() ));
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFontMetrics::GetLineSpacingMM() const unsigned long PdfFontMetrics::StringWidthMM( const char* pszText, unsigned int nLength ) const
{ {
return static_cast<unsigned long>(m_dLineSpacing / PODOFO_CONVERSION_CO NSTANT); return static_cast<unsigned long>(this->StringWidth( pszText, nLength ) / PODOFO_CONVERSION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::GetUnderlinePosition() const unsigned long PdfFontMetrics::StringWidthMM( const pdf_utf16be* pszText, un signed int nLength ) const
{ {
return m_dUnderlinePosition; return static_cast<unsigned long>(this->StringWidth( pszText, nLength ) / PODOFO_CONVERSION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
long PdfFontMetrics::GetUnderlinePositionMM() const #ifndef _WCHAR_T_DEFINED
#if defined(_MSC_VER) && _MSC_VER <= 1200 // nicht f
#else
unsigned long PdfFontMetrics::StringWidthMM( const wchar_t* pszText, unsign
ed int nLength ) const
{ {
return static_cast<long>(m_dUnderlinePosition / PODOFO_CONVERSION_CONS TANT); return static_cast<unsigned long>(this->StringWidth( pszText, nLength ) / PODOFO_CONVERSION_CONSTANT);
} }
#endif
#endif
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::GetStrikeOutPosition() const unsigned long PdfFontMetrics::GetLineSpacingMM() const
{ {
return m_dStrikeOutPosition; return static_cast<unsigned long>(this->GetLineSpacing() / PODOFO_CONVE RSION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFontMetrics::GetStrikeOutPositionMM() const long PdfFontMetrics::GetUnderlinePositionMM() const
{ {
return static_cast<long>(m_dStrikeOutPosition / PODOFO_CONVERSI ON_CONSTANT); return static_cast<long>(this->GetUnderlinePosition() / PODOFO_CONVERS ION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::GetUnderlineThickness() const unsigned long PdfFontMetrics::GetStrikeOutPositionMM() const
{ {
return m_dUnderlineThickness; return static_cast<long>(this->GetStrikeOutPosition() / PODOFO_CONV ERSION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFontMetrics::GetUnderlineThicknessMM() const unsigned long PdfFontMetrics::GetUnderlineThicknessMM() const
{ {
return static_cast<unsigned long>(m_dUnderlineThickness / PODOFO_CONVER return static_cast<unsigned long>(this->GetUnderlineThickness() / PODOF
SION_CONSTANT); O_CONVERSION_CONSTANT);
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfFontMetrics::GetStrikeoutThickness() const
{
return m_dStrikeOutThickness;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
unsigned long PdfFontMetrics::GetStrikeoutThicknessMM() const unsigned long PdfFontMetrics::GetStrikeoutThicknessMM() const
{ {
return static_cast<unsigned long>(m_dStrikeOutThickness / PODOFO_CONVER SION_CONSTANT); return static_cast<unsigned long>(this->GetStrikeoutThickness() / PODOF O_CONVERSION_CONSTANT);
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const char* PdfFontMetrics::GetFilename() const const char* PdfFontMetrics::GetFilename() const
{ {
return m_sFilename.c_str(); return m_sFilename.c_str();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
const char* PdfFontMetrics::GetFontData() const EPdfFontType PdfFontMetrics::GetFontType() const
{
return m_bufFontData.GetBuffer();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
pdf_long PdfFontMetrics::GetFontDataLen() const
{
return m_bufFontData.GetSize();
}
// -----------------------------------------------------
//
// -----------------------------------------------------
unsigned int PdfFontMetrics::GetWeight() const
{
return m_nWeight;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfFontMetrics::GetAscent() const
{
return m_dAscent;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
double PdfFontMetrics::GetPdfAscent() const
{ {
return m_dPdfAscent; return m_eFontType;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::GetDescent() const void PdfFontMetrics::SetFontType(EPdfFontType eFontType)
{ {
return m_dDescent; m_eFontType = eFontType;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
double PdfFontMetrics::GetPdfDescent() const float PdfFontMetrics::GetFontSize() const
{ {
return m_dPdfDescent; return m_fFontSize;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
int PdfFontMetrics::GetItalicAngle() const void PdfFontMetrics::SetFontSize( float fSize )
{ {
return m_nItalicAngle; m_fFontSize = fSize;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
EPdfFontType PdfFontMetrics::GetFontType() const float PdfFontMetrics::GetFontScale() const
{
return m_eFontType;
}
// -----------------------------------------------------
//
// -----------------------------------------------------
float PdfFontMetrics::GetFontSize() const
{ {
return m_fFontSize; return m_fFontScale;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
float PdfFontMetrics::GetFontScale() const float PdfFontMetrics::GetFontCharSpace() const
{ {
return m_fFontScale; return m_fFontCharSpace;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
float PdfFontMetrics::GetFontCharSpace() const const char* PdfFontMetrics::GetSubsetFontnamePrefix() const
{ {
return m_fFontCharSpace; return m_sFontSubsetPrefix.c_str();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
FT_Face PdfFontMetrics::GetFace() void PdfFontMetrics::SetFontScale( float fScale )
{ {
return m_face; m_fFontScale = fScale;
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
bool PdfFontMetrics::IsSymbol() const void PdfFontMetrics::SetFontCharSpace( float fCharSpace )
{ {
return m_bSymbol; m_fFontCharSpace = fCharSpace;
} }
}; };
#endif // _PDF_FONT_METRICS_H_ #endif // _PDF_FONT_METRICS_H_
 End of changes. 78 change blocks. 
219 lines changed or deleted 91 lines changed or added


 PdfFontType1.h   PdfFontType1.h 
skipping to change at line 66 skipping to change at line 66
PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing, PdfFontType1( PdfFontMetrics* pMetrics, const PdfEncoding* const pEncod ing,
PdfObject* pObject ); PdfObject* pObject );
/** Create a PdfFont based on an existing PdfFont with a new id /** Create a PdfFont based on an existing PdfFont with a new id
* \param pFont pointer to existing font * \param pFont pointer to existing font
* \param pszSuffix Suffix to add to font-id * \param pszSuffix Suffix to add to font-id
* \param pParent parent of the font object * \param pParent parent of the font object
*/ */
PdfFontType1( PdfFontType1* pFont, PdfFontMetrics* pMetrics, const char *pszSuffix, PdfVecObjects* pParent ); PdfFontType1( PdfFontType1* pFont, PdfFontMetrics* pMetrics, const char *pszSuffix, PdfVecObjects* pParent );
protected: void InitBase14Font();
protected:
/** Embed the font file directly into the PDF file. /** Embed the font file directly into the PDF file.
* *
* \param pDescriptor font descriptor object * \param pDescriptor font descriptor object
*/ */
virtual void EmbedFontFile( PdfObject* pDescriptor ); virtual void EmbedFontFile( PdfObject* pDescriptor );
private: private:
pdf_long FindInBuffer( const char* pszNeedle, const char* pszHaystack, pdf_long lLen ) const; pdf_long FindInBuffer( const char* pszNeedle, const char* pszHaystack, pdf_long lLen ) const;
 End of changes. 1 change blocks. 
1 lines changed or deleted 3 lines changed or added


 PdfMemoryManagement.h   PdfMemoryManagement.h 
skipping to change at line 24 skipping to change at line 24
* * * *
* You should have received a copy of the GNU Library General Public * * You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the * * License along with this program; if not, write to the *
* Free Software Foundation, Inc., * * Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_MEMORY_MANAGEMENT_H_ #ifndef _PDF_MEMORY_MANAGEMENT_H_
#define _PDF_MEMORY_MANAGEMENT_H_ #define _PDF_MEMORY_MANAGEMENT_H_
#include "PdfDefines.h"
#include <stdlib.h> #include <stdlib.h>
namespace PoDoFo { namespace PoDoFo {
/** /**
* Wrapper around malloc of the c-library used by PoDoFo. * Wrapper around malloc of the c-library used by PoDoFo.
* *
* Is used to allocate buffers inside of PoDoFo. * Is used to allocate buffers inside of PoDoFo.
*/ */
void* podofo_malloc( size_t size ); PODOFO_API void* podofo_malloc( size_t size );
/** /**
* Wrapper around realloc of the c-library used by PoDoFo. * Wrapper around realloc of the c-library used by PoDoFo.
*/ */
void* podofo_realloc( void* buffer, size_t size ); PODOFO_API void* podofo_realloc( void* buffer, size_t size );
/** /**
* Wrapper around free of the c-library used by PoDoFo. * Wrapper around free of the c-library used by PoDoFo.
* *
* Use this to free memory allocated inside of PoDoFo * Use this to free memory allocated inside of PoDoFo
* with podofo_malloc. * with podofo_malloc.
*/ */
void podofo_free( void* buffer ); PODOFO_API void podofo_free( void* buffer );
}; };
#endif // _PDF_XREF_STREAM_PARSER_OBJECT_H_ #endif // _PDF_XREF_STREAM_PARSER_OBJECT_H_
 End of changes. 4 change blocks. 
3 lines changed or deleted 4 lines changed or added


 PdfPage.h   PdfPage.h 
skipping to change at line 79 skipping to change at line 79
*/ */
PdfPage( PdfObject* pObject, const std::deque<PdfObject*> & listOfParen ts ); PdfPage( PdfObject* pObject, const std::deque<PdfObject*> & listOfParen ts );
virtual ~PdfPage(); virtual ~PdfPage();
/** Get the current page size in PDF Units /** Get the current page size in PDF Units
* \returns a PdfRect containing the page size available for drawing * \returns a PdfRect containing the page size available for drawing
*/ */
inline virtual const PdfRect GetPageSize() const; inline virtual const PdfRect GetPageSize() const;
// added by Petr P. Petrov 21 Febrary 2010
/** Set the current page width in PDF Units
*
* \returns true if successfull, false otherwise
*
*/
bool SetPageWidth(int newWidth);
// added by Petr P. Petrov 21 Febrary 2010
/** Set the current page height in PDF Units
*
* \returns true if successfull, false otherwise
*
*/
bool SetPageHeight(int newHeight);
/** Page number inside of the document. The first page /** Page number inside of the document. The first page
* has the number 1, the last page has the number * has the number 1, the last page has the number
* PdfPagesTree:GetTotalNumberOfPages() * PdfPagesTree:GetTotalNumberOfPages()
* *
* \returns the number of the page inside of the document * \returns the number of the page inside of the document
* *
* \see PdfPagesTree:GetTotalNumberOfPages() * \see PdfPagesTree:GetTotalNumberOfPages()
*/ */
unsigned int GetPageNumber() const; unsigned int GetPageNumber() const;
skipping to change at line 103 skipping to change at line 119
* \param bLandscape create a landscape pagesize instead of portrait ( by exchanging width and height) * \param bLandscape create a landscape pagesize instead of portrait ( by exchanging width and height)
* \returns a PdfRect object which can be passed to the PdfPage constr uctor * \returns a PdfRect object which can be passed to the PdfPage constr uctor
*/ */
static PdfRect CreateStandardPageSize( const EPdfPageSize ePageSize, bo ol bLandscape = false ); static PdfRect CreateStandardPageSize( const EPdfPageSize ePageSize, bo ol bLandscape = false );
/** Get access to the contents object of this page. /** Get access to the contents object of this page.
* If you want to draw onto the page, you have to add * If you want to draw onto the page, you have to add
* drawing commands to the stream of the Contents object. * drawing commands to the stream of the Contents object.
* \returns a contents object * \returns a contents object
*/ */
virtual PdfObject* GetContents() const { return m_pContents->GetContent s(); } virtual PdfObject* GetContents() const;
/** Get access an object that you can use to ADD drawing to. /** Get access an object that you can use to ADD drawing to.
* If you want to draw onto the page, you have to add * If you want to draw onto the page, you have to add
* drawing commands to the stream of the Contents object. * drawing commands to the stream of the Contents object.
* \returns a contents object * \returns a contents object
*/ */
virtual PdfObject* GetContentsForAppending() const { return m_pContents ->GetContentsForAppending(); } virtual PdfObject* GetContentsForAppending() const;
/** Get access to the resources object of this page. /** Get access to the resources object of this page.
* This is most likely an internal object. * This is most likely an internal object.
* \returns a resources object * \returns a resources object
*/ */
inline virtual PdfObject* GetResources() const; inline virtual PdfObject* GetResources() const;
/** Get the current MediaBox (physical page size) in PDF units. /** Get the current MediaBox (physical page size) in PDF units.
* \returns PdfRect the page box * \returns PdfRect the page box
*/ */
skipping to change at line 227 skipping to change at line 243
private: private:
/** /**
* Initialize a new page object. * Initialize a new page object.
* m_pContents must be initialized before calling this! * m_pContents must be initialized before calling this!
* *
* @param rSize page size * @param rSize page size
*/ */
void InitNewPage( const PdfRect & rSize ); void InitNewPage( const PdfRect & rSize );
/**
* Create the internal PdfContents object.
* Call this before accessing m_pContents as
* the object is only created if needed.
*/
void CreateContents();
/** Get the bounds of a specified page box in PDF units. /** Get the bounds of a specified page box in PDF units.
* This function is internal, since there are wrappers for all standard boxes * This function is internal, since there are wrappers for all standard boxes
* \returns PdfRect the page box * \returns PdfRect the page box
*/ */
const PdfRect GetPageBox( const char* inBox ) const; const PdfRect GetPageBox( const char* inBox ) const;
/** Private method for getting a key value that could be inherited (suc h as the boxes, resources, etc.) /** Private method for getting a key value that could be inherited (suc h as the boxes, resources, etc.)
* \returns PdfVariant - the result of the key fetching * \returns PdfVariant - the result of the key fetching
*/ */
PdfObject* GetInheritedKeyFromObject( const char* inKey, PdfObject* inO bject ) const; const PdfObject* GetInheritedKeyFromObject( const char* inKey, const Pd fObject* inObject ) const;
/** Get the annotations array. /** Get the annotations array.
* \param bCreate if true the annotations array is created * \param bCreate if true the annotations array is created
* if it does not exist. * if it does not exist.
* \returns the annotations array or NULL if none exists. * \returns the annotations array or NULL if none exists.
*/ */
PdfObject* GetAnnotationsArray( bool bCreate = false ) const; PdfObject* GetAnnotationsArray( bool bCreate = false ) const;
private: private:
PdfContents* m_pContents; PdfContents* m_pContents;
 End of changes. 5 change blocks. 
3 lines changed or deleted 26 lines changed or added


 PdfPagesTree.h   PdfPagesTree.h 
skipping to change at line 238 skipping to change at line 238
* \param rListOfParents all parents of the page node will be added to this lists, * \param rListOfParents all parents of the page node will be added to this lists,
* so that the PdfPage can later access inherite d attributes * so that the PdfPage can later access inherite d attributes
*/ */
/* /*
PdfObject* GetPageNodeFromTree( int nPageNum, const PdfArray & kidsArra y, PdfObject* GetPageNodeFromTree( int nPageNum, const PdfArray & kidsArra y,
std::deque<PdfObject*> & rListOfParents ); std::deque<PdfObject*> & rListOfParents );
*/ */
/** Private method to access the Root of the tree using a logical name /** Private method to access the Root of the tree using a logical name
*/ */
PdfObject* GetRoot() { return m_pObject; } PdfObject* GetRoot() { return this->GetObject(); }
const PdfObject* GetRoot() const { return m_pObject; } const PdfObject* GetRoot() const { return this->GetObject(); }
private: private:
PdfPagesTreeCache m_cache; PdfPagesTreeCache m_cache;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline void PdfPagesTree::ClearCache() inline void PdfPagesTree::ClearCache()
{ {
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 PdfVariant.h   PdfVariant.h 
skipping to change at line 28 skipping to change at line 28
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
************************************************************************** */ ************************************************************************** */
#ifndef _PDF_VARIANT_H_ #ifndef _PDF_VARIANT_H_
#define _PDF_VARIANT_H_ #define _PDF_VARIANT_H_
#include <cmath> #include <cmath>
#include "PdfDefines.h" #include "PdfDefines.h"
#include "PdfRefCountedBuffer.h" #include "PdfRefCountedBuffer.h"
#include "PdfString.h" #include "PdfString.h"
namespace PoDoFo { namespace PoDoFo {
class PdfArray; class PdfArray;
class PdfData; class PdfData;
class PdfDataType; class PdfDataType;
class PdfDictionary; class PdfDictionary;
class PdfEncrypt; class PdfEncrypt;
class PdfName; class PdfName;
 End of changes. 1 change blocks. 
1 lines changed or deleted 0 lines changed or added


 PdfXObject.h   PdfXObject.h 
skipping to change at line 154 skipping to change at line 154
PdfName m_Identifier; PdfName m_Identifier;
PdfReference m_Reference; PdfReference m_Reference;
}; };
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfObject* PdfXObject::GetContents() const inline PdfObject* PdfXObject::GetContents() const
{ {
return m_pObject; return this->GetNonConstObject();
} }
// ----------------------------------------------------- // -----------------------------------------------------
// //
// ----------------------------------------------------- // -----------------------------------------------------
inline PdfObject* PdfXObject::GetResources() const inline PdfObject* PdfXObject::GetResources() const
{ {
return m_pResources; return m_pResources;
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 podofo.h   podofo.h 
skipping to change at line 63 skipping to change at line 63
#include "PdfEncrypt.h" #include "PdfEncrypt.h"
#include "PdfError.h" #include "PdfError.h"
#include "PdfExtGState.h" #include "PdfExtGState.h"
#include "PdfField.h" #include "PdfField.h"
#include "PdfFileSpec.h" #include "PdfFileSpec.h"
#include "PdfFilter.h" #include "PdfFilter.h"
#include "PdfFont.h" #include "PdfFont.h"
#include "PdfFontCache.h" #include "PdfFontCache.h"
#include "PdfFontFactory.h" #include "PdfFontFactory.h"
#include "PdfFontMetrics.h" #include "PdfFontMetrics.h"
#include "PdfFontMetricsBase14.h"
#include "PdfFontMetricsFreetype.h"
#include "PdfFontMetricsObject.h"
#include "PdfFontTTFSubset.h" #include "PdfFontTTFSubset.h"
#include "PdfFunction.h" #include "PdfFunction.h"
#include "PdfImage.h" #include "PdfImage.h"
#include "PdfInfo.h" #include "PdfInfo.h"
#include "PdfInputDevice.h" #include "PdfInputDevice.h"
#include "PdfMemDocument.h" #include "PdfMemDocument.h"
#include "PdfMemStream.h" #include "PdfMemStream.h"
#include "PdfName.h" #include "PdfName.h"
#include "PdfNamesTree.h" #include "PdfNamesTree.h"
#include "PdfObject.h" #include "PdfObject.h"
 End of changes. 1 change blocks. 
0 lines changed or deleted 3 lines changed or added


 podofo_config.h   podofo_config.h 
skipping to change at line 13 skipping to change at line 13
/* /*
* *** THIS HEADER IS INCLUDED BY PdfCompilerCompat.h *** * *** THIS HEADER IS INCLUDED BY PdfCompilerCompat.h ***
* *** DO NOT INCLUDE DIRECTLY *** * *** DO NOT INCLUDE DIRECTLY ***
*/ */
#ifndef _PDF_COMPILERCOMPAT_H #ifndef _PDF_COMPILERCOMPAT_H
#error Please include PdfDefines.h instead #error Please include PdfDefines.h instead
#endif #endif
#define PODOFO_VERSION_MAJOR 0 #define PODOFO_VERSION_MAJOR 0
#define PODOFO_VERSION_MINOR 8 #define PODOFO_VERSION_MINOR 8
#define PODOFO_VERSION_PATCH 0 #define PODOFO_VERSION_PATCH 1
/* PoDoFo configuration options */ /* PoDoFo configuration options */
#define PODOFO_MULTI_THREAD #define PODOFO_MULTI_THREAD
/* somewhat platform-specific headers */ /* somewhat platform-specific headers */
#define PODOFO_HAVE_STRINGS_H 1 #define PODOFO_HAVE_STRINGS_H 1
#define PODOFO_HAVE_ARPA_INET_H 1 #define PODOFO_HAVE_ARPA_INET_H 1
/* #undef PODOFO_HAVE_WINSOCK2_H */ /* #undef PODOFO_HAVE_WINSOCK2_H */
/* #undef PODOFO_HAVE_MEM_H */ /* #undef PODOFO_HAVE_MEM_H */
/* #undef PODOFO_HAVE_CTYPE_H */ /* #undef PODOFO_HAVE_CTYPE_H */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/