Bug 154881 - I would like to have a thai distributed feature for handling Thai text.
Summary: I would like to have a thai distributed feature for handling Thai text.
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.5.2.2 release
Hardware: All Windows (All)
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 156763 (view as bug list)
Depends on:
Blocks: Paragraph-Alignment
  Show dependency treegraph
 
Reported: 2023-04-18 11:58 UTC by not-6248
Modified: 2025-05-14 14:37 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot showing justified Thai text (205.05 KB, image/png)
2025-05-14 12:34 UTC, Jonathan Clark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description not-6248 2023-04-18 11:58:26 UTC
Description:
Microsoft word has a feature called "thai distributed" that will make the Thai language much more beautiful when creating documents. The main reason I still can't stop using microsoft word is because "thai distributed".

Actual Results:
I would like to have a thai distributed feature for handling Thai text.

Expected Results:
 thai distributed


Reproducible: Couldn't Reproduce


User Profile Reset: No

Additional Info:
Microsoft word has a feature called "thai distributed" that will make the Thai language much more beautiful when creating documents. The main reason I still can't stop using microsoft word is because "thai distributed".
Comment 1 Roman Kuznetsov 2023-04-22 19:23:49 UTC
Khaled, may be you have some opinion about this feature? Should it be in LibreOffice?
Comment 2 Khaled Hosny 2023-04-22 20:05:40 UTC
It seems to be a Thai-specific justification mode. It seems to be in scope for LibreOffice, but more research is needed to understand how it works.
Comment 3 not-6248 2023-04-22 20:43:46 UTC
If you have thai distributed feature
will attract a lot of Thai people Because in official documents such as projects or college projects The thai distributed feature is required.
Comment 4 Khaled Hosny 2023-08-14 11:02:00 UTC
*** Bug 156763 has been marked as a duplicate of this bug. ***
Comment 5 Regina Henschel 2025-04-28 21:57:20 UTC
I have seen some discussion on https://github.com/w3c/sealreq/issues/19.
Comment 6 Hossein 2025-05-14 01:40:24 UTC
Copying my comment from my duplicate issue, tdf#156763, as it can be helpful:

Comment from 2023-08-14:
In MS Office, there is a text justification option called "Thai Distributed". The tool-tip says:

"Thai Distributed
Align paragraph to both the left and right margins by adding extra space between each two characters for languages with tone mark and vowel mark.

This creates a document with clean look."

Also, in the documentation folder of writerfilter, one may find this file:

writerfilter/documentation/sprms.txt

0x2461: extra alignment:

        4: distributed
        8: justify low
        5: justify middle
        7: justify high
        9: Thai Distribute

It clarifies that there is another alignment mode, "Thai Distribute(d)". Unfortunately, I could not find any mention of this mode in LibreOffice source code and documentation.

Here are some screenshots from this feature in MS Office:
https://pantip.com/topic/36134542
https://pantip.com/topic/30273386

This may also be useful:

Requirements for justification in Thai #19
https://github.com/w3c/sealreq/issues/19

Video description:

YouTube: Thai Distributed in Office word is the very important tools for spacing
https://www.youtube.com/watch?v=w7y4jOw9NJ0
Comment 7 Jonathan Clark 2025-05-14 12:34:57 UTC
Created attachment 200801 [details]
Screenshot showing justified Thai text

Example screenshot showing the current state of LibreOffice Writer
Comment 8 Jonathan Clark 2025-05-14 12:42:00 UTC
Unless I'm overlooking something, we already support "Thai Distributed": it's the default behavior when a Thai paragraph is justified. This was added to the code prior to 2002.
Comment 9 Hossein 2025-05-14 13:16:33 UTC
(In reply to Jonathan Clark from comment #8)
> Unless I'm overlooking something, we already support "Thai Distributed":
> it's the default behavior when a Thai paragraph is justified. This was added
> to the code prior to 2002.
OK, that is interesting.

Then, the issue is not lack of support in layout level, but in other levels of Thai support. Is that correct?

Looking into these files:
offapi/com/sun/star/style/ParagraphAdjust.idl
oovbaapi/ooo/vba/word/WdParagraphAlignment.idl

I see incompatibilities with Word. For example, this is the content of the second file:

module ooo { module vba { module word {
    constants WdParagraphAlignment {
        const long wdAlignParagraphCenter = 1;
        const long wdAlignParagraphDistribute = 4;
        const long wdAlignParagraphJustify = 3;
        const long wdAlignParagraphJustifyHi = 7;
        const long wdAlignParagraphJustifyLow = 8;
        const long wdAlignParagraphJustifyMed = 5;
        const long wdAlignParagraphLeft = 0;
        const long wdAlignParagraphRight = 2;
        const long wdAlignParagraphThaiJustify = 9;
    };
}; }; };

Only some of these are actually used / accepted in sw/source/ui/vba/vbaparagraphformat.cxx.

I can say distribute=4, thaijustify=9 along justify low=8/medium=5/high=7 (with import/export and layout implemented recently with tdf#155707), are not used.

Importing and exporting such values are also important for compatibility reasons.

Could you please elaborate on what is supported, and what is not?
Comment 10 Jonathan Clark 2025-05-14 14:37:19 UTC
(In reply to Hossein from comment #9)
> (In reply to Jonathan Clark from comment #8)
> > Unless I'm overlooking something, we already support "Thai Distributed":
> > it's the default behavior when a Thai paragraph is justified. This was added
> > to the code prior to 2002.
> OK, that is interesting.
> 
> Then, the issue is not lack of support in layout level, but in other levels
> of Thai support. Is that correct?

This may be a better question for the submitter. I'm not aware of anything missing in this area. It's possible this feature is working as desired, but was overlooked by accident.


> Could you please elaborate on what is supported, and what is not?

I'm not sure I understand the question. Do you mean the VBA interop? Or Thai justification specifically?

What we support is Thai distribute. What we don't support is a separate option for using English justification with Thai text. In my opinion, what Word is doing here doesn't make a lot of sense, and we shouldn't try to emulate it.