[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - vcl/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Tue Sep 15 14:16:54 UTC 2020
vcl/source/gdi/pdfwriter_impl.cxx | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
New commits:
commit c5080207a83bef2013d76b1f39c7761c99efa8fc
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Jul 20 11:36:13 2020 +0200
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Tue Sep 15 16:16:20 2020 +0200
tdf#50879 PDF export: ensure only built-in fonts are used for forms
Alternative would be to embed the whole font, which is unusual: PDF
typically just embeds the used subset.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99032
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
(cherry picked from commit 6294ecd7b4da38de98b24ddfb9f201cef98c1f41)
Change-Id: Ic0b7e121b3ae38804c1a396ea36104ebcc0b9588
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102653
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index a2a3f5ca9a5b..a5feebb54675 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3618,6 +3618,13 @@ Font PDFWriterImpl::replaceFont( const vcl::Font& rControlFont, const vcl::Font&
sal_Int32 PDFWriterImpl::getBestBuildinFont( const vcl::Font& rFont )
{
sal_Int32 nBest = 4; // default to Helvetica
+
+ if (rFont.GetFamilyType() == FAMILY_ROMAN)
+ {
+ // Serif: default to Times-Roman.
+ nBest = 8;
+ }
+
OUString aFontName( rFont.GetFamilyName() );
aFontName = aFontName.toAsciiLowerCase();
@@ -3764,14 +3771,14 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit
// prepare font to use, draw field border
Font aFont = drawFieldBorder( rEdit, rWidget, rSettings );
- sal_Int32 nBest = getSystemFont( aFont );
+ // Get the built-in font which is closest to aFont.
+ sal_Int32 nBest = getBestBuildinFont(aFont);
// prepare DA string
OStringBuffer aDA( 32 );
appendNonStrokingColor( replaceColor( rWidget.TextColor, rSettings.GetFieldTextColor() ), aDA );
aDA.append( ' ' );
- aDA.append( "/F" );
- aDA.append( nBest );
+ aDA.append(pdf::BuildinFontFace::Get(nBest).getNameObject());
OStringBuffer aDR( 32 );
aDR.append( "/Font " );
More information about the Libreoffice-commits
mailing list