Feature changed by: Kohei Yoshida (kohei_yoshida) Feature #308334, revision 22 Title: Distribute individual letters across cell width and height (aka 均 等割符) Requested by: Kohei Yoshida (kohei_yoshida) Description: 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 vertical direction. This functionality is also known as Kin-tou Wari-fu (均等割符) in Japanese, and is very common operation among Japanese Excel users. Relations: - i#107467 - Excel import issue with cells with distributed content (url: http://qa.openoffice.org/issues/show_bug.cgi?id=107467) - i#107470 - Request for this feature in the upstream IZ (url: http://qa.openoffice.org/issues/show_bug.cgi?id=107470) - User-contributed doc on text justification in Japanese text. (url: http://wiki.services.openoffice.org/wiki/User:Foral/Spec/Justification) Use Case: 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. Discussion: #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 alignment. Reference: http://www.w3.org/TR/xsl/#text-align #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 standard. #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: http://www.w3.org/TR/1999/WD-i18n-format-19990910/#a5 #7: Kohei Yoshida (kohei_yoshida) (2010-01-05 17:59:37) (reply to #6) This one is the latest spec of the fore-cited: http://www.w3.org/TR/i18n-format/#text-justify #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 + #10) + 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 + text processing. -- openSUSE Feature: https://features.opensuse.org/308334