Hello,
I've been looking at fdo#34814 and I know what the problem is, but I'm not
sure how that should be fixed.
The problem is that the document imported uses Wingdings (2) as the fonts for
bullet points, but that's a Windows font that is not available on Linux. The
attached workaround somehow makes LO handle it correctly, by knowing that the
font is RTL_TEXTENCODING_SYMBOL and using the matching Linux font. And the
document includes this information, but the .docx importer does not seem to
do anything with font data in the document, and AFAICT there is no support
for handling unavailable fonts except for immediately trying to map them to
something that exists.
Am I right about this? And is there some way how to make Writer know about
fonts that do not exist on the system but the document uses them? Sadly
the .docx importer is UNO-based, so I cannot easily handle the fonts in the
importer and call SetBulletFont().
--
Lubos Lunak
l.lunak@suse.cz
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index ea77e4f..af0f746 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -652,6 +652,10 @@ void setNumberingProperty(const Any& rValue, SwPaM& rPam)
FontInfo aInfo = pList->Get(
pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
Font aFont(aInfo);
+ if( aFont.GetName() == String(RTL_CONSTASCII_USTRINGPARAM("Wingdings" )))
+ aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ else if( aFont.GetName() == String(RTL_CONSTASCII_USTRINGPARAM("Wingdings
2" )))
+ aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
aFmt.SetBulletFont(&aFont);
}
aRule.Set( i, aFmt );
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index ca9c4b4..3529eac 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1982,6 +1982,10 @@ void SwXNumberingRules::SetNumberingRuleByIndex(
FontInfo aInfo = pList->Get(
sBulletFontName, WEIGHT_NORMAL, ITALIC_NONE);
Font aFont(aInfo);
+ if( aFont.GetName() == String(RTL_CONSTASCII_USTRINGPARAM("Wingdings" )))
+ aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ else if( aFont.GetName() == String(RTL_CONSTASCII_USTRINGPARAM("Wingdings
2" )))
+ aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
aFmt.SetBulletFont(&aFont);
}
else
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 7a901c5..ae8d220 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1798,6 +1798,10 @@ void lcl_SetStyleProperty(const SfxItemPropertySimpleEntry& rEntry,
FontInfo aInfo = pList->Get(
pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
Font aFont(aInfo);
+ if( aFont.GetName() ==
String(RTL_CONSTASCII_USTRINGPARAM("Wingdings" )))
+ aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
+ else if( aFont.GetName() ==
String(RTL_CONSTASCII_USTRINGPARAM("Wingdings 2" )))
+ aFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
aFmt.SetBulletFont(&aFont);
}
aSetRule.Set( i, &aFmt );
Context
- fdo#34814 - Importing doc with fonts unavailable on the system · Lubos Lunak
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.