diff options
-rw-r--r-- | filter/source/pdf/impdialog.cxx | 20 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hrc | 1 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.hxx | 3 | ||||
-rw-r--r-- | filter/source/pdf/impdialog.src | 8 | ||||
-rw-r--r-- | filter/source/pdf/pdfexport.cxx | 7 | ||||
-rw-r--r-- | filter/source/pdf/pdfexport.hxx | 1 | ||||
-rw-r--r-- | include/vcl/pdfwriter.hxx | 3 | ||||
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 7 | ||||
-rw-r--r-- | vcl/generic/print/genprnpsp.cxx | 1 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 60 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 210 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 15 |
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 @@ -83,7 +83,6 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent, mbUseTransitionEffects( sal_False ), mbIsSkipEmptyPages( sal_True ), mbAddStream( sal_False ), - mbEmbedStandardFonts( sal_False ), mnFormsType( 0 ), mbExportFormFields( sal_True ), mbAllowDuplicateFieldNames( sal_False ), @@ -200,7 +199,6 @@ ImpPDFTabDialog::ImpPDFTabDialog( Window* pParent, 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 ); @@ -368,7 +366,6 @@ Sequence< PropertyValue > ImpPDFTabDialog::GetFilterData() 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 @@ -504,7 +501,6 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, 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 ) ), @@ -517,7 +513,6 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, 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 ) ), @@ -535,11 +530,7 @@ ImpPDFTabGeneralPage::ImpPDFTabGeneralPage( Window* pParent, 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()); @@ -609,13 +600,11 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent // 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 ); @@ -643,8 +632,6 @@ void ImpPDFTabGeneralPage::SetFilterConfigItem( const ImpPDFTabDialog* paParent 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); @@ -698,13 +685,11 @@ void ImpPDFTabGeneralPage::GetFilterConfigItem( ImpPDFTabDialog* paParent ) 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(); @@ -814,9 +799,6 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl) mbExportFormFieldsUserSelection = maCbExportFormFields.IsChecked(); maCbExportFormFields.Check( sal_False ); maCbExportFormFields.Enable( sal_False ); - mbEmbedStandardFontsUserSelection = maCbEmbedStandardFonts.IsChecked(); - maCbEmbedStandardFonts.Check( sal_True ); - maCbEmbedStandardFonts.Enable( sal_False ); } else { @@ -825,8 +807,6 @@ IMPL_LINK_NOARG(ImpPDFTabGeneralPage, ToggleExportPDFAHdl) 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 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 @@ -80,7 +80,6 @@ #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 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 @@ -99,7 +99,6 @@ protected: sal_Bool mbUseTransitionEffects; sal_Bool mbIsSkipEmptyPages; sal_Bool mbAddStream; - sal_Bool mbEmbedStandardFonts; sal_Int32 mnFormsType; sal_Bool mbExportFormFields; sal_Bool mbAllowDuplicateFieldNames; @@ -201,7 +200,6 @@ class ImpPDFTabGeneralPage : public SfxTabPage CheckBox maCbExportFormFields; sal_Bool mbExportFormFieldsUserSelection; - sal_Bool mbEmbedStandardFontsUserSelection; FixedText maFtFormsFormat; ListBox maLbFormsFormat; CheckBox maCbAllowDuplicateFieldNames; @@ -215,7 +213,6 @@ class ImpPDFTabGeneralPage : public SfxTabPage CheckBox maCbExportEmptyPages; CheckBox maCbAddStream; FixedText maFtAddStreamDescription; - CheckBox maCbEmbedStandardFonts; FixedLine maFlWatermark; CheckBox maCbWatermark; 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 @@ -303,14 +303,6 @@ TabPage RID_PDF_TAB_GENER 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 ) ; 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 @@ -100,8 +100,6 @@ PDFExport::PDFExport( const Reference< XComponent >& rxSrcDoc, 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 ), @@ -461,8 +459,6 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue 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" ) @@ -567,8 +563,6 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue 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 @@ -592,7 +586,6 @@ sal_Bool PDFExport::Export( const OUString& rFile, const Sequence< PropertyValue aContext.DisplayPDFDocumentTitle = mbDisplayPDFDocumentTitle; aContext.InitialPage = mnInitialPage-1; aContext.OpenBookmarkLevels = mnOpenBookmarkLevels; - aContext.EmbedStandardFonts = mbEmbedStandardFonts; switch( mnPDFDocumentMode ) { 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 @@ -49,7 +49,6 @@ private: sal_Bool mbExportNotes; sal_Bool mbViewPDF; sal_Bool mbExportNotesPages; - sal_Bool mbEmbedStandardFonts; sal_Bool mbUseTransitionEffects; sal_Bool mbExportBookmarks; sal_Bool mbExportHiddenSlides; 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 @@ -584,8 +584,6 @@ The following structure describes the permissions used in PDF security 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. */ @@ -639,7 +637,6 @@ The following structure describes the permissions used in PDF security ForcePDFAction( false ), Version( PDFWriter::PDF_1_4 ), Tagged( false ), - EmbedStandardFonts( false ), SubmitFormat( PDFWriter::FDF ), AllowDuplicateFieldNames( false ), FieldsUseSystemFonts( true ), 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 @@ -5061,13 +5061,6 @@ </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> 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 @@ -1100,7 +1100,6 @@ sal_Bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i 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; 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 @@ -207,7 +207,7 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists ) 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 @@ -2873,11 +2873,8 @@ void OutputDevice::ImplInitFont() const 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; } } @@ -2963,10 +2960,7 @@ bool OutputDevice::ImplNewFont() const 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(); @@ -3915,10 +3909,6 @@ void OutputDevice::ImplDrawStrikeoutChar( long nBaseX, long nBaseY, 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 ) @@ -4500,33 +4490,30 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, sal_Bool bTextLine 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 ) @@ -5853,12 +5840,7 @@ SalLayout* OutputDevice::ImplLayout( const OUString& rOrigStr, sal_Int32 nMinInd #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 ) ) 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 @@ -1723,7 +1723,6 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal 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 @@ -1839,8 +1838,6 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal 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() @@ -2268,180 +2265,8 @@ ImplFontEntry* ImplPdfBuiltinFontData::CreateFontInstance( FontSelectPattern& rF 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(); @@ -3092,11 +2917,6 @@ sal_Int32 PDFWriterImpl::emitBuiltinFont( const PhysicalFontFace* pFont, sal_Int 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" ); @@ -3238,11 +3058,6 @@ struct FontException : public std::exception 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; @@ -7180,30 +6995,7 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs, 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 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 @@ -67,13 +67,11 @@ struct BitStreamState; namespace vcl { -class PDFSalLayout; class PDFStreamIf; class Matrix3; class PDFWriterImpl { - friend class PDFSalLayout; friend class PDFStreamIf; public: // definition of structs @@ -657,7 +655,6 @@ private: 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; @@ -1074,18 +1071,6 @@ public: 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(); |