config: add inheritable option “font-shaping”

This patch adds an inheritable option, “font-shaping”, that controls
whether a particle that renders text should enable font-shaping or
not.

The option works similar to the ‘font’ option: one can set it at the
top-level, and it gets inherited down through all modules and to their
particles.

Or, you can set it on a module and it gets inherited to all its
particles, but not to other modules’ particles.

Finally, you can set it on individual particles, in which case it only
applies to them (or “child” particles).

When font-shaping is enabled (the default), the string particle shapes
full text runs using the fcft_rasterize_text_run_utf32() API. In fcft,
this results in HarfBuzz being used to shape the string.

When disabled, the string particle instead uses the simpler
fcft_rasterize_char_utf32() API, which rasterizes individual
characters.

This gives user greater control over the font rendering. One example
is bitmap fonts, which HarfBuzz often doesn’t get right.

Closes #159
This commit is contained in:
Daniel Eklöf 2022-02-23 18:43:13 +01:00
parent 265188ca4c
commit ffccabbb13
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
17 changed files with 106 additions and 8 deletions

View file

@ -31,14 +31,15 @@ particle_default_destroy(struct particle *particle)
struct particle *
particle_common_new(int left_margin, int right_margin,
const char **on_click_templates,
struct fcft_font *font, pixman_color_t foreground,
struct deco *deco)
struct fcft_font *font, enum font_shaping font_shaping,
pixman_color_t foreground, struct deco *deco)
{
struct particle *p = calloc(1, sizeof(*p));
p->left_margin = left_margin;
p->right_margin = right_margin;
p->foreground = foreground;
p->font = font;
p->font_shaping = font_shaping;
p->deco = deco;
if (on_click_templates != NULL) {