mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-21 20:05:42 +02:00
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
60 lines
1.3 KiB
C
60 lines
1.3 KiB
C
#pragma once
|
|
|
|
#include "../color.h"
|
|
#include "../font-shaping.h"
|
|
#include "../module.h"
|
|
|
|
struct bar {
|
|
int abort_fd;
|
|
|
|
void *private;
|
|
int (*run)(struct bar *bar);
|
|
void (*destroy)(struct bar *bar);
|
|
|
|
void (*refresh)(const struct bar *bar);
|
|
void (*set_cursor)(struct bar *bar, const char *cursor);
|
|
|
|
const char *(*output_name)(const struct bar *bar);
|
|
};
|
|
|
|
enum bar_location { BAR_TOP, BAR_BOTTOM };
|
|
enum bar_layer { BAR_LAYER_TOP, BAR_LAYER_BOTTOM };
|
|
enum bar_backend { BAR_BACKEND_AUTO, BAR_BACKEND_XCB, BAR_BACKEND_WAYLAND };
|
|
|
|
struct bar_config {
|
|
enum bar_backend backend;
|
|
|
|
const char *monitor;
|
|
enum bar_layer layer;
|
|
enum bar_location location;
|
|
enum font_shaping font_shaping;
|
|
int height;
|
|
int left_spacing, right_spacing;
|
|
int left_margin, right_margin;
|
|
int trackpad_sensitivity;
|
|
|
|
pixman_color_t background;
|
|
|
|
struct {
|
|
int left_width, right_width;
|
|
int top_width, bottom_width;
|
|
pixman_color_t color;
|
|
int left_margin, right_margin;
|
|
int top_margin, bottom_margin;
|
|
} border;
|
|
|
|
struct {
|
|
struct module **mods;
|
|
size_t count;
|
|
} left;
|
|
struct {
|
|
struct module **mods;
|
|
size_t count;
|
|
} center;
|
|
struct {
|
|
struct module **mods;
|
|
size_t count;
|
|
} right;
|
|
};
|
|
|
|
struct bar *bar_new(const struct bar_config *config);
|