Add color mode font option
It would be helpful when testing color fonts to be able to render both the color and outline versions of the same glyph to check the metrics. It is probably also useful to allow this as an API function. When rendering to a monochrome device such as a monochrome printer, the outline glyph looks much better than a grayscale color glyph.
This MR adds a font option to disable color glyphs. The font option is:
typedef enum _cairo_color_mode {
CAIRO_COLOR_MODE_DEFAULT,
CAIRO_COLOR_MODE_NO_COLOR,
CAIRO_COLOR_MODE_COLOR
} cairo_color_mode_t;
I used the term "color mode" to avoid the confusion names like cairo_color_t or cairo_font_color_t would cause.
Note: this MR also contains the palette option in !332 (merged). I didn't want to have to deal with the merge conflicts, so just review the color mode commit. I'll rebase this MR once !332 (merged) is merged.
This is the output from
for (unsigned int i = 0; i < 15; i++) {
if (i == 8)
cairo_font_options_set_color_mode (font_options, CAIRO_COLOR_MODE_NO_COLOR);
cairo_font_options_set_color_palette (font_options, i);
cairo_set_font_options (cr, font_options);
cairo_show_text (cr, "A");
}
using the same font I used in !332 (merged)