mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-04-14 08:21:27 -04:00
config: add curly-underline-height
This commit is contained in:
parent
33106514db
commit
9d3b34d0f5
4 changed files with 32 additions and 2 deletions
16
config.c
16
config.c
|
|
@ -1075,6 +1075,21 @@ parse_section_main(struct context *ctx)
|
||||||
else if (streq(key, "underline-thickness"))
|
else if (streq(key, "underline-thickness"))
|
||||||
return value_to_pt_or_px(ctx, &conf->underline_thickness);
|
return value_to_pt_or_px(ctx, &conf->underline_thickness);
|
||||||
|
|
||||||
|
else if (streq(key, "curly-underline-height")) {
|
||||||
|
float value;
|
||||||
|
if (!value_to_float(ctx, &value))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (value < 0.5 || value > 5.0) {
|
||||||
|
LOG_CONTEXTUAL_WARN(
|
||||||
|
"curly-underline-height should be between 0.5 and 5.0, clamping");
|
||||||
|
value = value < 0.5 ? 0.5 : 5.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
conf->curly_underline_height_multiplier = value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
else if (streq(key, "strikeout-thickness"))
|
else if (streq(key, "strikeout-thickness"))
|
||||||
return value_to_pt_or_px(ctx, &conf->strikeout_thickness);
|
return value_to_pt_or_px(ctx, &conf->strikeout_thickness);
|
||||||
|
|
||||||
|
|
@ -3481,6 +3496,7 @@ config_load(struct config *conf, const char *conf_path,
|
||||||
.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},
|
.underline_thickness = {.pt = 0., .px = -1},
|
||||||
|
.curly_underline_height_multiplier = 3.0,
|
||||||
.strikeout_thickness = {.pt = 0., .px = -1},
|
.strikeout_thickness = {.pt = 0., .px = -1},
|
||||||
.overline_thickness = {.pt = 0., .px = -1},
|
.overline_thickness = {.pt = 0., .px = -1},
|
||||||
.overline_offset = {.pt = 0., .px = -1},
|
.overline_offset = {.pt = 0., .px = -1},
|
||||||
|
|
|
||||||
1
config.h
1
config.h
|
|
@ -270,6 +270,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;
|
struct pt_or_px underline_thickness;
|
||||||
|
float curly_underline_height_multiplier;
|
||||||
|
|
||||||
struct pt_or_px strikeout_thickness;
|
struct pt_or_px strikeout_thickness;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -186,6 +186,19 @@ empty string to be set, but it must be quoted: *KEY=""*)
|
||||||
|
|
||||||
Default: _unset_
|
Default: _unset_
|
||||||
|
|
||||||
|
*curly-underline-height*
|
||||||
|
Height multiplier for curly underlines (undercurl). This is a unitless
|
||||||
|
multiplier applied to the underline thickness to determine the vertical
|
||||||
|
amplitude of the curly wave.
|
||||||
|
|
||||||
|
For example, a value of *3.0* means the curly underline will extend
|
||||||
|
3 times the underline thickness vertically. Higher values make taller
|
||||||
|
waves, lower values make flatter waves.
|
||||||
|
|
||||||
|
Valid range: *0.5* to *5.0*. Values outside this range will be clamped.
|
||||||
|
|
||||||
|
Default: *3.0*
|
||||||
|
|
||||||
*strikeout-thickness*
|
*strikeout-thickness*
|
||||||
Use a custom thickness (height) for strikeouts. The thickness is, by
|
Use a custom thickness (height) for strikeouts. The thickness is, by
|
||||||
default, in _points_.
|
default, in _points_.
|
||||||
|
|
|
||||||
4
render.c
4
render.c
|
|
@ -445,7 +445,7 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix,
|
||||||
case UNDERLINE_DOUBLE:
|
case UNDERLINE_DOUBLE:
|
||||||
case UNDERLINE_CURLY:
|
case UNDERLINE_CURLY:
|
||||||
y_ofs = min(underline_offset(term, font),
|
y_ofs = min(underline_offset(term, font),
|
||||||
term->cell_height - thickness * 3);
|
term->cell_height - thickness * term->conf->curly_underline_height_multiplier);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNDERLINE_DASHED:
|
case UNDERLINE_DASHED:
|
||||||
|
|
@ -525,7 +525,7 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix,
|
||||||
|
|
||||||
case UNDERLINE_CURLY: {
|
case UNDERLINE_CURLY: {
|
||||||
const int top = y + y_ofs;
|
const int top = y + y_ofs;
|
||||||
const int bot = top + thickness * 3;
|
const int bot = top + thickness * term->conf->curly_underline_height_multiplier;
|
||||||
const int half_x = x + ceil_w / 2.0, full_x = x + ceil_w;
|
const int half_x = x + ceil_w / 2.0, full_x = x + ceil_w;
|
||||||
|
|
||||||
const double bt_2 = (bot - top) * (bot - top);
|
const double bt_2 = (bot - top) * (bot - top);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue