mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
config: add setting for underline thickness
This adds an "underline-thickness" setting to the "main" section, similar to the existing "underline-offset" setting. This setting is used to specify a custom height for regular (= non-cursor) underlines. Fixes #1136
This commit is contained in:
parent
65ecb77737
commit
a0942f950d
7 changed files with 29 additions and 1 deletions
|
|
@ -42,6 +42,12 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* Support for adjusting the thickness of regular underlines ([#1136][1136]).
|
||||||
|
|
||||||
|
[1136]: https://codeberg.org/dnkl/foot/issues/1136
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
* Window is now dimmed while in Unicode input mode.
|
* Window is now dimmed while in Unicode input mode.
|
||||||
|
|
|
||||||
4
config.c
4
config.c
|
|
@ -904,6 +904,9 @@ parse_section_main(struct context *ctx)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "underline-thickness") == 0)
|
||||||
|
return value_to_pt_or_px(ctx, &conf->underline_thickness);
|
||||||
|
|
||||||
else if (strcmp(key, "dpi-aware") == 0) {
|
else if (strcmp(key, "dpi-aware") == 0) {
|
||||||
if (strcmp(value, "auto") == 0)
|
if (strcmp(value, "auto") == 0)
|
||||||
conf->dpi_aware = DPI_AWARE_AUTO;
|
conf->dpi_aware = DPI_AWARE_AUTO;
|
||||||
|
|
@ -2833,6 +2836,7 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
.vertical_letter_offset = {.pt = 0, .px = 0},
|
.vertical_letter_offset = {.pt = 0, .px = 0},
|
||||||
.use_custom_underline_offset = false,
|
.use_custom_underline_offset = false,
|
||||||
.box_drawings_uses_font_glyphs = false,
|
.box_drawings_uses_font_glyphs = false,
|
||||||
|
.underline_thickness = {.pt = 0., .px = -1},
|
||||||
.dpi_aware = DPI_AWARE_AUTO, /* DPI-aware when scaling-factor == 1 */
|
.dpi_aware = DPI_AWARE_AUTO, /* DPI-aware when scaling-factor == 1 */
|
||||||
.bell = {
|
.bell = {
|
||||||
.urgent = false,
|
.urgent = false,
|
||||||
|
|
|
||||||
1
config.h
1
config.h
|
|
@ -150,6 +150,7 @@ struct config {
|
||||||
|
|
||||||
bool use_custom_underline_offset;
|
bool use_custom_underline_offset;
|
||||||
struct pt_or_px underline_offset;
|
struct pt_or_px underline_offset;
|
||||||
|
struct pt_or_px underline_thickness;
|
||||||
|
|
||||||
bool box_drawings_uses_font_glyphs;
|
bool box_drawings_uses_font_glyphs;
|
||||||
bool can_shape_grapheme;
|
bool can_shape_grapheme;
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,18 @@ commented out will usually be installed to */etc/xdg/foot/foot.ini*.
|
||||||
|
|
||||||
Default: _unset_.
|
Default: _unset_.
|
||||||
|
|
||||||
|
*underline-thickness*
|
||||||
|
Use a custom thickness (height) for underlines. The thickness is, by
|
||||||
|
default, in _points_.
|
||||||
|
|
||||||
|
To specify a thickness in _pixels_, append *px*:
|
||||||
|
*underline-thickness=1px*.
|
||||||
|
|
||||||
|
If left unset (the default), the thickness specified in the font is
|
||||||
|
used.
|
||||||
|
|
||||||
|
Default: _unset_
|
||||||
|
|
||||||
*box-drawings-uses-font-glyphs* Boolean. When disabled, foot generates
|
*box-drawings-uses-font-glyphs* Boolean. When disabled, foot generates
|
||||||
box/line drawing characters itself. The are several advantages to
|
box/line drawing characters itself. The are several advantages to
|
||||||
doing this instead of using font glyphs:
|
doing this instead of using font glyphs:
|
||||||
|
|
|
||||||
1
foot.ini
1
foot.ini
|
|
@ -17,6 +17,7 @@
|
||||||
# horizontal-letter-offset=0
|
# horizontal-letter-offset=0
|
||||||
# vertical-letter-offset=0
|
# vertical-letter-offset=0
|
||||||
# underline-offset=<font metrics>
|
# underline-offset=<font metrics>
|
||||||
|
# underline-thickness=<font underline thickness>
|
||||||
# box-drawings-uses-font-glyphs=no
|
# box-drawings-uses-font-glyphs=no
|
||||||
# dpi-aware=auto
|
# dpi-aware=auto
|
||||||
|
|
||||||
|
|
|
||||||
5
render.c
5
render.c
|
|
@ -372,7 +372,10 @@ draw_underline(const struct terminal *term, pixman_image_t *pix,
|
||||||
const struct fcft_font *font,
|
const struct fcft_font *font,
|
||||||
const pixman_color_t *color, int x, int y, int cols)
|
const pixman_color_t *color, int x, int y, int cols)
|
||||||
{
|
{
|
||||||
const int thickness = font->underline.thickness;
|
const int thickness = term->conf->underline_thickness.px >= 0
|
||||||
|
? term_pt_or_px_as_pixels(
|
||||||
|
term, &term->conf->underline_thickness)
|
||||||
|
: font->underline.thickness;
|
||||||
|
|
||||||
/* Make sure the line isn't positioned below the cell */
|
/* Make sure the line isn't positioned below the cell */
|
||||||
const int y_ofs = min(underline_offset(term, font),
|
const int y_ofs = min(underline_offset(term, font),
|
||||||
|
|
|
||||||
|
|
@ -470,6 +470,7 @@ test_section_main(void)
|
||||||
test_pt_or_px(&ctx, &parse_section_main, "letter-spacing", &conf.letter_spacing);
|
test_pt_or_px(&ctx, &parse_section_main, "letter-spacing", &conf.letter_spacing);
|
||||||
test_pt_or_px(&ctx, &parse_section_main, "horizontal-letter-offset", &conf.horizontal_letter_offset);
|
test_pt_or_px(&ctx, &parse_section_main, "horizontal-letter-offset", &conf.horizontal_letter_offset);
|
||||||
test_pt_or_px(&ctx, &parse_section_main, "vertical-letter-offset", &conf.vertical_letter_offset);
|
test_pt_or_px(&ctx, &parse_section_main, "vertical-letter-offset", &conf.vertical_letter_offset);
|
||||||
|
test_pt_or_px(&ctx, &parse_section_main, "underline-thickness", &conf.underline_thickness);
|
||||||
|
|
||||||
test_uint16(&ctx, &parse_section_main, "resize-delay-ms", &conf.resize_delay_ms);
|
test_uint16(&ctx, &parse_section_main, "resize-delay-ms", &conf.resize_delay_ms);
|
||||||
test_uint16(&ctx, &parse_section_main, "workers", &conf.render_worker_count);
|
test_uint16(&ctx, &parse_section_main, "workers", &conf.render_worker_count);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue