mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-10 05:33:51 -04:00
commit
26b0e3d441
6 changed files with 42 additions and 9 deletions
|
|
@ -65,6 +65,8 @@
|
||||||
(https://codeberg.org/dnkl/foot/issues/581).
|
(https://codeberg.org/dnkl/foot/issues/581).
|
||||||
* Support for overriding configuration options on the command line
|
* Support for overriding configuration options on the command line
|
||||||
(https://codeberg.org/dnkl/foot/issues/554).
|
(https://codeberg.org/dnkl/foot/issues/554).
|
||||||
|
* `underline-offset` option to `foot.ini`
|
||||||
|
(https://codeberg.org/dnkl/foot/issues/490).
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
||||||
17
config.c
17
config.c
|
|
@ -793,6 +793,14 @@ parse_section_main(const char *key, const char *value, struct config *conf,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (strcmp(key, "underline-offset") == 0) {
|
||||||
|
if (!str_to_pt_or_px(
|
||||||
|
value, &conf->underline_offset,
|
||||||
|
conf, path, lineno, "default", "underline-offset"))
|
||||||
|
return false;
|
||||||
|
conf->use_custom_underline_offset = true;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
@ -2514,10 +2522,11 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
},
|
},
|
||||||
.startup_mode = STARTUP_WINDOWED,
|
.startup_mode = STARTUP_WINDOWED,
|
||||||
.fonts = {tll_init(), tll_init(), tll_init(), tll_init()},
|
.fonts = {tll_init(), tll_init(), tll_init(), tll_init()},
|
||||||
.line_height = { .pt = 0, .px = -1, },
|
.line_height = {.pt = 0, .px = -1},
|
||||||
.letter_spacing = { .pt = 0, .px = 0, },
|
.letter_spacing = {.pt = 0, .px = 0},
|
||||||
.horizontal_letter_offset = {.pt = 0, .px = 0, },
|
.horizontal_letter_offset = {.pt = 0, .px = 0},
|
||||||
.vertical_letter_offset = {.pt = 0, .px = 0, },
|
.vertical_letter_offset = {.pt = 0, .px = 0},
|
||||||
|
.use_custom_underline_offset = false,
|
||||||
.box_drawings_uses_font_glyphs = false,
|
.box_drawings_uses_font_glyphs = false,
|
||||||
.dpi_aware = DPI_AWARE_AUTO, /* DPI-aware when scaling-factor == 1 */
|
.dpi_aware = DPI_AWARE_AUTO, /* DPI-aware when scaling-factor == 1 */
|
||||||
.bell = {
|
.bell = {
|
||||||
|
|
|
||||||
3
config.h
3
config.h
|
|
@ -99,6 +99,9 @@ struct config {
|
||||||
struct pt_or_px horizontal_letter_offset;
|
struct pt_or_px horizontal_letter_offset;
|
||||||
struct pt_or_px vertical_letter_offset;
|
struct pt_or_px vertical_letter_offset;
|
||||||
|
|
||||||
|
bool use_custom_underline_offset;
|
||||||
|
struct pt_or_px underline_offset;
|
||||||
|
|
||||||
bool box_drawings_uses_font_glyphs;
|
bool box_drawings_uses_font_glyphs;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -112,10 +112,24 @@ in this order:
|
||||||
|
|
||||||
Default: _0_.
|
Default: _0_.
|
||||||
|
|
||||||
*box-drawings-uses-font-glyphs*
|
*underline-offset*
|
||||||
Boolean. When disabled, foot generates box/line drawing characters
|
Use a custom offset for underlines. The offset is, by default, in
|
||||||
itself. The are several advantages to doing this instead of using
|
_points_ and relative the font's baseline. A positive value
|
||||||
font glyphs:
|
positions the underline under the baseline, while a negative value
|
||||||
|
positions it above the baseline.
|
||||||
|
|
||||||
|
To specify an offset in _pixels_, append *px*:
|
||||||
|
*underline-offset=2px*.
|
||||||
|
|
||||||
|
If left unset (the default), the offset specified in the font is
|
||||||
|
used, or estimated by foot if the font lacks underline positioning
|
||||||
|
information.
|
||||||
|
|
||||||
|
Default: _unset_.
|
||||||
|
|
||||||
|
*box-drawings-uses-font-glyphs* Boolean. When disabled, foot generates
|
||||||
|
box/line drawing characters itself. The are several advantages to
|
||||||
|
doing this instead of using font glyphs:
|
||||||
|
|
||||||
- No antialiasing effects where e.g. line endpoints appear
|
- No antialiasing effects where e.g. line endpoints appear
|
||||||
dimmed down, or blurred.
|
dimmed down, or blurred.
|
||||||
|
|
|
||||||
1
foot.ini
1
foot.ini
|
|
@ -12,6 +12,7 @@
|
||||||
# letter-spacing=0
|
# letter-spacing=0
|
||||||
# horizontal-letter-offset=0
|
# horizontal-letter-offset=0
|
||||||
# vertical-letter-offset=0
|
# vertical-letter-offset=0
|
||||||
|
# underline-offset=<font metrics>
|
||||||
# box-drawings-uses-font-glyphs=no
|
# box-drawings-uses-font-glyphs=no
|
||||||
# dpi-aware=yes
|
# dpi-aware=yes
|
||||||
|
|
||||||
|
|
|
||||||
6
render.c
6
render.c
|
|
@ -319,7 +319,11 @@ draw_underline_with_thickness(
|
||||||
const pixman_color_t *color, int x, int y, int cols, int thickness)
|
const pixman_color_t *color, int x, int y, int cols, int thickness)
|
||||||
{
|
{
|
||||||
/* Make sure the line isn't positioned below the cell */
|
/* Make sure the line isn't positioned below the cell */
|
||||||
int y_ofs = font_baseline(term) - font->underline.position;
|
int y_ofs = font_baseline(term) -
|
||||||
|
(term->conf->use_custom_underline_offset
|
||||||
|
? -term_pt_or_px_as_pixels(term, &term->conf->underline_offset)
|
||||||
|
: font->underline.position);
|
||||||
|
|
||||||
y_ofs = min(y_ofs, term->cell_height - thickness);
|
y_ofs = min(y_ofs, term->cell_height - thickness);
|
||||||
|
|
||||||
pixman_image_fill_rectangles(
|
pixman_image_fill_rectangles(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue