Bug 149336 - Support aligning CJK texts with BASE table
Summary: Support aligning CJK texts with BASE table
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected) alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on: 104930
Blocks: CJK
  Show dependency treegraph
Reported: 2022-05-27 21:08 UTC by Volga
Modified: 2023-08-18 02:00 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:

Alignment of mixed CJK and Latin vs Latin only (112.92 KB, image/png)
2023-07-03 07:43 UTC, ⁨خالد حسني⁩

Note You need to log in before you can comment on or make changes to this bug.
Description Volga 2022-05-27 21:08:34 UTC
Although LibreOffice started support BASE table from bug 104930, the two commits from there shows only 'romn' and 'hang' baseline tags got support. According to the OpenType Specification, there are also 4 tags made for CJK scripts, including 'icfb', 'icft', 'ideo', 'idtp'. And the Specification also give some instructions for proper alignments. With this support any font with these tags would be able to get proper alignments within horizontal and vertical text layouts.

Steps to Reproduce:

Actual Results:

Expected Results:

Reproducible: Always

User Profile Reset: No

Additional Info:
Comment 1 Volga 2022-05-27 21:09:31 UTC
Source Han fonts including these tags.
Comment 3 ⁨خالد حسني⁩ 2023-07-02 10:23:54 UTC
I have some code for this but I have hard time finding another software that supports this to double check my results. Do you know any typesetting/text processing software that support BASE table?
Comment 4 Volga 2023-07-02 15:31:40 UTC
I saw InDesign have some support for this.
Comment 5 QA Administrators 2023-07-03 03:12:18 UTC Comment hidden (obsolete)
Comment 6 ⁨خالد حسني⁩ 2023-07-03 07:18:00 UTC
The OpneType specification gives absolutely no information on how to use these values.

In InDesign, various “Character Alignment” mode work only between glyphs of different font sizes, at the same font size Latin and CJK text are always aligned the same and nothing really happens when changing the alignment mode.

At this point, I’m questioning the usefulness if implementing this, unless the OP can come up with specific examples that can be fixed by BASE table alignment.
Comment 7 ⁨خالد حسني⁩ 2023-07-03 07:43:03 UTC
Created attachment 188167 [details]
Alignment of mixed CJK and Latin vs Latin only

Another problem, if I do this the way InDesign does it, we will need a way to toggle between the alignment modes explicitly, as using the ideographic baseline by default will give bad results in some situations.

When CJK and Latin are mixed, the alignment look fine, but if a CJK font with BASE table is used for purely Latin text, the alignment will be wrong. We don’t have a way to tell this is a predominantly CJK paragraph or this is a predominantly Latin paragraph.
Comment 8 Volga 2023-07-04 06:41:50 UTC Comment hidden (no-value)
Comment 9 Volga 2023-07-04 06:46:23 UTC
So LibreOffice need to working more for this, e.g. add some Basic APIs to let users configure in a document.
Comment 10 ⁨خالد حسني⁩ 2023-07-04 18:04:42 UTC
Yes, probably something in the character or paragraph style.
Comment 11 ⁨خالد حسني⁩ 2023-07-04 18:06:05 UTC
WIP code without the configuration part is here: https://gerrit.libreoffice.org/q/topic:baseline