On Thu, 22 Feb 2018 10:55:23 +0000 (GMT) William_J_G Overington <wjgo_10...@btinternet.com> wrote:
> Richard Wordingham wrote: > > > 'Foreground' and 'background' are the only externally defined > > colours. There's no ability to explicitly choose, say 'text stroked > > sable and dotted gules'. Instead, it's 'text stroked sable and > > dotted proper', with a choice of palettes to define 'proper'. > External selection of decoration colours would theroretically be > possible, I do not know how difficult this would be to implement. The problem lies in changing existing interfaces. I can only speak with any real knowledge for the OpenType COLR/CPAL method. The change would be a major pain in programming languages with obligatory (even if implicit) typing. At present, foreground and background need to be specified (if only be default) and passed into the painting routines. You now want to expand the foreground argument into a list of colours - or possibly a callback routine. The next issue is what is to happen when the list provided is too short. Without suitable handling, this may cause problems with fonts that already work in applications that at one interface level know nothing about colour fonts. For example, the HTML code that I have been using with my font knows nothing about colour fonts as such. To get colour with my web page, I just select a coloured font. The final issue that springs to mind is that the COLR table of OpenType allows for 65,535 different colours in glyphs; 0xFFFF is the only reserved colour ID. It represents the foreground colour. If there is only one palette in the font, 0xFFFE can be a legitimate user-defined colour ID. I wouldn't be surprised if such an assignment survived the transition from a proof-of-principle font to a released font. A less painful method for interfaces might be the selection of palettes by name. However, there are rather more possible colour combinations than can be accommodated in an sfnt name table, so an approximation algorithm would be required. It would also make the CPAL tables larger and much more difficult to generate. There are also 30 unassigned bits left in the palette's type attribute. Of course, Unicode is not constrained by what is currently available, and as an entity is interested at most in what is feasible rather than the precise mechanisms. Several full members, though, will care about precise mechanisms. Richard.