mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
When resizing the font on-the-fly, we now do a complete font-reload (this is basically what fcft_size_adjust() did anyway). To get the correct size, we maintain the current size ourselves. We get the initial size from the user-provided font pattern, by converting the string to an FcPattern, and using FcPatternGet() to retrieve both the FC_SIZE and FC_PIXEL_SIZE attributes. These attributes are then removed from the pattern, and the pattern is converted back to a string. The terminal struct maintains a copy of the font sizes. These are initially set to the sizes from the config. When the user resizes the font, the terminal-local sizes are adjusted. To ensure the primary and user-configured fallback fonts are resizes equally much, convert any pixel sizes to point sizes at this point. When the font size is reset, we reload the font sizes from the config (thus once again returning actual pixel-sizes, if that's what the user has configured).
98 lines
2.1 KiB
C
98 lines
2.1 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#include <tllist.h>
|
|
|
|
#include "terminal.h"
|
|
|
|
struct config_font {
|
|
char *pattern;
|
|
double pt_size;
|
|
int px_size;
|
|
};
|
|
|
|
struct config {
|
|
char *term;
|
|
char *shell;
|
|
char *title;
|
|
char *app_id;
|
|
bool login_shell;
|
|
unsigned width;
|
|
unsigned height;
|
|
unsigned pad_x;
|
|
unsigned pad_y;
|
|
enum { STARTUP_WINDOWED, STARTUP_MAXIMIZED, STARTUP_FULLSCREEN } startup_mode;
|
|
|
|
tll(struct config_font) fonts;
|
|
|
|
int scrollback_lines;
|
|
|
|
struct {
|
|
uint32_t fg;
|
|
uint32_t bg;
|
|
uint32_t regular[8];
|
|
uint32_t bright[8];
|
|
uint16_t alpha;
|
|
} colors;
|
|
|
|
struct {
|
|
enum cursor_style style;
|
|
bool blink;
|
|
struct {
|
|
uint32_t text;
|
|
uint32_t cursor;
|
|
} color;
|
|
} cursor;
|
|
|
|
struct {
|
|
/* Bindings for "normal" mode */
|
|
char *key[BIND_ACTION_COUNT];
|
|
struct mouse_binding mouse[BIND_ACTION_COUNT];
|
|
|
|
/*
|
|
* Special modes
|
|
*/
|
|
|
|
/* While searching (not - action to *start* a search is in the
|
|
* 'key' bindings above */
|
|
char *search[BIND_ACTION_SEARCH_COUNT];
|
|
} bindings;
|
|
|
|
struct {
|
|
enum { CONF_CSD_PREFER_SERVER, CONF_CSD_PREFER_CLIENT } preferred;
|
|
|
|
int title_height;
|
|
int border_width;
|
|
int button_width;
|
|
|
|
struct {
|
|
bool title_set;
|
|
bool minimize_set;
|
|
bool maximize_set;
|
|
bool close_set;
|
|
uint32_t title;
|
|
uint32_t minimize;
|
|
uint32_t maximize;
|
|
uint32_t close;
|
|
} color;
|
|
} csd;
|
|
|
|
size_t render_worker_count;
|
|
char *server_socket_path;
|
|
bool presentation_timings;
|
|
bool hold_at_exit;
|
|
|
|
struct {
|
|
uint64_t delayed_render_lower_ns;
|
|
uint64_t delayed_render_upper_ns;
|
|
off_t max_shm_pool_size;
|
|
} tweak;
|
|
};
|
|
|
|
bool config_load(struct config *conf, const char *path);
|
|
void config_free(struct config conf);
|
|
|
|
struct config_font config_font_parse(const char *pattern);
|
|
void config_font_destroy(struct config_font *font);
|