svx/source/svdraw/svdpdf.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 2c7f518d0929cb99b466046dc8e268e2f38c9288
Author:     Caolán McNamara <[email protected]>
AuthorDate: Thu Oct 30 21:07:40 2025 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Oct 31 00:19:10 2025 +0100

    we dont know the 'family type'
    
    its certainly not whatever arbitrary FamilyType is set on
    the default font of the OutputDevice.
    
    DONTKNOW is better, that way at least the other properties that we do
    know will match during selection of a matching font when creating
    embedded font output.
    
    Especially on windows where the font in the pdf embedding test is
    detected as "FAMILY_MODERN" by the windows backend, while the default
    font is typically FAMILY_ROMAN and so doesn't match exactly, so the
    next best match was fairly arbitrary and equal weight given to
    family/weight/pitch so the non-bold font got used for the bold font.
    
    Change-Id: If16b2851cb9461969409fa58eb43430516ed0a8b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193230
    Reviewed-by: Caolán McNamara <[email protected]>
    Tested-by: Caolán McNamara <[email protected]>

diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 505e011bda1e..4d3cce3a707a 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -141,6 +141,7 @@ ImpSdrPdfImport::ImpSdrPdfImport(SdrModel& rModel, 
SdrLayerID nLay, const tools:
     // Get TextBounds relative to baseline
     vcl::Font aFnt = mpVD->GetFont();
     aFnt.SetAlignment(ALIGN_BASELINE);
+    aFnt.SetFamily(FAMILY_DONTKNOW);
     mpVD->SetFont(aFnt);
 }
 
@@ -615,15 +616,15 @@ void ImpSdrPdfImport::SetAttributes(SdrObject* pObj, bool 
bForceTextAttr)
         const sal_uInt32 nHeight(
             basegfx::fround<sal_uInt32>(aFnt.GetFontSize().Height() * 
mfScaleY));
 
-        mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyTypeMaybeAskConfig(), 
aFnt.GetFamilyName(),
-                                    aFnt.GetStyleName(), 
aFnt.GetPitchMaybeAskConfig(),
-                                    aFnt.GetCharSet(), EE_CHAR_FONTINFO));
-        mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyTypeMaybeAskConfig(), 
aFnt.GetFamilyName(),
-                                    aFnt.GetStyleName(), 
aFnt.GetPitchMaybeAskConfig(),
-                                    aFnt.GetCharSet(), EE_CHAR_FONTINFO_CJK));
-        mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyTypeMaybeAskConfig(), 
aFnt.GetFamilyName(),
-                                    aFnt.GetStyleName(), 
aFnt.GetPitchMaybeAskConfig(),
-                                    aFnt.GetCharSet(), EE_CHAR_FONTINFO_CTL));
+        mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), 
aFnt.GetFamilyName(), aFnt.GetStyleName(),
+                                    aFnt.GetPitchMaybeAskConfig(), 
aFnt.GetCharSet(),
+                                    EE_CHAR_FONTINFO));
+        mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), 
aFnt.GetFamilyName(), aFnt.GetStyleName(),
+                                    aFnt.GetPitchMaybeAskConfig(), 
aFnt.GetCharSet(),
+                                    EE_CHAR_FONTINFO_CJK));
+        mpTextAttr->Put(SvxFontItem(aFnt.GetFamilyType(), 
aFnt.GetFamilyName(), aFnt.GetStyleName(),
+                                    aFnt.GetPitchMaybeAskConfig(), 
aFnt.GetCharSet(),
+                                    EE_CHAR_FONTINFO_CTL));
         mpTextAttr->Put(SvxPostureItem(aFnt.GetItalicMaybeAskConfig(), 
EE_CHAR_ITALIC));
         mpTextAttr->Put(SvxWeightItem(aFnt.GetWeightMaybeAskConfig(), 
EE_CHAR_WEIGHT));
         mpTextAttr->Put(SvxFontHeightItem(nHeight, 100, EE_CHAR_FONTHEIGHT));

Reply via email to