Options

CFF COLR/CPAL, anyone?

Adam JagoszAdam Jagosz Posts: 689
edited February 2020 in Font Technology
Since for graphic design apps you need SVG in OpenType fonts, most color fonts are available in this format. Of the few that opted for COLR/CPAL (supported in the browsers), all are TrueType-flavored, and I could only find two: Bungee and Rocher.
What is appealing to me in this format is the ability to freely control ar least one color in the font: the CSS currentColor, or in other words, the regular ordinary font color. Contours with colorID="65535" in the COLR table will inherit this color (in Firefox and Edge it works fine, Chrome has a bug that turns the currentColor into grayscale).
SVG-in-OT fonts allow to do this as well but it seems a bit more complicated, I think... related thread.
FontLab doesn't allow to set this “nude” color, and in addition it doesn't export anything into the COLR table for black contours, but I managed to work around this by coloring the black green or whatever, and then, via TTX, changing it back to black in the CPAL table, and “nudifying” the other color by replacing colorID="1" with colorID="65535" in the COLR table. I also removed the no longer used color from the CPAL table and added a couple more (now single-color) palettes for the hard-coded color, in case some app in the future starts supporting CPAL selection (does any yet?).
According to a Glyphs tutorial on creating COLR/CPAL fonts, there is no obstacle to creating a CFF-flavored COLR/CPAL font. FontLab, however, only allows to create TT fonts of this kind.
Several months ago, I wrote a Python script merging two CFF fonts (via TTX) into a COLR/CPAL font in just under 400 lines. I'm not sure whether it's production-ready, but the fonts work in Chrome and Firefox. Anything to look out for?
Is there any reason for the prevalence of TT-COLR/CPAL, apart from hinting decisions etc.?
The reason to use CFF is obvious: file size. In my case it's 360kB vs 2.2MB... Should I bug the FL team for this feature or roll it on my own? @Yury Yarmola @Adam Twardoch @Igor Freiberger Will this be much work for you in comparison with users' demand?

Comments

  • Options
    Erwin DenissenErwin Denissen Posts: 291
    edited February 2020
    Since for graphic design apps you need SVG in OpenType fonts, most color fonts are available in this format. Of the few that opted for COLR/CPAL (supported in the browsers), all are TrueType-flavored, and I could only find two: Bungee and Rocher.
    There are numerous OpenType color fonts, for example Amiri Quran Colored and Twemoji Mozilla (comes with Firefox).

    And several made with FontCreator. For example Odana, BabelStone Flags and Flags World Color.

    Is there any reason for the prevalence of TT-COLR/CPAL, apart from hinting decisions etc.?
    I don't think so, but maybe other people know more about this.



  • Options
    I made a COLR/CPAL/CFF font, works fine in all applications I tested it with. I’m not aware of any limitations related to the glyph format, COLR table uses glyph indices.
Sign In or Register to comment.