summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pdfwriter_impl.cxx
diff options
context:
space:
mode:
authorPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2009-12-17 18:51:23 +0100
committerPhilipp Lohmann [pl] <Philipp.Lohmann@Sun.COM>2009-12-17 18:51:23 +0100
commitdaf7906ef7974878d7097649e4fa7669bdd6d53b (patch)
treeefa9ab4ce540b04e8b6b8dc9edba0723a0d8e4ad /vcl/source/gdi/pdfwriter_impl.cxx
parent817095aeb6e9293b649e0af48cb4fdc39a3f2ff4 (diff)
vcl108: #i106704# fix PFA case of Length3
Diffstat (limited to 'vcl/source/gdi/pdfwriter_impl.cxx')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx36
1 files changed, 22 insertions, 14 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index efec952ffbe2..cf94797db4f9 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2971,6 +2971,28 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
if( nIndex < 1 || nIndex <= nEndAsciiIndex )
goto streamend;
+
+ // nLength3 is the rest of the file - excluding any section headers
+ // nIndex now points to the first of the 512 '0' characters marking the
+ // fixed content portion
+ sal_Int32 nLength3 = nFontLen - nIndex;
+ for( it = aSections.begin(); it != aSections.end(); ++it )
+ {
+ if( *it >= nIndex )
+ {
+ // special case: nIndex inside a section marker
+ if( nIndex >= (*it) && (*it)+5 > nIndex )
+ nLength3 -= (*it)+5 - nIndex;
+ else
+ {
+ if( *it < nFontLen - 6 )
+ nLength3 -= 6;
+ else // the last section 0x8003 is only 2 bytes after all
+ nLength3 -= (nFontLen - *it);
+ }
+ }
+ }
+
// there may be whitespace to ignore before the 512 '0'
while( pFontData[nIndex] == '\r' || pFontData[nIndex] == '\n' )
{
@@ -2985,20 +3007,6 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const ImplFont
}
nEndBinaryIndex = nIndex;
- // nLength3 is the rest of the file - excluding any section headers
- sal_Int32 nLength3 = nFontLen - nIndex;
- for( it = aSections.begin(); it != aSections.end(); ++it )
- {
- if( *it >= nIndex )
- {
- // special case: nIndex inside a section marker
- if( nIndex >= *it )
- nLength3 -= (*it)+5 - nIndex;
- else
- nLength3 -= 5;
- }
- }
-
// search for beginning of binary section
nBeginBinaryIndex = nEndAsciiIndex;
do