[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.1' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Thu Mar 6 03:36:01 PST 2014


 sw/qa/extras/ww8import/data/cp1000039.doc |binary
 sw/qa/extras/ww8import/ww8import.cxx      |    8 ++++++++
 sw/source/filter/ww8/ww8par6.cxx          |    5 +++++
 3 files changed, 13 insertions(+)

New commits:
commit b9f545fc6d8ec93d2e2ce597c1f7b373e9e5b342
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Mar 6 09:48:54 2014 +0100

    cp#1000039 DOC import: ignore symbol charset of the symbol font
    
    Otherwise characters unhandled by our OpenSymbol font (like Arabic 0-9
    numbers) won't be rendered using an other font, as no other font
    provides the symbol charset. Do this in
    SwWW8ImplReader::GetFontParams(), where we already have font name ->
    font family mappings for a few well-known fonts.
    
    The DOCX filter does the same for quite some time, and that's how Arabic
    numbers in text using the Symbol font were rendered, instead of little
    rectangles.
    
    (cherry picked from commit 8556cd881270823865662e9a7700da58d11c2785)
    
    Conflicts:
    	sw/qa/extras/ww8import/ww8import.cxx
    	sw/source/filter/ww8/ww8par6.cxx
    
    Change-Id: Ib794cac19ad7b073e39f3cbd7d4bad3994151c14

diff --git a/sw/qa/extras/ww8import/data/cp1000039.doc b/sw/qa/extras/ww8import/data/cp1000039.doc
new file mode 100755
index 0000000..70cad3c
Binary files /dev/null and b/sw/qa/extras/ww8import/data/cp1000039.doc differ
diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx
index e98055a..97655bb 100644
--- a/sw/qa/extras/ww8import/ww8import.cxx
+++ b/sw/qa/extras/ww8import/ww8import.cxx
@@ -37,6 +37,7 @@ public:
     void testN823651();
     void testFdo36868();
     void testListNolevel();
+    void testCp1000039();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -65,6 +66,7 @@ void Test::run()
         {"n823651.doc", &Test::testN823651},
         {"fdo36868.doc", &Test::testFdo36868},
         {"list-nolevel.doc", &Test::testListNolevel},
+        {"cp1000039.doc", &Test::testCp1000039},
     };
     header();
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
@@ -284,6 +286,12 @@ void Test::testListNolevel()
     CPPUNIT_ASSERT_EQUAL(OUString("1."), aText);
 }
 
+void Test::testCp1000039()
+{
+    // This was RTL_TEXTENCODING_SYMBOL, causing "1" rendered as a placeholder rectangle.
+    CPPUNIT_ASSERT_EQUAL(sal_Int16(RTL_TEXTENCODING_DONTKNOW), getProperty<sal_Int16>(getRun(getParagraph(1), 1), "CharFontCharSet"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 49fd40e..8b399d1 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -3350,6 +3350,11 @@ bool SwWW8ImplReader::GetFontParams( sal_uInt16 nFCode, FontFamily& reFamily,
     // pF->ff : Family
     sal_uInt8 b = pF->ff;
 
+    // Make sure charset is not set in case of Symbol, otherwise in case a
+    // character is missing in our OpenSymbol, the character won't be replaced.
+    if (reCharSet == RTL_TEXTENCODING_SYMBOL && rName == "Symbol")
+        reCharSet = RTL_TEXTENCODING_DONTKNOW;
+
     // make sure Font Family Code is set correctly
     // at least for the most important fonts
     // ( might be set wrong when Doc was not created by


More information about the Libreoffice-commits mailing list