summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-06-12 12:16:28 +0200
committerAndras Timar <andras.timar@collabora.com>2014-06-18 14:15:50 +0200
commit5c64d1cf8d3d408b739083b5c00d2143b552fb15 (patch)
treeaa16051739731b8c2c7ea8e0ff4e7b42d7421d44 /sw/qa
parent8fdbeb7d55a6d534c476e3fc89979df25d7920c8 (diff)
fdo#77979: sw: RTF export: write non-ASCII font names encoded
Currently font names like "微软雅黑" (Microsoft YaHei) are written as "????" in the RTF export; to avoid that, set the \fcharset of the font entry to something that at least is able to encode the font name and alternate name. This requires a new function since the existing rtl_TextEncodingToWinCharset was changed in b88fe998ce8c80d7629fe70118311096615d959d to return "default" 0x01 (for OOXML) which is quite unhelpful for RTF. This is not entirely satisfactory, as of course that is no guarantee that the encoding can represent all of the actual text that has the font applied; hence there are some \'3f in the fall-back encoded text of the heading of the bugdoc, which indicates that the detected Shift-JIS is insufficient and GB-2132 would be required; but it's not obvious how to do better here without iterating over all the text twice, and that still leaves the possibility that all text that has a particular font applied cannot be represented by a single non-Unicode encoding. But since we always write text as the \u Unicode + legacy fall-back, this should not be a big problem since modern RTF readers will simply read the Unicode. (cherry picked from commit e47a02b1524061143d8e77a54eb95c77f2e6dae2) fdo#77979: argh forgot to add the test document (cherry picked from commit 90b2b378aecfa1914be0ce9aa7aa4e006e225e96) (cherry picked from commit 276fb59ee66806709382d0eeef20f62a094a5995) error C2361: initialization of 's_fallbacks' is skipped by 'default' (cherry picked from commit f3695bbc17a547b547876dd1175c0b74e5b3e90e) Conflicts: sw/source/filter/ww8/rtfattributeoutput.cxx Spell out UTF-8 (cherry picked from commit 809c8d4c990e77cd8ba52672be7c5e77aae4e90e) Change-Id: Ie6a42294c501d014dd9f0df82638519412ca19bb Reviewed-on: https://gerrit.libreoffice.org/9750 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/rtfexport/data/fdo77979.odtbin0 -> 9009 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx7
2 files changed, 7 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/fdo77979.odt b/sw/qa/extras/rtfexport/data/fdo77979.odt
new file mode 100644
index 000000000000..532724c8565b
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo77979.odt
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index ce7dc556824c..a8db2137d5dc 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -309,6 +309,13 @@ DECLARE_RTFEXPORT_TEST(testMathRuns, "math-runs.rtf")
CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1)));
}
+DECLARE_RTFEXPORT_TEST(testFdo77979, "fdo77979.odt")
+{
+ // font name is encoded with \fcharset of font
+ CPPUNIT_ASSERT_EQUAL(OUString("\xE5\xBE\xAE\xE8\xBD\xAF\xE9\x9B\x85\xE9\xBB\x91", 12, RTL_TEXTENCODING_UTF8),
+ getProperty<OUString>(getRun(getParagraph(1), 1), "CharFontName"));
+}
+
DECLARE_RTFEXPORT_TEST(testFdo53113, "fdo53113.odt")
{
/*