CFF COLR/CPAL, anyone?
Adam Jagosz
Posts: 689
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?
Tagged:
1
Comments
-
Adam Jagosz said:There are numerous OpenType color fonts, for example Amiri Quran Colored and Twemoji Mozilla (comes with Firefox).Is there any reason for the prevalence of TT-COLR/CPAL, apart from hinting decisions etc.?
0 -
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.
0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 801 Font Technology
- 1K Technique and Theory
- 618 Type Business
- 444 Type Design Critiques
- 542 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 483 Typography
- 301 History of Typography
- 114 Education
- 68 Resources
- 498 Announcements
- 79 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 269 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports