Bug 128221 - CJK characters have wrong orientation in frame with bt-lr writing-mode
Summary: CJK characters have wrong orientation in frame with bt-lr writing-mode
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha1+
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: CJK
  Show dependency treegraph
 
Reported: 2019-10-17 20:46 UTC by Regina Henschel
Modified: 2021-10-27 11:09 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
CJKcharacters_in_bt-lr.odt has a ordinary frame and one with bt-lr writing-mode (9.95 KB, application/vnd.oasis.opendocument.text)
2019-10-17 20:46 UTC, Regina Henschel
Details
btrl in Table.odt contains CJK characters in ordinary table (10.50 KB, application/vnd.oasis.opendocument.text)
2019-10-25 11:37 UTC, Regina Henschel
Details
Screenshot with comparison of LibreOffice and Word of bt-lr in table cell (17.80 KB, image/png)
2019-10-25 11:43 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2019-10-17 20:46:05 UTC
Created attachment 155098 [details]
CJKcharacters_in_bt-lr.odt has a ordinary frame and one with bt-lr writing-mode

Open attached file. It has two frames, one with default lr-tb writing-mode and a copy of it with bt-lr writing-mode. The CJK characters have wrong orientation in bt-lr writing mode.
Because bt-lr is no writing-mode for an existing language but is used for 90° counter-clockwise rotation, the CJK characters should have the same orientation as the latin characters.
This is needed too, if you want to use bt-lr writing-mode to emulate the vert="vert270" text rotation on import of docx documents. Such is currently needed, because the text area of a shape cannot rotate if it is in frame text mode (Text Box is attached), and that is currently always the case for shape import from docx.
Comment 1 Regina Henschel 2019-10-25 11:37:54 UTC
Created attachment 155305 [details]
btrl in Table.odt contains CJK characters in ordinary table

The problem is not only in frames but in tables too.

Open attached document and save it to docx.
Open the saved document in Word.

A screenshot will follow.
Comment 2 Regina Henschel 2019-10-25 11:43:17 UTC
Created attachment 155306 [details]
Screenshot with comparison of LibreOffice and Word of bt-lr in table cell

Look at the CJK characters in the cells and compare them with the horizontal line. In LibreOffice CJK characters are rotated 180°, in Word they are rotated 270° clockwise, same as the latin characters.

It should be the same as in Word, so that this writing mode can be uses for import/export with OOXML vertical direction property vert="vert270".
Comment 3 Miklos Vajna 2019-10-25 12:00:36 UTC
Thanks for the sample, I confirm this is a bug.
Comment 4 V Stuart Foote 2019-10-26 14:09:31 UTC
Wait, don't the CJK glyphs have 'vert' table assignments and bidi hinting as to orientation of the glyphs in the frame? We end up with a vertical run each glyph of which has been rotated--not a rotated horizontal run.
Comment 5 V Stuart Foote 2019-10-26 17:27:48 UTC
Was looking for better details, and not surprised if we don't handle vertical text runs correctly in Draw text boxes, but his gem from the Unicode folks was pretty informative as to how to think of this and what we may need to implement:

https://unicode.org/notes/tn22/RobustVerticalLayout.pdf

and, not clear that Microsoft actually defines this correctly (for Vertical or Horizontal text runs) in OOXML.
Comment 6 Regina Henschel 2019-10-26 18:25:00 UTC
(In reply to V Stuart Foote from comment #5)

> and, not clear that Microsoft actually defines this correctly (for Vertical
> or Horizontal text runs) in OOXML.

I think, they do it correctly. OOXML has the script depending vertical modes vert="eaVert" (e.g. Japanese) and vert="mongolianVert". Latin characters are 90° rotated, whereas CJK characters stay upright. The difference is, that next lines  go from right to left in "eaVert" and from left to right in "mongolianVert".

And OOXML has the script independent, pure geometrical vertical modes vert="vert" and vert="vert270". They rotate _all_ characters 90°, clockwise or counter clockwise respectively.

The attribute 'vert' belongs to element 'bodyPr' which is a child element of shapes. The description is in 20.1.10.83 ST_TextVerticalType (Vertical Text Types) in the standard ISO/IEC 29500-1:2016.

This bug report is not about the OOXML attribute 'textDirection' (in 17.3.1.41), which can be used in paragraph properties for example, and where the unicode algorithm has to be used.
Comment 7 QA Administrators 2021-10-27 03:44:23 UTC Comment hidden (obsolete)
Comment 8 Regina Henschel 2021-10-27 11:09:37 UTC
It is OK in Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 542a38de1a071f54f61806683dafea84e43edce9
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL

Likely fixed by the fix for bug 131490.
https://cgit.freedesktop.org/libreoffice/core/commit/?id=a8d26a0bb40c101394ded8061d1b58048153631b