[usf-devel] Character orientation in Asian and Mongolian read-direction (vertical text lines)

  • From: unmei <unmei@xxxxxxxxxxxx>
  • To: usf-devel@xxxxxxxxxxxxx
  • Date: Sat, 13 Aug 2005 20:36:40 +0200

<please excuse if this is a double post, but i think the original gots swallowed on the way to the newsgroup>

I would like to get some feedback on how we should handle glyphs ("letter pictures") when the read-direction attribute is set to Asian or Mongolian.
In this case glyphs in the "native" script are usually rendered upright, but words in other scripts, namely in latin alphabet are sometimes rotated by 90Â clockwise (tilt your head to the right to read). Now, in unicode there is a "asian-width" property assigned to each symbol ("letter") this property in some way relates to our orientation problem in that you have narrow, wide, half-width and full-width versions of US-ASCII characters. And all CJK letters tagged as wide or full-width are always upright. But the problem is that you cannot say, ok then we rotate all tagged as narrow or half-width. For one, there are CJK characters tagged as one of those as well. Then you have Mongolian (any maybe other Scripts to be upright) that are tagged as narrow but they need to be upright. Also there are a lot of narrow or ambiguous tagged misc symbols, punctuation that may have to be upright or rotated or even depending on context. And finally you would want to write a western word in upright manner that contains letter that have no wide/full-width tagged representation (for example containing an umlaut or accent).


For this reason i think for a solution where decision on orientation is made from the character code (any maybe its neighbour characters) it is very difficult to define a satisfactory set of rules (let alone a complete and final solution).

Therefore i now think the "best" approach is to introduce an attribute that defines the orientation of glyphs. This should be a fontstyle attribute in order to allow adjusting the representation of a single word within a longer run in a subtitle text by using the attribute in a <font> tag, or refer to a style defining the orientation by specifying that style also in a <font> tag around the word in question.

It is probably safe to ignore that attribute when the read-direction is Western or Arabic. However if it is not ignored you could create funny things here, especially if that tag is interpreted to turn the character 90Â counter-clockwise instead of clockwise. Or the attributes could allow values "+90", "0", "-90" and maybe more instead of a simple boolean flag such as "upright"|"rotated".

The attribute should not be required, therefore it should default to the most used setting. I think this is "upright" (else you have to specify it on all text in CJK/Mongolian when using Asian/Mongolian read-direction!).

If the attribute is to be an amount of rotation rather than a boolean flag, the default should be "0"(Â) and is interpreted as upright in Asian/Mongolian read-direction. For simplicity, i think the attribute values in this case should (at least for a start) be restricted to multiples of 90Â. Intermediate values allow for fancy effects, but proper positioning of such glyphs may pose a problem because the "effective" bounding box had to non-orthogonal to the text baseline.




In conclusion i propose the the introduction of a fontstyle attribute "glyph-rot" with positive or negative values representing glyph rotation given in counter-clockwise degrees without unit (without "Â"). The default value is "0". Mandatory support for non-animated values "-90", "0", "90", "180" and optional (possibly mandatory in the future? - rather not..) support of any real number and animation.


Comments are welcome.

If no-one replies, i assume it is ok to include this in a next proposal, implement it in pixifier and drop the recently introduced automatic rotation of characters with code below 128 (that is, US-ASCII type letters).

[examples]
assuming the read-direction is Asian or Mongolian and the default style does not set the glyph-rot attribute.


<text>ãã<font glyph-rot="-90">GraphEdit</font>ãCPUãç<br/>ããããã ãããããããããã</text>

Here the word "GraphEdit" is rotated to look like in western script if you tilt your head to the right (as if left side were bottom). The also western script word "CPU" is rendered like all the japanese letters, upright letters and one "per western line" like this:
C
P
U


<style name="tilt">
  <fontstyle glyph-rot="-90">
</style>

<text>ãã<font style="tilt">GraphEdit</font>ãCPUãç<br/>ãããããã ããããããããã</text>

This second example uses a style to rotate the glyphs, but the output looks the same as that of the first example.


regards, unmei

http://usf.corecodec.org

Other related posts: