Bug 36709 - For first line indent using Ch (Characters) as unit, the indent value should change when font-size changes
Summary: For first line indent using Ch (Characters) as unit, the indent value should ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.4.2 release
Hardware: Other All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 97208 123938 (view as bug list)
Depends on:
Blocks: CJK Paragraph-Indent 146932
  Show dependency treegraph
 
Reported: 2011-04-30 06:27 UTC by Cheng-Chia Tseng
Modified: 2023-06-27 08:21 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
The fixed size of 2 Ch. (77.61 KB, image/png)
2011-04-30 06:30 UTC, Cheng-Chia Tseng
Details
Test ODT Document (25.38 KB, application/vnd.oasis.opendocument.text)
2021-12-18 08:52 UTC, Kevin Suo
Details
screenshot showing the problem (110.47 KB, application/pdf)
2021-12-18 09:11 UTC, Kevin Suo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Cheng-Chia Tseng 2011-04-30 06:27:05 UTC
Now, LireOffice can use Ch (It should be a full-width "Character") as units for First Line Indent. It is a great feature that MOST CJK users use 2 Ch in their documents! :)

However, "Ch" unit is fixed in deault font size (mine is 12).

When Using different font size in different paragraghs, "Ch" should be variable to fit the actual font size of 2 full-width characters.
Comment 1 Cheng-Chia Tseng 2011-04-30 06:30:42 UTC
Created attachment 46191 [details]
The fixed size of 2 Ch.

See the fixed size of 2 Ch indent.
Comment 2 Björn Michaelsen 2011-12-23 12:07:55 UTC Comment hidden (obsolete)
Comment 3 Cheng-Chia Tseng 2012-01-18 07:57:58 UTC
Because the unit is "Character", the indent or others should be variable along with the font size.

It is not solved at dev3.5 yet.
Comment 4 QA Administrators 2015-01-05 17:52:39 UTC Comment hidden (obsolete)
Comment 5 Cheng-Chia Tseng 2015-01-07 14:08:53 UTC
Still reproduced in LibreOffice 4.3.5.2 on fedora 21.
Comment 6 QA Administrators 2016-01-17 20:05:41 UTC Comment hidden (obsolete)
Comment 7 Kevin Suo 2016-02-12 01:22:58 UTC
*** Bug 97208 has been marked as a duplicate of this bug. ***
Comment 8 QA Administrators 2017-09-01 11:21:03 UTC Comment hidden (obsolete)
Comment 9 Kevin Suo 2017-09-02 00:10:05 UTC
The bug still exists in the most recent version.
Comment 10 Kevin Suo 2018-02-11 07:12:42 UTC
A workaround for Chinese users:
Use CM (厘米) instead.

四号:0.98 厘米
小四:0.86 厘米
五号:0.74 厘米
Comment 11 Kevin Suo 2018-02-11 07:13:12 UTC
See also:
https://tieba.baidu.com/p/5516848517
Comment 12 Volga 2018-02-25 19:53:35 UTC Comment hidden (no-value)
Comment 13 Volga 2018-10-19 02:12:13 UTC
Addording to UAX 11 East Asian Width (https://www.unicode.org/reports/tr11/tr11-31.html#Overview): “For a traditional East Asian fixed pitch font, this width translates to a display width of either one half or a whole unit width. A common name for this unit width is “Em”. While an Em is customarily the height of the letter “M”, it is the same as the unit width in East Asian fonts, because in these fonts the standard character cell is square.” So we should making "Ch" unit identical to em unit.
Comment 14 QA Administrators 2019-10-20 02:32:53 UTC Comment hidden (obsolete)
Comment 15 Kevin Suo 2019-10-20 03:05:48 UTC
(In reply to QA Administrators from comment #14)
The bug still exists in the most recent version.
Comment 16 Franklin Weng 2019-11-25 12:25:43 UTC
Check the Format - Paragraph - Indent - Automatic, the first line of paragraph would indent two characters and would follow the font size.  I think technically it is possible.
Comment 17 Franklin Weng 2019-11-25 13:17:46 UTC
Even using English the "Enable char unit" is not precise either.

When checking "Enable char unit" can it just use relative unit like "em"?

https://www.w3.org/Style/Examples/007/units.en.html
Comment 18 Heiko Tietze 2019-11-27 12:10:31 UTC
Khaled, any idea about this? Font size seems to be calulated not correctly.
Comment 19 Volga 2019-12-19 10:12:59 UTC Comment hidden (obsolete)
Comment 20 Kevin Suo 2021-12-18 03:39:03 UTC
This is still producible on current master. Anyone interest in this one, or could some devs give some code pointers and advices?

I am adding Miklos Vajna to cc. Could you please advice? 
I am working bug 129448, they are related, but *this* one seems to be different and I do not know where to start, and I am not sure whether this is as easy as bug 129448 for me to work on.
Comment 21 Kevin Suo 2021-12-18 03:55:02 UTC
By the way, with the fix for bug 129448 (patch currently under review: https://gerrit.libreoffice.org/c/core/+/125627), the first line indent will not be effected by line space, thus when first line indent is set to Auto, then it will always be precisely 2-characters indent, and the indent will be updated upon font size change.

*This* bug is a little different as it only relates to when the "Use character units" option is enabled and one inputs an first line indent of e.g. "2 Ch" in the Paragraph Properties dialog. In other words, this bug is about the manually set first line indent, not Auto first line indent.
Comment 22 Kevin Suo 2021-12-18 08:52:12 UTC
Created attachment 176991 [details]
Test ODT Document

As shown in this test document, the first line indent for the 1st paragraph is correctly 2-characters, whereas it is wrong in the 2nd paragraph.
Comment 23 Kevin Suo 2021-12-18 09:11:33 UTC
Created attachment 176992 [details]
screenshot showing the problem

Attached is a screenshot illustrating the problem, as well as a comparison with MSO Word 2010.
Comment 24 Miklos Vajna 2021-12-20 07:33:00 UTC
It would be good to research what is that "ch" unit, I'm not familiar with that. Is that intentionally depending on the font size or is there a fixed conversion factor between ch and e.g. twips?
Comment 25 Kevin Suo 2021-12-20 08:27:00 UTC
One ch unit means one character unit, which equals to the height of the character of the current paragraph using the font of the current paragraph style.

In Chinese language there is a long standing convention that in a paragraph the first line indent should be 2 characters.
Comment 26 Kevin Suo 2021-12-23 01:33:53 UTC
The series of commits which added the "character unit" are:
https://cgit.freedesktop.org/libreoffice/core/log/?qt=grep&q=cjk-character-units
Comment 27 Volga 2021-12-23 03:27:22 UTC
(In reply to Kevin Suo from comment #10)
Another workaround for Chinese users:
Insert U+3000 IDEOGRAPHIC SPACE ( ) (known as 全角空格) twice at the beginning.
Comment 28 Volga 2021-12-23 03:40:20 UTC
(In reply to Kevin Suo from comment #25)
> One ch unit means one character unit, which equals to the height of the
> character of the current paragraph using the font of the current paragraph
> style.
> 
> In Chinese language there is a long standing convention that in a paragraph
> the first line indent should be 2 characters.
This is also documented in the Requirements for Chinese Text Layout by W3C.
https://www.w3.org/TR/clreq/#first_line_indents
Comment 29 Kevin Suo 2022-01-30 04:27:50 UTC
*** Bug 123938 has been marked as a duplicate of this bug. ***
Comment 30 AngelSherry 2022-05-29 17:20:00 UTC
I'm sure that it may cause by Line Spacing, which will mess up first line indent using Character with CJK language if it's not on Sing Line.

In my memory, Libreoffice did add the feather of first line indent using Character on 6.x version. But I find it only work on Sing Line. If I change to other Line Spacing, the characters of first line won't be aligned, and it will make no sense.

Testing on Libreoffce 7.3, still not fixed
Comment 31 Kevin Suo 2022-10-15 15:00:58 UTC
Some code reference: the CJK character units seems added by:
https://cgit.freedesktop.org/libreoffice/core/log/?qt=author&q=amwang
Comment 32 ⁨خالد حسني⁩ 2023-06-27 08:21:15 UTC
It seems that the ch and line units are implemented only when text grid is enabled, without the grid it defaults to a fixed value for both units.