Feature changed by: Stefan Behlert (sbehlert)
Feature #308334, revision 31
Title: Distribute individual letters across cell width and height (aka 均
Requested by: Kohei Yoshida (kohei_yoshida)
Distribute letters at equal intervals across cell's width such that the
first and last letters are aligned with the left and right edge of the
cell, respectively. Also support similar distribution mechanism in a
This functionality is also known as Kin-tou Wari-fu (均等割符) in Japanese,
and is very common operation among Japanese Excel users.
- Support for distributed text in Draw/Impress (feature/id: 308884)
- i#107467 - Excel import issue with cells with distributed content
- i#107470 - Request for this feature in the upstream IZ (url:
- i#53373 - Jusitification issue in Draw/Impress for Japanese text. (url:
- OASIS TC JIRA issue for the file format change proposal (url:
- User-contributed doc on text justification in Japanese text. (url:
i#71067 - RFE: Distributed justification in Draw. (url:
Sentences in the Japanese language do not normally break at each word
unlike most Western languages. The normal justification functionality
is therefore useless for the Japanese users. Instead, they typically
justify sentences by adjusting spaces between letters, which is what
this requested functionality will provide.
#3: Kohei Yoshida (kohei_yoshida) (2010-01-05 14:22:02)
I've started looking into this.
#4: Kohei Yoshida (kohei_yoshida) (2010-01-05 17:36:46)
Here is the initial hurdle: Calc uses XSL-FO for all text formatting,
and fo:text-align specifies the alignment of a text (I assume for both
horizontal and vertical directions). The bad news is that, this
attribute does not allow a "distributed" alignment, but in order for us
to implement this feature, we need that to allow a distributed
#5: Kohei Yoshida (kohei_yoshida) (2010-01-05 17:45:10) (reply to #4)
Well, I guess I could use the "justify" alignment and additional flag
to specify how the content is justified. The spec allows user-agent-
specific justification algorithm, so it's doable without breaking the
#6: Kohei Yoshida (kohei_yoshida) (2010-01-05 17:49:15) (reply to #5)
And we could perhaps use the 'text-justify' attribute to specify the
justification algorithm. See below:
#7: Kohei Yoshida (kohei_yoshida) (2010-01-05 17:59:37) (reply to #6)
This one is the latest spec of the fore-cited:
#8: Kohei Yoshida (kohei_yoshida) (2010-01-08 12:39:43)
Ok. Here is how I've decided to store this in ODF.
For both normal justifiation and distributed justification, the style
attribute 'fo:text-align' is saved as 'justify'. Then, for the
distributed justification, an additional style attribute 'csstext3:text-
justify' gets stored with a value of 'distribute'. For the normal
justification, either this value is 'auto', or this attribute won't get
stored at all.
It took me a while to get to this point since OOo's handling of style
attributes and how they are exported to xml are very complex. But I
eventually got it to save and load correctly.
#9: Kohei Yoshida (kohei_yoshida) (2010-01-11 13:23:40)
For alignment in vertical direction, the current ODF uses style:
vertical-align attribute which can be either one of: automatic, bottom,
middle, top. First, we need to add a new alignment type 'justify' to
the style:vertical-align, and use another attribute to specify the
justification method. This would be similar to how the horizontal
justification is handled. The problem is that we can't reuse the same
'text-justify' attribute name since that would clash with the
horizontal justification method attribute. We need a new attribute name
for this to avoid such naming clash.
The first name that comes to mind is style:vertical-justify , which
specifies the same set of values that the csstext3:text-justify
supports. Of course, this imlies that to finalize this feature we need
to get blessing from the ODF TC, which may not happen in a timely
manner. We need to come up with a "solution" for that as well.
#10: Kohei Yoshida (kohei_yoshida) (2010-01-11 22:20:20)
So, I was wrong in thinking that this would be a very simple task. Not
at all... Calculating text / char spacing involves at least 3 modules:
sc, svx, and vcl. So, while the text attributes themselves originate
from sc, the actual drawing of the text is done by svx and vcl.
On the bright side, once we implement this feature, it would be trivial
to extend this support to Draw and Impress as well, since those two
apps simply re-use the same text rendering code.
#11: Kohei Yoshida (kohei_yoshida) (2010-01-12 15:38:08) (reply to
Finally found where the text justification code is. Luckily fixing this there
will automatically fix it for all of Calc/Impress/Draw for the Japanese
#12: Kohei Yoshida (kohei_yoshida) (2010-01-12 16:01:07) (reply to
Just fixed i#53373 (http://qa.openoffice.org/issues/show_bug.cgi?id=53373
#13: Kohei Yoshida (kohei_yoshida) (2010-01-15 09:14:05)
Implementation is nearing to a finish. What remains to be done are:
1) formally propose a file format change to ODF TC. At least file a
change proposal to JIRA (TC's bug database).
2) work on the xls and xlsx import and export filters, to support the
new text alignments.
3) support distributed justification in Impress and Draw.
in order or priority.
#14: Kohei Yoshida (kohei_yoshida) (2010-01-15 20:40:03)
Drafted a file format change proposal here:
The corresponding JIRA issue is filed here
#15: Kohei Yoshida (kohei_yoshida) (2010-01-21 20:18:30)
Some pretty screenshots in my blog post [
#16: Kohei Yoshida (kohei_yoshida) (2010-01-25 23:22:18)
xls and xlsx import/export is now finished.
#17: Kohei Yoshida (kohei_yoshida) (2010-01-25 23:50:15)
I'll punt the draw/impress support of this feature to a later version.