Bug 131740 - TrueType fonts with Chinese slow down LibreOffice
Summary: TrueType fonts with Chinese slow down LibreOffice
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
6.4.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: perf
Depends on:
Blocks:
 
Reported: 2020-03-31 13:24 UTC by xqqy189@hotmail.com
Modified: 2022-05-17 12:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
One file would cause this problem, one wouldn't (58.78 KB, application/zip)
2020-03-31 13:26 UTC, xqqy189@hotmail.com
Details

Note You need to log in before you can comment on or make changes to this bug.
Description xqqy189@hotmail.com 2020-03-31 13:24:27 UTC
Description:
Hello. I found that LibreOffice is so slow and its CPU range is so high if use TrueType fonts like source code pro built in LibreOffice or OpenSans typing Chinese in kubuntu19.10 and Windows 10. I tried to turn OpenGL on and off, it is not work. My reasons about why I thought TrueType fonts cause this problem because "Nato Sans CJK HK" ,"SourceHanSansCN" and "Noto Serif CJK SC" will not make this problem. These are OpenType fonts.

I attached 2 file that one of it may cause problem(OpenSans.odt) and which is not(Noto Sans CJK HK.odt) But be aware that this problem not only happen in writer but also calc.(I didn't try impress since it require a lot of word to reproduce this problem)

I am using Libreoffice 6.4.2.2 

Steps to Reproduce:
1. Change fonts to a TrueType font, OpenSans on Ubuntu are the best for reproduce this problem.
2. Typing a lot of Chinese character into the file, at least one page. Here is some of Chinese character for you to copy: 测试用的中文字符,把这些字符输满至少一页



Actual Results:
Libreoffice process will take a lot of CPU range, and its UI would stuck.

Expected Results:
smoothly response as using OpenType fonts. 


Reproducible: Always


User Profile Reset: Yes



Additional Info:
I have asked on https://ask.libreoffice.org/en/question/235485/truetype-fonts-slow-down-libreoffice/ and seems it is a bug.
Due to my mother langurage is not English, maybe what I am saying here is not so clear enough and may have a lot of grammar problems.

seems only Chinese character cause this problem, English will not cause this problem.

Tried turn OpenGl on and off. Both could reproduce this problem.

I can't found the "Add an Attachment" link. But I have a file that could reproduce this problem. If in need, I'd like to send this file with E-mail
Comment 1 xqqy189@hotmail.com 2020-03-31 13:26:18 UTC
Created attachment 159187 [details]
One file would cause this problem, one wouldn't

"OpenSans.odt" would cause this problem and "Noto Sans CJK HK.odt" would not
Comment 2 Ming Hua 2020-04-16 12:55:02 UTC
As I've said in bug 130949 (comment #2 and #8 there), this is a wildly reported problem, but never properly diagnosed, because it depends a lot on the user's font configuration.

Your problem most likely doesn't stem from the "OpenSans" font you specified - since I doubt it covers any Chinese glyphs - but instead from whatever the fallback font on your KUbuntu system.  Unfortunately, I don't know any easy way to identify this fallback font in LO.

The workaround is to specify a font that's known good for displaying Chinese characters, like "Noto Sans CJK HK" in your second file.  You can always specify separate fonts for Latin and Chinese text if you prefer OpenSans for its Latin and digital glyphs.

FWIW, on my Windows 10 system with LO 6.4.3, I can open both attached files without any slowdown.  I have neither "OpenSans" or "Noto Sans CJK HK" fonts installed (I have "Source Han Sans SC" instead).
Comment 3 xqqy189@hotmail.com 2020-04-16 15:30:21 UTC
Thanks.
I know change a font could solve this problem. Whatever, "Source Han Sans SC" would not cause this problem on my computer either......

I admire it is really hard to found which fallback font Libreoffice is using. But after I compare the two document under KUbuntu, I have a more wild guess: It is not the specific font cause this problem but the fallback mechanism cause that. Since I checked that seems my system fallback is Noto Sans CJK and both document looks like same in my system.

Just a guess. This problem seems so complex for me to dig it out.
Comment 4 Buovjaga 2020-06-20 13:58:42 UTC
You could take a performance profile of the slow down.

Install debug packages for LibreOffice: https://wiki.ubuntu.com/Debug%20Symbol%20Packages

Install perf and FlameGraph and do the trace:
https://wiki.documentfoundation.org/Development/How_to_debug#Performance_debugging_.28perf.29

So you run LibreOffice, then in a terminal you say

perf record -F 200 --call-graph dwarf,62000 --pid=`pidof soffice.bin`

Then you open the slow file.

You exit perf by Ctrl-C in the terminal.

Then you can create the SVG flamegraph.
Comment 5 Xisco Faulí 2022-05-02 12:02:07 UTC
Thanks for reporting this issue.
Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version.
Comment 6 xqqy189@hotmail.com 2022-05-17 12:38:29 UTC
Thanks for replying. Since it is a long long ago problem and I can't reproduce this problem anymore with the latest libreoffice, I have set the status to "resolved worksforme'.