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-07-08 16:22 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
Screenshot showing justified Thai text (302.16 KB, image/png)
2025-07-05 19:18 UTC, not-6248
Details
Screenshot showing distributed Thai text (115.67 KB, image/png)
2025-07-07 15:12 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.
Comment 11 not-6248 2025-07-05 19:18:12 UTC
Created attachment 201674 [details]
Screenshot showing justified Thai text
Comment 12 not-6248 2025-07-05 19:19:12 UTC
Comment on attachment 201674 [details]
Screenshot showing justified Thai text

Screenshot showing justified Thai text 3 styles
Comment 13 not-6248 2025-07-05 19:20:32 UTC
Comment on attachment 201674 [details]
Screenshot showing justified Thai text

by simulating three scenarios
Comment 14 not-6248 2025-07-05 19:21:11 UTC
(In reply to Jonathan Clark from comment #10)
> (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.

Okay, if Thai is already distributed but in justified text, could you please share the steps to reproduce it so I can achieve the same result as you? I tried it myself, but the output didn’t turn out as expected.
Comment 15 Jonathan Clark 2025-07-07 15:12:27 UTC
Created attachment 201687 [details]
Screenshot showing distributed Thai text
Comment 16 Jonathan Clark 2025-07-07 15:23:17 UTC
(In reply to not-6248 from comment #14)
> Okay, if Thai is already distributed but in justified text, could you please
> share the steps to reproduce it so I can achieve the same result as you? I
> tried it myself, but the output didn’t turn out as expected.

Very happy to:

Thai justification is documented here: https://help.libreoffice.org/latest/en-US/text/shared/guide/ctl.html

In order for this feature to work, the paragraph has to be justified and the text language must be set to Thai. There are a few different ways of doing this, but the easiest is to select the text and click on the status bar language item. I drew a red circle around it in my screenshot.
Comment 17 not-6248 2025-07-08 13:48:29 UTC
(In reply to Jonathan Clark from comment #16)
> (In reply to not-6248 from comment #14)
> > Okay, if Thai is already distributed but in justified text, could you please
> > share the steps to reproduce it so I can achieve the same result as you? I
> > tried it myself, but the output didn’t turn out as expected.
> 
> Very happy to:
> 
> Thai justification is documented here:
> https://help.libreoffice.org/latest/en-US/text/shared/guide/ctl.html
> 
> In order for this feature to work, the paragraph has to be justified and the
> text language must be set to Thai. There are a few different ways of doing
> this, but the easiest is to select the text and click on the status bar
> language item. I drew a red circle around it in my screenshot.

Oh my god, it worked beautifully!
I think most Thai people probably don't know about this because the menu names are different, the method is different, and the documentation lacks illustrations, which makes it a bit confusing.

I'll share this information further so it can benefit those who want to use the Thai distributed feature.
Thank you!
Comment 18 Roman Kuznetsov 2025-07-08 16:22:22 UTC
So, we can close this one as WorksForMe?