summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-06-24 23:07:31 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-06-27 19:03:31 +0000
commitfeaebe7f93779d5c91c24c31ff91f756c69e9640 (patch)
tree70fe92162aad9c9da3ebb1fb1347cd88cc722017
parentd9b09a3ff38b2cf11ee0b9f9f03d47375f2b11e8 (diff)
Always embed 14 standard Postscript fonts in PDF
Ealier version of PDF standard allowed for not embedding the so called standard PostScript fonts in the PDF files and all PDF readers had to include them or a "suitable substitute". This behaviour had many issues and is deprecated for 10 years now. The current version of PDF spec says: Beginning with PDF 1.5, the special treatment given to the standard 14 fonts is deprecated. Conforming writers should represent all fonts using a complete font descriptor. For backwards capability, conforming readers shall still provide the special treatment identified for the standard 14 fonts. This commits removes support for not embedding these fonts, and the, now redundant, option to embed them. This has the side effect of elimanating the cause of fdo#66108 and fdo#41547. Change-Id: I4f1fc4137a2de7baeef9e504f2e4f84fbec0a491 Reviewed-on: https://gerrit.libreoffice.org/4495 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--filter/source/pdf/impdialog.cxx20
-rw-r--r--filter/source/pdf/impdialog.hrc1
-rw-r--r--filter/source/pdf/impdialog.hxx3
-rw-r--r--filter/source/pdf/impdialog.src8
-rw-r--r--filter/source/pdf/pdfexport.cxx7
-rw-r--r--filter/source/pdf/pdfexport.hxx1
-rw-r--r--include/vcl/pdfwriter.hxx3
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Common.xcs7
-rw-r--r--vcl/generic/print/genprnpsp.cxx1
-rw-r--r--vcl/source/gdi/outdev3.cxx60
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx210
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx15
12 files changed, 22 insertions, 314 deletions
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index 21e98aff408b..56534f0abaa3 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -80,13 +80,12 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
mbExportNotes( sal_True ),
mbViewPDF( sal_False ),
mbExportNotesPages( sal_False ),
mbUseTransitionEffects( sal_False ),
mbIsSkipEmptyPages( sal_True ),
mbAddStream( sal_False ),
- mbEmbedStandardFonts( sal_False ),
mnFormsType( 0 ),
mbExportFormFields( sal_True ),
mbAllowDuplicateFieldNames( sal_False ),
mbExportBookmarks( sal_True ),
mbExportHiddenSlides ( sal_False),
mnOpenBookmarkLevels( -1 ),
@@ -197,13 +196,12 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent,
if ( mbIsPresentation )
mbExportHiddenSlides = maConfigItem.ReadBool( "ExportHiddenSlides", sal_False );
mnOpenBookmarkLevels = maConfigItem.ReadInt32( "OpenBookmarkLevels", -1 );
mbUseTransitionEffects = maConfigItem.ReadBool( "UseTransitionEffects", sal_True );
mbIsSkipEmptyPages = maConfigItem.ReadBool( "IsSkipEmptyPages", sal_False );
mbAddStream = maConfigItem.ReadBool( "IsAddStream", sal_False );
- mbEmbedStandardFonts = maConfigItem.ReadBool( "EmbedStandardFonts", sal_False );
mnFormsType = maConfigItem.ReadInt32( "FormsType", 0 );
mbExportFormFields = maConfigItem.ReadBool( "ExportFormFields", sal_True );
if ( ( mnFormsType < 0 ) || ( mnFormsType > 3 ) )
mnFormsType = 0;
mbAllowDuplicateFieldNames = maConfigItem.ReadBool( "AllowDuplicateFieldNames", sal_False );
@@ -365,13 +363,12 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData()
maConfigItem.WriteBool( "ExportBookmarks", mbExportBookmarks );
if ( mbIsPresentation )
maConfigItem.WriteBool( "ExportHiddenSlides", mbExportHiddenSlides );
maConfigItem.WriteBool( "UseTransitionEffects", mbUseTransitionEffects );
maConfigItem.WriteBool( "IsSkipEmptyPages", mbIsSkipEmptyPages );
maConfigItem.WriteBool( "IsAddStream", mbAddStream );
- maConfigItem.WriteBool( "EmbedStandardFonts", mbEmbedStandardFonts );
/*
* FIXME: the entries are only implicitly defined by the resource file. Should there
* ever be an additional form submit format this could get invalid.
*/
maConfigItem.WriteInt32( "FormsType", mnFormsType );
@@ -501,26 +498,24 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
maCbTaggedPDF( this, PDFFilterResId( CB_TAGGEDPDF ) ),
mbTaggedPDFUserSelection( sal_False ),
maCbExportFormFields( this, PDFFilterResId( CB_EXPORTFORMFIELDS ) ),
mbExportFormFieldsUserSelection( sal_False ),
- mbEmbedStandardFontsUserSelection( sal_False ),
maFtFormsFormat( this, PDFFilterResId( FT_FORMSFORMAT ) ),
maLbFormsFormat( this, PDFFilterResId( LB_FORMSFORMAT ) ),
maCbAllowDuplicateFieldNames( this, PDFFilterResId( CB_ALLOWDUPLICATEFIELDNAMES ) ),
maCbExportBookmarks( this, PDFFilterResId( CB_EXPORTBOOKMARKS ) ),
maCbExportHiddenSlides( this, PDFFilterResId( CB_EXPORTHIDDENSLIDES ) ),
maCbExportNotes( this, PDFFilterResId( CB_EXPORTNOTES ) ),
maCbViewPDF( this, PDFFilterResId( CB_VIEWPDF ) ),
maCbExportNotesPages( this, PDFFilterResId( CB_EXPORTNOTESPAGES ) ),
maCbExportEmptyPages( this, PDFFilterResId( CB_EXPORTEMPTYPAGES ) ),
maCbAddStream( this, PDFFilterResId( CB_ADDSTREAM ) ),
maFtAddStreamDescription( this, PDFFilterResId( FT_ADDSTREAMDESCRIPTION ) ),
- maCbEmbedStandardFonts( this, PDFFilterResId( CB_EMBEDSTANDARDFONTS ) ),
maFlWatermark( this, PDFFilterResId( FL_WATERMARK ) ),
maCbWatermark( this, PDFFilterResId( CB_WATERMARK ) ),
maFtWatermark( this, PDFFilterResId(FT_WATERMARK)),
maEdWatermark( this, PDFFilterResId(ED_WATERMARK)),
mbIsPresentation( sal_False ),
@@ -532,17 +527,13 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent,
// pb: #i91991# maCbExportEmptyPages double-spaced if necessary
Size aSize = maCbExportEmptyPages.GetSizePixel();
Size aMinSize = maCbExportEmptyPages.CalcMinimumSize();
if ( aSize.Width() > aMinSize.Width() )
{
Size aNewSize = maCbExportNotes.GetSizePixel();
- long nDelta = aSize.Height() - aNewSize.Height();
maCbExportEmptyPages.SetSizePixel( aNewSize );
- Point aNewPos = maCbEmbedStandardFonts.GetPosPixel();
- aNewPos.Y() -= nDelta;
- maCbEmbedStandardFonts.SetPosPixel( aNewPos );
}
maEdPages.SetAccessibleName(maRbRange.GetText());
maEdPages.SetAccessibleRelationLabeledBy(&maRbRange);
maCbExportEmptyPages.SetStyle( maCbExportEmptyPages.GetStyle() | WB_VCENTER );
@@ -606,19 +597,17 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent
maCbExportFormFields.SetToggleHdl( LINK( this, ImpPDFTabGeneralPage, ToggleExportFormFieldsHdl ) );
// get the form values, for use with PDF/A-1 selection interface
mbTaggedPDFUserSelection = paParent->mbUseTaggedPDF;
mbExportFormFieldsUserSelection = paParent->mbExportFormFields;
- mbEmbedStandardFontsUserSelection = paParent->mbEmbedStandardFonts;
if( !maCbPDFA1b.IsChecked() )
{// the value for PDF/A set by the ToggleExportPDFAHdl method called before
maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
- maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
}
maLbFormsFormat.SelectEntryPos( (sal_uInt16)paParent->mnFormsType );
maLbFormsFormat.Enable( paParent->mbExportFormFields );
maCbAllowDuplicateFieldNames.Check( paParent->mbAllowDuplicateFieldNames );
maCbAllowDuplicateFieldNames.Enable( paParent->mbExportFormFields );
@@ -640,14 +629,12 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent
{
long nCheckBoxHeight =
maCbExportNotesPages.LogicToPixel( Size( 13, 13 ), MAP_APPFONT ).Height();
Point aPos = maCbExportEmptyPages.GetPosPixel();
maCbExportEmptyPages.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
- aPos = maCbEmbedStandardFonts.GetPosPixel();
- maCbEmbedStandardFonts.SetPosPixel( Point( aPos.X(), aPos.Y() - nCheckBoxHeight ) );
maCbExportNotesPages.Show( sal_False );
maCbExportNotesPages.Check( sal_False );
maCbExportHiddenSlides.Show( sal_False);
maCbExportHiddenSlides.Check( sal_False );
}
@@ -695,19 +682,17 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent )
paParent->mnPDFTypeSelection = 0;
if( maCbPDFA1b.IsChecked() )
{
paParent->mnPDFTypeSelection = 1;
paParent->mbUseTaggedPDF = mbTaggedPDFUserSelection;
paParent->mbExportFormFields = mbExportFormFieldsUserSelection;
- paParent->mbEmbedStandardFonts = mbEmbedStandardFontsUserSelection;
}
else
{
paParent->mbUseTaggedPDF = maCbTaggedPDF.IsChecked();
paParent->mbExportFormFields = maCbExportFormFields.IsChecked();
- paParent->mbEmbedStandardFonts = maCbEmbedStandardFonts.IsChecked();
}
paParent->maWatermarkText = maEdWatermark.GetText();
/*
* FIXME: the entries are only implicitly defined by the resource file. Should there
@@ -811,25 +796,20 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl)
mbTaggedPDFUserSelection = maCbTaggedPDF.IsChecked();
maCbTaggedPDF.Check();
maCbTaggedPDF.Enable( sal_False );
mbExportFormFieldsUserSelection = maCbExportFormFields.IsChecked();
maCbExportFormFields.Check( sal_False );
maCbExportFormFields.Enable( sal_False );
- mbEmbedStandardFontsUserSelection = maCbEmbedStandardFonts.IsChecked();
- maCbEmbedStandardFonts.Check( sal_True );
- maCbEmbedStandardFonts.Enable( sal_False );
}
else
{
//retrieve the values of subordinate controls
maCbTaggedPDF.Enable();
maCbTaggedPDF.Check( mbTaggedPDFUserSelection );
maCbExportFormFields.Check( mbExportFormFieldsUserSelection );
maCbExportFormFields.Enable();
- maCbEmbedStandardFonts.Check( mbEmbedStandardFontsUserSelection );
- maCbEmbedStandardFonts.Enable();
}
// PDF/A-1 doesn't allow launch action, so enable/disable the selection on
// Link page
if( mpaParent && mpaParent->GetTabPage( RID_PDF_TAB_LINKS ) )
( ( ImpPDFTabLinksPage* )mpaParent->GetTabPage( RID_PDF_TAB_LINKS ) )->ImplPDFALinkControl( !maCbPDFA1b.IsChecked() );
diff --git a/filter/source/pdf/impdialog.hrc b/filter/source/pdf/impdialog.hrc
index 77857560c7bb..fa86c243609f 100644
--- a/filter/source/pdf/impdialog.hrc
+++ b/filter/source/pdf/impdialog.hrc
@@ -77,13 +77,12 @@
#define LB_FORMSFORMAT 22
#define CB_ALLOWDUPLICATEFIELDNAMES 23
#define CB_EXPORTEMPTYPAGES 24
#define CB_ADDSTREAM 25
#define CB_PDFA_1B_SELECT 26
#define CB_EXPORTNOTESPAGES 27
-#define CB_EMBEDSTANDARDFONTS 28
#define FT_ADDSTREAMDESCRIPTION 29
#define CB_EXPORTHIDDENSLIDES 30
#define FL_WATERMARK 31
#define CB_WATERMARK 32
#define FT_WATERMARK 33
#define ED_WATERMARK 34
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index f3921f11b77e..72fd6ab6daec 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -96,13 +96,12 @@ protected:
sal_Bool mbExportNotes;
sal_Bool mbViewPDF;
sal_Bool mbExportNotesPages;
sal_Bool mbUseTransitionEffects;
sal_Bool mbIsSkipEmptyPages;
sal_Bool mbAddStream;
- sal_Bool mbEmbedStandardFonts;
sal_Int32 mnFormsType;
sal_Bool mbExportFormFields;
sal_Bool mbAllowDuplicateFieldNames;
sal_Bool mbExportBookmarks;
sal_Bool mbExportHiddenSlides;
sal_Int32 mnOpenBookmarkLevels;
@@ -198,13 +197,12 @@ class ImpPDFTabGeneralPage : public SfxTabPage
CheckBox maCbPDFA1b;
CheckBox maCbTaggedPDF;
sal_Bool mbTaggedPDFUserSelection;
CheckBox maCbExportFormFields;
sal_Bool mbExportFormFieldsUserSelection;
- sal_Bool mbEmbedStandardFontsUserSelection;
FixedText maFtFormsFormat;
ListBox maLbFormsFormat;
CheckBox maCbAllowDuplicateFieldNames;
CheckBox maCbExportBookmarks;
CheckBox maCbExportHiddenSlides;
@@ -212,13 +210,12 @@ class ImpPDFTabGeneralPage : public SfxTabPage
CheckBox maCbViewPDF;
CheckBox maCbExportNotesPages;
CheckBox maCbExportEmptyPages;
CheckBox maCbAddStream;
FixedText maFtAddStreamDescription;
- CheckBox maCbEmbedStandardFonts;
FixedLine maFlWatermark;
CheckBox maCbWatermark;
FixedText maFtWatermark;
Edit maEdWatermark;
diff --git a/filter/source/pdf/impdialog.src b/filter/source/pdf/impdialog.src
index 3439448ccc31..d7889c809ffd 100644
--- a/filter/source/pdf/impdialog.src
+++ b/filter/source/pdf/impdialog.src
@@ -300,20 +300,12 @@ TabPage RID_PDF_TAB_GENER
Pos = MAP_APPFONT ( 188 , 157 ) ;
Size = MAP_APPFONT ( 158 , 16 ) ;
TabStop = TRUE ;
WordBreak = TRUE ;
Text[ en-US ] = "Exp~ort automatically inserted blank pages";
};
- CheckBox CB_EMBEDSTANDARDFONTS
- {
- HelpID = "filter:CheckBox:RID_PDF_TAB_GENER:CB_EMBEDSTANDARDFONTS";
- Pos = MAP_APPFONT ( 188 , 176 ) ;
- Size = MAP_APPFONT ( 158 , 10 ) ;
- TabStop = TRUE ;
- Text[ en-US ] = "E~mbed standard fonts";
- };
CheckBox CB_VIEWPDF
{
Pos = MAP_APPFONT ( 188 , 181 ) ;
Size = MAP_APPFONT ( 158 , 10 ) ;
TabStop = TRUE ;
Text[ en-US ] = "~View PDF after Export";
diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx
index 3ddcf0c204d2..1f7fc5be9b56 100644
--- a/filter/source/pdf/pdfexport.cxx
+++ b/filter/source/pdf/pdfexport.cxx
@@ -97,14 +97,12 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc,
mxIH ( rxIH ),
mbUseTaggedPDF ( sal_False ),
mnPDFTypeSelection ( 0 ),
mbExportNotes ( sal_True ),
mbViewPDF ( sal_True ),
mbExportNotesPages ( sal_False ),
- mbEmbedStandardFonts ( sal_False ),//in preparation for i54636 and i76458.
- //already used for i59651 (PDF/A-1)
mbUseTransitionEffects ( sal_True ),
mbExportBookmarks ( sal_True ),
mbExportHiddenSlides ( sal_False ),
mnOpenBookmarkLevels ( -1 ),
mbUseLosslessCompression ( sal_False ),
mbReduceImageResolution ( sal_False ),
@@ -458,14 +456,12 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
else if ( rFilterData[ nData ].Name == "ExportNotes" )
rFilterData[ nData ].Value >>= mbExportNotes;
else if ( rFilterData[ nData ].Name == "ViewPDFAfterExport" )
rFilterData[ nData ].Value >>= mbViewPDF;
else if ( rFilterData[ nData ].Name == "ExportNotesPages" )
rFilterData[ nData ].Value >>= mbExportNotesPages;
- else if ( rFilterData[ nData ].Name == "EmbedStandardFonts" )
- rFilterData[ nData ].Value >>= mbEmbedStandardFonts;
else if ( rFilterData[ nData ].Name == "UseTransitionEffects" )
rFilterData[ nData ].Value >>= mbUseTransitionEffects;
else if ( rFilterData[ nData ].Name == "ExportFormFields" )
rFilterData[ nData ].Value >>= mbExportFormFields;
else if ( rFilterData[ nData ].Name == "FormsType" )
rFilterData[ nData ].Value >>= mnFormsFormat;
@@ -564,14 +560,12 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
aContext.Version = PDFWriter::PDF_1_4;
break;
case 1:
aContext.Version = PDFWriter::PDF_A_1;
//force the tagged PDF as well
mbUseTaggedPDF = sal_True;
- //force embedding of standard fonts
- mbEmbedStandardFonts = sal_True;
//force disabling of form conversion
mbExportFormFields = sal_False;
// PDF/A does not allow transparencies
mbRemoveTransparencies = sal_True;
// no encryption
mbEncrypt = sal_False;
@@ -589,13 +583,12 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue
aContext.FitWindow = mbFitWindow;
aContext.CenterWindow = mbCenterWindow;
aContext.OpenInFullScreenMode = mbOpenInFullScreenMode;
aContext.DisplayPDFDocumentTitle = mbDisplayPDFDocumentTitle;
aContext.InitialPage = mnInitialPage-1;
aContext.OpenBookmarkLevels = mnOpenBookmarkLevels;
- aContext.EmbedStandardFonts = mbEmbedStandardFonts;
switch( mnPDFDocumentMode )
{
default:
case 0:
aContext.PDFDocumentMode = PDFWriter::ModeDefault;
diff --git a/filter/source/pdf/pdfexport.hxx b/filter/source/pdf/pdfexport.hxx
index 1e0449efdc97..e76c0b13d3b1 100644
--- a/filter/source/pdf/pdfexport.hxx
+++ b/filter/source/pdf/pdfexport.hxx
@@ -46,13 +46,12 @@ private:
sal_Bool mbUseTaggedPDF;
sal_Int32 mnPDFTypeSelection;
sal_Bool mbExportNotes;
sal_Bool mbViewPDF;
sal_Bool mbExportNotesPages;
- sal_Bool mbEmbedStandardFonts;
sal_Bool mbUseTransitionEffects;
sal_Bool mbExportBookmarks;
sal_Bool mbExportHiddenSlides;
sal_Int32 mnOpenBookmarkLevels;
sal_Bool mbUseLosslessCompression;
diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx
index 3bfd5ed2f66f..d3a3612ca793 100644
--- a/include/vcl/pdfwriter.hxx
+++ b/include/vcl/pdfwriter.hxx
@@ -581,14 +581,12 @@ The following structure describes the permissions used in PDF security
/* decides the PDF language level to be produced */
PDFVersion Version;
/* valid for PDF >= 1.4
causes the MarkInfo entry in the document catalog to be set
*/
bool Tagged;
- /* forces the embedding of PDF standard fonts */
- bool EmbedStandardFonts;
/* determines in which format a form
will be submitted.
*/
PDFWriter::ExportDataFormat SubmitFormat;
bool AllowDuplicateFieldNames;
bool FieldsUseSystemFonts;
@@ -636,13 +634,12 @@ The following structure describes the permissions used in PDF security
RelFsys( false ), //i56629, i49415?, i64585?
DefaultLinkAction( PDFWriter::URIAction ),
ConvertOOoTargetToPDFTarget( false ),
ForcePDFAction( false ),
Version( PDFWriter::PDF_1_4 ),
Tagged( false ),
- EmbedStandardFonts( false ),
SubmitFormat( PDFWriter::FDF ),
AllowDuplicateFieldNames( false ),
FieldsUseSystemFonts( true ),
PDFDocumentMode( PDFWriter::ModeDefault ),
PDFDocumentAction( PDFWriter::ActionDefault ),
Zoom( 100 ),
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index 30f305c3c1e5..cc6da7d4f867 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -5058,19 +5058,12 @@
<info>
<desc>Specifies whether form fields are exported as widgets or
only their fixed print representation is exported.</desc>
</info>
<value>true</value>
</prop>
- <prop oor:name="EmbedStandardFonts" oor:type="xs:boolean" oor:nillable="false">
- <info>
- <desc>Specifies whether to embed the 14 standard PDF fonts or
- not.</desc>
- </info>
- <value>false</value>
- </prop>
<prop oor:name="FormsType" oor:type="xs:int" oor:nillable="false">
<info>
<desc>Specifies the submitted format of a PDF form.</desc>
</info>
<constraints>
<enumeration oor:value="0">
diff --git a/vcl/generic/print/genprnpsp.cxx b/vcl/generic/print/genprnpsp.cxx
index 9ffb69cdcaa3..25f0162143fe 100644
--- a/vcl/generic/print/genprnpsp.cxx
+++ b/vcl/generic/print/genprnpsp.cxx
@@ -1097,13 +1097,12 @@ sal_Bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i
i_rController.jobStarted();
// setup PDFWriter context
vcl::PDFWriter::PDFWriterContext aContext;
aContext.Version = vcl::PDFWriter::PDF_1_4;
aContext.Tagged = false;
- aContext.EmbedStandardFonts = true;
aContext.DocumentLocale = Application::GetSettings().GetLanguageTag().getLocale();
aContext.ColorMode = i_rController.getPrinter()->GetPrinterOptions().IsConvertToGreyscales()
? vcl::PDFWriter::DrawGreyscale : vcl::PDFWriter::DrawColor;
// prepare doc info
aContext.DocumentInfo.Title = i_rJobName;
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index be980cb73984..38f1f2543cf0 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -204,13 +204,13 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
if( mpPDFWriter )
{
if( mpFontList && mpFontList != pSVData->maGDIData.mpScreenFontList )
delete mpFontList;
if( mpFontCache && mpFontCache != pSVData->maGDIData.mpScreenFontCache )
delete mpFontCache;
- mpFontList = mpPDFWriter->filterDevFontList( pSVData->maGDIData.mpScreenFontList );
+ mpFontList = pSVData->maGDIData.mpScreenFontList->Clone( true, true );
mpFontCache = new ImplFontCache( sal_False );
}
else
{
if( mpOutDevData )
mpOutDevData->maDevFontSubst.Clear();
@@ -2870,17 +2870,14 @@ void OutputDevice::ImplInitFont() const
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
bNonAntialiased |= ((rStyleSettings.GetDisplayOptions() & DISPLAY_OPTION_AA_DISABLE) != 0);
bNonAntialiased |= (int(rStyleSettings.GetAntialiasingMinPixelHeight()) > mpFontEntry->maFontSelData.mnHeight);
mpFontEntry->maFontSelData.mbNonAntialiased = bNonAntialiased;
}
- if( !mpPDFWriter || !mpPDFWriter->isBuiltinFont( mpFontEntry->maFontSelData.mpFontData ) )
- {
- // select font in the device layers
- mpFontEntry->mnSetFontFlags = mpGraphics->SetFont( &(mpFontEntry->maFontSelData), 0 );
- }
+ // select font in the device layers
+ mpFontEntry->mnSetFontFlags = mpGraphics->SetFont( &(mpFontEntry->maFontSelData), 0 );
mbInitFont = false;
}
}
void OutputDevice::ImplInitTextColor()
{
@@ -2960,16 +2957,13 @@ bool OutputDevice::ImplNewFont() const
// get metric data from device layers
if ( pGraphics )
{
pFontEntry->mbInit = true;
pFontEntry->maMetric.mnOrientation = sal::static_int_cast<short>(pFontEntry->maFontSelData.mnOrientation);
- if( mpPDFWriter && mpPDFWriter->isBuiltinFont( pFontEntry->maFontSelData.mpFontData ) )
- mpPDFWriter->getFontMetric( &pFontEntry->maFontSelData, &(pFontEntry->maMetric) );
- else
- pGraphics->GetFontMetric( &(pFontEntry->maMetric) );
+ pGraphics->GetFontMetric( &(pFontEntry->maMetric) );
pFontEntry->maMetric.ImplInitTextLineSize( this );
pFontEntry->maMetric.ImplInitAboveTextLineSize();
pFontEntry->mnLineHeight = pFontEntry->maMetric.mnAscent + pFontEntry->maMetric.mnDescent;
@@ -3912,16 +3906,12 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY,
{
// See qadevOOo/testdocs/StrikeThrough.odt for examples if you need
// to tweak this
if (!nWidth)
return;
- // PDF-export does its own strikeout drawing... why again?
- if( mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) )
- return;
-
// prepare string for strikeout measurement
static char cStrikeoutChar;
if ( eStrikeout == STRIKEOUT_SLASH )
cStrikeoutChar = '/';
else // ( eStrikeout == STRIKEOUT_X )
cStrikeoutChar = 'X';
@@ -4497,39 +4487,36 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, sal_Bool bTextLine
{
if( mpFontEntry->mnOwnOrientation )
if( ImplDrawRotateText( rSalLayout ) )
return;
long nOldX = rSalLayout.DrawBase().X();
- if( ! (mpPDFWriter && mpPDFWriter->isBuiltinFont(mpFontEntry->maFontSelData.mpFontData) ) )
+ if( ImplHasMirroredGraphics() )
{
- if( ImplHasMirroredGraphics() )
- {
- long w = meOutDevType == OUTDEV_VIRDEV ? mnOutWidth : mpGraphics->GetGraphicsWidth();
- long x = rSalLayout.DrawBase().X();
- rSalLayout.DrawBase().X() = w - 1 - x;
- if( !IsRTLEnabled() )
- {
- OutputDevice *pOutDevRef = (OutputDevice *)this;
- // mirror this window back
- long devX = w-pOutDevRef->mnOutWidth-pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX
- rSalLayout.DrawBase().X() = devX + ( pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) ) ;
- }
- }
- else if( IsRTLEnabled() )
+ long w = meOutDevType == OUTDEV_VIRDEV ? mnOutWidth : mpGraphics->GetGraphicsWidth();
+ long x = rSalLayout.DrawBase().X();
+ rSalLayout.DrawBase().X() = w - 1 - x;
+ if( !IsRTLEnabled() )
{
OutputDevice *pOutDevRef = (OutputDevice *)this;
-
// mirror this window back
- long devX = pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX
- rSalLayout.DrawBase().X() = pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) + devX;
+ long devX = w-pOutDevRef->mnOutWidth-pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX
+ rSalLayout.DrawBase().X() = devX + ( pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) ) ;
}
+ }
+ else if( IsRTLEnabled() )
+ {
+ OutputDevice *pOutDevRef = (OutputDevice *)this;
- rSalLayout.DrawText( *mpGraphics );
+ // mirror this window back
+ long devX = pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX
+ rSalLayout.DrawBase().X() = pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) + devX;
}
+ rSalLayout.DrawText( *mpGraphics );
+
rSalLayout.DrawBase().X() = nOldX;
if( bTextLines )
ImplDrawTextLines( rSalLayout,
maFont.GetStrikeout(), maFont.GetUnderline(), maFont.GetOverline(),
maFont.IsWordLineMode(), ImplIsUnderlineAbove( maFont ) );
@@ -5850,18 +5837,13 @@ SalLayout* OutputDevice::ImplLayout( const OUString& rOrigStr, sal_Int32 nMinInd
// even if this layout will never be drawn
if( mbInitTextColor )
const_cast<OutputDevice&>(*this).ImplInitTextColor();
#endif
// get matching layout object for base font
- SalLayout* pSalLayout = NULL;
- if( mpPDFWriter )
- pSalLayout = mpPDFWriter->GetTextLayout( aLayoutArgs, &mpFontEntry->maFontSelData );
-
- if( !pSalLayout )
- pSalLayout = mpGraphics->GetTextLayout( aLayoutArgs, 0 );
+ SalLayout* pSalLayout = mpGraphics->GetTextLayout( aLayoutArgs, 0 );
// layout text
if( pSalLayout && !pSalLayout->LayoutText( aLayoutArgs ) )
{
pSalLayout->Release();
pSalLayout = NULL;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 48f4a6a37998..ab8f4d119553 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1720,13 +1720,12 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
:
m_pReferenceDevice( NULL ),
m_aMapMode( MAP_POINT, Point(), Fraction( 1L, pointToPixel(1) ), Fraction( 1L, pointToPixel(1) ) ),
m_nCurrentStructElement( 0 ),
m_bEmitStructure( true ),
m_bNewMCID( false ),
- m_bEmbedStandardFonts( false ),
m_nNextFID( 1 ),
m_nInheritedPageWidth( 595 ), // default A4
m_nInheritedPageHeight( 842 ), // default A4
m_eInheritedOrientation( PDFWriter::Portrait ),
m_nCurrentPage( -1 ),
m_nSignatureObject( -1 ),
@@ -1836,14 +1835,12 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
// insert outline root
m_aOutline.push_back( PDFOutlineEntry() );
m_bIsPDF_A1 = (m_aContext.Version == PDFWriter::PDF_A_1);
if( m_bIsPDF_A1 )
m_aContext.Version = PDFWriter::PDF_1_4; //meaning we need PDF 1.4, PDF/A flavour
-
- m_bEmbedStandardFonts = m_aContext.EmbedStandardFonts;
}
PDFWriterImpl::~PDFWriterImpl()
{
if( m_aDocDigest )
rtl_digest_destroyMD5( m_aDocDigest );
@@ -2265,186 +2262,14 @@ ImplPdfBuiltinFontData::ImplPdfBuiltinFontData( const PDFWriterImpl::BuiltinFont
ImplFontEntry* ImplPdfBuiltinFontData::CreateFontInstance( FontSelectPattern& rFSD ) const
{
ImplFontEntry* pEntry = new ImplFontEntry( rFSD );
return pEntry;
}
-ImplDevFontList* PDFWriterImpl::filterDevFontList( ImplDevFontList* pFontList )
-{
- DBG_ASSERT( m_aSubsets.empty(), "Fonts changing during PDF generation, document will be invalid" );
- ImplDevFontList* pFiltered = pFontList->Clone( true, true );
-
- // append the PDF builtin fonts
- if( !m_bIsPDF_A1 && !m_bEmbedStandardFonts)
- for( unsigned int i = 0; i < SAL_N_ELEMENTS(m_aBuiltinFonts); i++ )
- {
- PhysicalFontFace* pNewData = new ImplPdfBuiltinFontData( m_aBuiltinFonts[i] );
- pFiltered->Add( pNewData );
- }
- return pFiltered;
-}
-
-bool PDFWriterImpl::isBuiltinFont( const PhysicalFontFace* pFont ) const
-{
- const ImplPdfBuiltinFontData* pFD = GetPdfFontData( pFont );
- return (pFD != NULL);
-}
-
-void PDFWriterImpl::getFontMetric( FontSelectPattern* pSelect, ImplFontMetricData* pMetric ) const
-{
- const ImplPdfBuiltinFontData* pFD = GetPdfFontData( pSelect->mpFontData );
- if( !pFD )
- return;
- const BuiltinFont* pBuiltinFont = pFD->GetBuiltinFont();
-
- pMetric->mnOrientation = sal::static_int_cast<short>(pSelect->mnOrientation);
- pMetric->SetFamilyType( pBuiltinFont->m_eFamily );
- pMetric->SetPitch( pBuiltinFont->m_ePitch );
- pMetric->SetWeight( pBuiltinFont->m_eWeight );
- pMetric->SetItalic( pBuiltinFont->m_eItalic );
- pMetric->SetSymbolFlag( pFD->IsSymbolFont() );
- pMetric->mnWidth = pSelect->mnHeight;
- pMetric->mnAscent = ( pSelect->mnHeight * +pBuiltinFont->m_nAscent + 500 ) / 1000;
- pMetric->mnDescent = ( pSelect->mnHeight * -pBuiltinFont->m_nDescent + 500 ) / 1000;
- pMetric->mnIntLeading = 0;
- pMetric->mnExtLeading = 0;
- pMetric->mnSlant = 0;
- pMetric->mbScalableFont = true;
- pMetric->mbDevice = true;
-}
-
// -----------------------------------------------------------------------
-namespace vcl {
-
-class PDFSalLayout : public GenericSalLayout
-{
- PDFWriterImpl& mrPDFWriterImpl;
- const PDFWriterImpl::BuiltinFont& mrBuiltinFont;
- bool mbIsSymbolFont;
- long mnPixelPerEM;
- String maOrigText;
-
-public:
- PDFSalLayout( PDFWriterImpl&,
- const PDFWriterImpl::BuiltinFont&,
- long nPixelPerEM, int nOrientation );
-
- void SetText( const OUString& rText ) { maOrigText = rText; }
- virtual bool LayoutText( ImplLayoutArgs& );
- virtual void InitFont() const;
- virtual void DrawText( SalGraphics& ) const;
-};
-
-}
-
-// -----------------------------------------------------------------------
-
-PDFSalLayout::PDFSalLayout( PDFWriterImpl& rPDFWriterImpl,
- const PDFWriterImpl::BuiltinFont& rBuiltinFont,
- long nPixelPerEM, int nOrientation )
-: mrPDFWriterImpl( rPDFWriterImpl ),
- mrBuiltinFont( rBuiltinFont ),
- mnPixelPerEM( nPixelPerEM )
-{
- mbIsSymbolFont = (rBuiltinFont.m_eCharSet != RTL_TEXTENCODING_MS_1252);
- SetOrientation( nOrientation );
-}
-
-// -----------------------------------------------------------------------
-
-bool PDFSalLayout::LayoutText( ImplLayoutArgs& rArgs )
-{
- const OUString aText(rArgs.mpStr+rArgs.mnMinCharPos, rArgs.mnEndCharPos-rArgs.mnMinCharPos);
- SetText( aText );
- SetUnitsPerPixel( 1000 );
-
- rtl_UnicodeToTextConverter aConv = rtl_createTextToUnicodeConverter( mrBuiltinFont.m_eCharSet );
-
- Point aNewPos( 0, 0 );
- bool bRightToLeft;
- Reserve(rArgs.mnLength);
- for( int nCharPos = -1; rArgs.GetNextPos( &nCharPos, &bRightToLeft ); )
- {
- // TODO: handle unicode surrogates
- // on the other hand the PDF builtin fonts don't support them anyway
- sal_Unicode cChar = rArgs.mpStr[ nCharPos ];
- if( bRightToLeft )
- cChar = static_cast<sal_Unicode>(GetMirroredChar( cChar ));
-
- sal_Char aBuf[4];
- sal_uInt32 nInfo;
- sal_Size nSrcCvtChars;
-
- sal_Size nConv = rtl_convertUnicodeToText( aConv,
- NULL,
- &cChar, 1,
- aBuf, sizeof(aBuf)/sizeof(*aBuf),
- RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR,
- &nInfo, &nSrcCvtChars );
- // check whether conversion was possible
- // else fallback font is needed as the standard fonts
- // are handled via WinAnsi encoding
- if( nConv > 0 )
- cChar = ((sal_Unicode)aBuf[0]) & 0x00ff;
-
- if( cChar & 0xff00 )
- {
- cChar = 0; // NotDef glyph
- rArgs.NeedFallback( nCharPos, bRightToLeft );
- }
-
- long nGlyphWidth = (long)mrBuiltinFont.m_aWidths[cChar] * mnPixelPerEM;
- long nGlyphFlags = 0; // builtin fonts don't have diacritic glyphs
- if( bRightToLeft )
- nGlyphFlags |= GlyphItem::IS_RTL_GLYPH;
- // TODO: get kerning from builtin fonts
- GlyphItem aGI( nCharPos, cChar, aNewPos, nGlyphFlags, nGlyphWidth );
- AppendGlyph( aGI );
-
- aNewPos.X() += nGlyphWidth;
- }
-
- rtl_destroyUnicodeToTextConverter( aConv );
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-
-void PDFSalLayout::InitFont() const
-{
- // TODO: recreate font with all its attributes
-}
-
-// -----------------------------------------------------------------------
-
-void PDFSalLayout::DrawText( SalGraphics& ) const
-{
- mrPDFWriterImpl.drawLayout( *const_cast<PDFSalLayout*>(this), maOrigText, true );
-}
-
-// -----------------------------------------------------------------------
-
-SalLayout* PDFWriterImpl::GetTextLayout( ImplLayoutArgs& rArgs, FontSelectPattern* pSelect )
-{
- DBG_ASSERT( (pSelect->mpFontData != NULL),
- "PDFWriterImpl::GetTextLayout mpFontData is NULL" );
-
- const ImplPdfBuiltinFontData* pFD = GetPdfFontData( pSelect->mpFontData );
- if( !pFD )
- return NULL;
- const BuiltinFont* pBuiltinFont = pFD->GetBuiltinFont();
-
- long nPixelPerEM = pSelect->mnWidth ? pSelect->mnWidth : pSelect->mnHeight;
- int nOrientation = pSelect->mnOrientation;
- PDFSalLayout* pLayout = new PDFSalLayout( *this, *pBuiltinFont, nPixelPerEM, nOrientation );
- pLayout->SetText( rArgs.mpStr );
- return pLayout;
-}
-
sal_Int32 PDFWriterImpl::newPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation )
{
endPage();
m_nCurrentPage = m_aPages.size();
m_aPages.push_back( PDFPage(this, nPageWidth, nPageHeight, eOrientation ) );
m_aPages.back().m_nPageIndex = m_nCurrentPage;
@@ -3089,17 +2914,12 @@ sal_Int32 PDFWriterImpl::emitBuiltinFont( const PhysicalFontFace* pFont, sal_Int
return nFontObject;
}
std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const PhysicalFontFace* pFont, EmbedFont& rEmbed )
{
std::map< sal_Int32, sal_Int32 > aRet;
- if( isBuiltinFont( pFont ) )
- {
- aRet[ rEmbed.m_nNormalFontID ] = emitBuiltinFont( pFont );
- return aRet;
- }
sal_Int32 nFontDescriptor = 0;
OString aSubType( "/Type1" );
FontSubsetInfo aInfo;
// fill in dummy values
aInfo.m_nAscent = 1000;
@@ -3235,17 +3055,12 @@ struct FontException : public std::exception
};
// TODO: always subset instead of embedding the full font => this method becomes obsolete then
std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitEmbeddedFont( const PhysicalFontFace* pFont, EmbedFont& rEmbed )
{
std::map< sal_Int32, sal_Int32 > aRet;
- if( isBuiltinFont( pFont ) )
- {
- aRet[ rEmbed.m_nNormalFontID ] = emitBuiltinFont( pFont );
- return aRet;
- }
sal_Int32 nStreamObject = 0;
sal_Int32 nFontDescriptor = 0;
// prepare font encoding
const Ucs2SIntMap* pEncoding = m_pReferenceDevice->mpGraphics->GetFontEncodingVector( pFont, NULL );
@@ -7177,36 +6992,13 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
sal_Ucs* pCurUnicode = pUnicodes;
for( int i = 0; i < nGlyphs; pCurUnicode += pUnicodesPerGlyph[i] , i++ )
{
const int nFontGlyphId = pGlyphs[i] & (GF_IDXMASK | GF_ISCHAR | GF_GSUB);
const PhysicalFontFace* pCurrentFont = pFallbackFonts[i] ? pFallbackFonts[i] : pDevFont;
- if( isBuiltinFont( pCurrentFont ) )
- {
- sal_Int32 nFontID = 0;
- FontEmbedData::iterator it = m_aEmbeddedFonts.find( pCurrentFont );
- if( it != m_aEmbeddedFonts.end() )
- nFontID = it->second.m_nNormalFontID;
- else
- {
- nFontID = m_nNextFID++;
- m_aEmbeddedFonts[ pCurrentFont ] = EmbedFont();
- m_aEmbeddedFonts[ pCurrentFont ].m_nNormalFontID = nFontID;
- }
-
- pGlyphWidths[ i ] = 0;
- pMappedGlyphs[ i ] = sal::static_int_cast<sal_Int8>( nFontGlyphId );
- pMappedFontObjects[ i ] = nFontID;
- const ImplPdfBuiltinFontData* pFD = GetPdfFontData( pCurrentFont );
- if( pFD )
- {
- const BuiltinFont* pBuiltinFont = pFD->GetBuiltinFont();
- pGlyphWidths[i] = pBuiltinFont->m_aWidths[ nFontGlyphId & 0x00ff ];
- }
- }
- else if( pCurrentFont->mbSubsettable )
+ if( pCurrentFont->mbSubsettable )
{
FontSubset& rSubset = m_aSubsets[ pCurrentFont ];
// search for font specific glyphID
FontMapping::iterator it = rSubset.m_aMapping.find( nFontGlyphId );
if( it != rSubset.m_aMapping.end() )
{
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 890bba6eb8fb..14ac0b298ea9 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -64,19 +64,17 @@ struct BitStreamState;
// PDF spec ver. 1.4: see there for details
#define MAXIMUM_RC4_KEY_LENGTH (SECUR_128BIT_KEY+3+2)
namespace vcl
{
-class PDFSalLayout;
class PDFStreamIf;
class Matrix3;
class PDFWriterImpl
{
- friend class PDFSalLayout;
friend class PDFStreamIf;
public:
// definition of structs
struct BuiltinFont
{
const char * m_pName; // Name
@@ -654,13 +652,12 @@ private:
std::list< GradientEmit > m_aGradients;
/* contains bitmap tiling patterns */
std::vector< TilingEmit > m_aTilings;
std::list< TransparencyEmit > m_aTransparentObjects;
/* contains all font subsets in use */
FontSubsetData m_aSubsets;
- bool m_bEmbedStandardFonts;
FontEmbedData m_aEmbeddedFonts;
FontEmbedData m_aSystemFonts;
sal_Int32 m_nNextFID;
PDFFontCache m_aFontCache;
sal_Int32 m_nInheritedPageWidth; // in inch/72
@@ -1071,24 +1068,12 @@ public:
static com::sun::star::uno::Reference< com::sun::star::beans::XMaterialHolder >
initEncryption( const OUString& i_rOwnerPassword,
const OUString& i_rUserPassword,
bool b128Bit );
- /* for OutputDevice so the reference device can have a list
- * that contains only suitable fonts (subsettable or builtin)
- * produces a new font list
- */
- ImplDevFontList* filterDevFontList( ImplDevFontList* pFontList );
- /* for OutputDevice: get layout for builtin fonts
- */
- bool isBuiltinFont( const PhysicalFontFace* ) const;
- SalLayout* GetTextLayout( ImplLayoutArgs& rArgs, FontSelectPattern* pFont );
- void getFontMetric( FontSelectPattern* pFont, ImplFontMetricData* pMetric ) const;
-
-
/* for documentation of public functions please see pdfwriter.hxx */
OutputDevice* getReferenceDevice();
/* document structure */
sal_Int32 newPage( sal_Int32 nPageWidth , sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation );