Bug 145405 - [CJK] Character position offset when export to PDF in vertical writing mode with bigger font size
Summary: [CJK] Character position offset when export to PDF in vertical writing mode ...
Status: RESOLVED DUPLICATE of bug 144222
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Blocks: CJK Vertical-Text
  Show dependency treegraph
Reported: 2021-10-30 13:57 UTC by Franklin Weng
Modified: 2021-10-31 09:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:

sample document ODT file (12.82 KB, application/vnd.oasis.opendocument.text)
2021-10-30 13:59 UTC, Franklin Weng
PDF file exported under LibreOffice 7.2.2 (39.81 KB, application/pdf)
2021-10-30 14:00 UTC, Franklin Weng
Correct positions when editing under LibreOffice 7.2.2 (201.81 KB, image/png)
2021-10-30 14:01 UTC, Franklin Weng
Screenshot of exported PDF file under LibreOffice 7.2.2 (Windows version) (113.95 KB, image/png)
2021-10-30 14:02 UTC, Franklin Weng

Note You need to log in before you can comment on or make changes to this bug.
Description Franklin Weng 2021-10-30 13:57:39 UTC
I'm generating my genealogy using LibreOffice.  Following our traditional document style I set the page as portrait and vertical writing, from right to left.  I used font "AR PL UKai TW MBE" (which can be downloaded at https://github.com/saiswa/free-fonts/blob/master/PCLinuxOSFonts/AR%20PL%20UKai%20TW%20MBE%2C%20Regular.ttc ).

The position of words were correct when editing.  However when exporting to PDF the big font size characters and vertical parentheses were shifted.

Steps to Reproduce:
1. Set page style as portrait and vertical writing, right to left
2. Input words as sample_doc (attached)
3. Export to PDF

Actual Results:
Some characters (big font size characters) and parentheses were shifted to wrong positions (screenshot attached)

Expected Results:
should not be shifted (correct screenshot attached)

Reproducible: Always

User Profile Reset: No

Additional Info:
The correct PDF output can be generated with NDC ODF Application Tools v3.1, which unfortunately the characters positions were wrong when editing.  In LibreOffice 7.2 the positions were correct when editing, but wrong when exporting to PDF.
Comment 1 Franklin Weng 2021-10-30 13:59:39 UTC
Created attachment 176024 [details]
sample document ODT file

The sample document.

Exporting it to PDF under LibreOffice 7.2 would get wrong results.
Comment 2 Franklin Weng 2021-10-30 14:00:21 UTC
Created attachment 176025 [details]
PDF file exported under LibreOffice 7.2.2

The position is wrong.
Comment 3 Franklin Weng 2021-10-30 14:01:32 UTC
Created attachment 176026 [details]
Correct positions when editing under LibreOffice 7.2.2

It is correctly shown when editing in LibreOffice Writer 7.2.2.
Comment 4 Franklin Weng 2021-10-30 14:02:44 UTC
Created attachment 176027 [details]
Screenshot of exported PDF file under LibreOffice 7.2.2 (Windows version)
Comment 5 Franklin Weng 2021-10-30 14:03:15 UTC
Tested version information:

Version: / LibreOffice Community
Build ID: 02b2acce88a210515b4a5bb2e46cbfb63fe97d56
CPU threads: 4; OS: Linux 5.14; UI render: default; VCL: kf5 (cairo+xcb)
Locale: zh-TW (zh_TW.UTF-8); UI: zh-TW
Calc: threaded

Same version under Windows has the same result.
Comment 6 Ming Hua 2021-10-31 08:32:47 UTC
With 7.2.2 RC1 on Windows 10, I can partially reproduce.  I don't have UKai font installed, and when substitute with Windows's "KaiTi" font, I reproduce the shift of characters with big font size, but don't see the shift of parentheses.

Version: (x64) / LibreOffice Community
Build ID: 0e408af0b27894d652a87aa5f21fe17bf058124c
CPU threads: 2; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded
Comment 7 Kevin Suo 2021-10-31 09:08:10 UTC
I do reproduce on an older build of 7.2 branch, but I do not reproduce on current master branch.

I then did a reverse-bibisect-ing using the repo in:

And find that it was fixed by Mark Hung in the following commit:

commit a4244c0f05b95ded277a3a7ed217bf0451daa996
Author: Mark Hung <marklh9@gmail.com>
Date:   Sat Oct 16 13:55:56 2021 +0800

    tdf#144222 fix pdf export with vertical layout
    Remove the offset adjustment that is no longer necessary.
    That was done in every backend before, and has been
    removed now.  We can trust what layout text provides us.
    Regression from:
    commit dd0d0b44fd1c6c0292d7b2eb3f5cf2baa21e4481
    Author: Mark Hung <marklh9@gmail.com>
    Date:   Sun May 2 15:12:46 2021 +0800

*** This bug has been marked as a duplicate of bug 144222 ***
Comment 8 Kevin Suo 2021-10-31 09:10:17 UTC
By the way, on Fedora the font "AR PL UKai TW MBE" is a part of the cjkuni-ukai-fonts package:
> $ sudo dnf install cjkuni-ukai-fonts