From: Christopher John Fynn (cfynn@gmx.net)
Date: Sun Dec 07 2003 - 20:39:56 EST
"John Hudson" <tiro@tiro.com> wrote:
> The way to do this is to decompose bases and marks at the glyph level if
> they are not already decomposed at the character level, and then to apply a
> colour to the mark. In order to do this you need to know what is a mark
> glyph and what is abase glyph (this doesn't necessarily correspond to what
> is a mark character and a base character, so areguably this is not a
> Unicode question).
But you can't depend on being able to do this with all fonts. Consider the
example U+0F66 U+0FA4 U+0FB1 U+0F74
(illustrated in the attached file) this consists of four characters: a base
consonant, two dependant consonants and a dependant vowel as illustrated in the
top line. These combine as in the bottom two lines illustrated in two
different forms of Tibetan script.
In the line second from bottom it *might* be possible to colour each of the
different constituents *if* the whole combination of the first three consonant
characters and the final vowel character were implemented in the font as
separate glyphs which combined. This would involve complex lookups since the
individual glyph parts change size and position as successive elements are
added. So in many fonts the combination formed by the first three consonants
might be implemented as a single ligature glyph - with no provision for
building the combination from component parts - and the vowel as a combining
mark. In this case you might be able to colour the vowel but the three
consonant combination would have to be a single colour.
In other fonts, the glyph for U+0F66 might be a single component; U+0FA4 U+0FB1
might be another component and U+0F74 a third component.
If the font were a cursive style, as in the bottom line, it is likely the
whole combination of four characters would form a single ligature, in which
case none of the component parts could be individually coloured.
A browser encountering
<p>SPYU <span style="color:#FF0000;" > ས</span><span
style="color:#FFFF00;" >ྤ</span><span style="color:#008000;"
>ྱ</span><span style="color:#0000FF;" > ུ</span></p>
doesn't know whether the font can properly display this combination using four
glyphs, three glyphs, two glyphs or only by using a single glyph. This is going
to be dependant on how the font designer has chosen to implement the font -
and there may be good reasons for him to do things in any of these ways. In
other words what individual characters in a combination (consisting of a base
character and one or more dependent characters) can and cannot be coloured is
always going to be unpredictable - unless a font with which it has been
tested is specified and present on the client (and the rendering system can
handle it).
- Chris
This archive was generated by hypermail 2.1.5 : Sun Dec 07 2003 - 21:35:12 EST