mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
Merge branch 'grapheme-width-max'
This commit is contained in:
commit
2eef28590a
5 changed files with 18 additions and 3 deletions
|
|
@ -35,7 +35,12 @@
|
||||||
|
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
* New value, `max`, for `[tweak].grapheme-width-method`.
|
||||||
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
### Deprecated
|
### Deprecated
|
||||||
### Removed
|
### Removed
|
||||||
|
|
|
||||||
2
config.c
2
config.c
|
|
@ -2248,7 +2248,7 @@ parse_section_tweak(struct context *ctx)
|
||||||
|
|
||||||
return value_to_enum(
|
return value_to_enum(
|
||||||
ctx,
|
ctx,
|
||||||
(const char *[]){"wcswidth", "double-width", NULL},
|
(const char *[]){"wcswidth", "double-width", "max", NULL},
|
||||||
(int *)&conf->tweak.grapheme_width_method);
|
(int *)&conf->tweak.grapheme_width_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
6
config.h
6
config.h
|
|
@ -256,7 +256,11 @@ struct config {
|
||||||
enum fcft_scaling_filter fcft_filter;
|
enum fcft_scaling_filter fcft_filter;
|
||||||
bool overflowing_glyphs;
|
bool overflowing_glyphs;
|
||||||
bool grapheme_shaping;
|
bool grapheme_shaping;
|
||||||
enum {GRAPHEME_WIDTH_WCSWIDTH, GRAPHEME_WIDTH_DOUBLE} grapheme_width_method;
|
enum {
|
||||||
|
GRAPHEME_WIDTH_WCSWIDTH,
|
||||||
|
GRAPHEME_WIDTH_DOUBLE,
|
||||||
|
GRAPHEME_WIDTH_MAX,
|
||||||
|
} grapheme_width_method;
|
||||||
bool render_timer_osd;
|
bool render_timer_osd;
|
||||||
bool render_timer_log;
|
bool render_timer_log;
|
||||||
bool damage_whole_window;
|
bool damage_whole_window;
|
||||||
|
|
|
||||||
|
|
@ -1093,7 +1093,7 @@ any of these options.
|
||||||
*grapheme-width-method*
|
*grapheme-width-method*
|
||||||
Selects which method to use when calculating the width
|
Selects which method to use when calculating the width
|
||||||
(i.e. number of columns) of a grapheme cluster. One of
|
(i.e. number of columns) of a grapheme cluster. One of
|
||||||
*double-width* and *wcswidth*.
|
*wcswidth*, *double-width* and *max*.
|
||||||
|
|
||||||
*wcswidth* simply adds together the individual width of all
|
*wcswidth* simply adds together the individual width of all
|
||||||
codepoints making up the cluster.
|
codepoints making up the cluster.
|
||||||
|
|
@ -1104,6 +1104,8 @@ any of these options.
|
||||||
internally to calculate the width. This results in cursor
|
internally to calculate the width. This results in cursor
|
||||||
de-synchronization issues.
|
de-synchronization issues.
|
||||||
|
|
||||||
|
*max* uses the width of the largest codepoint in the cluster.
|
||||||
|
|
||||||
Default: _wcswidth_
|
Default: _wcswidth_
|
||||||
|
|
||||||
*font-monospace-warn*
|
*font-monospace-warn*
|
||||||
|
|
|
||||||
4
vt.c
4
vt.c
|
|
@ -792,6 +792,10 @@ action_utf8_print(struct terminal *term, wchar_t wc)
|
||||||
composed != NULL ? composed->width : base_width;
|
composed != NULL ? composed->width : base_width;
|
||||||
|
|
||||||
switch (term->conf->tweak.grapheme_width_method) {
|
switch (term->conf->tweak.grapheme_width_method) {
|
||||||
|
case GRAPHEME_WIDTH_MAX:
|
||||||
|
new_cc->width = max(grapheme_width, width);
|
||||||
|
break;
|
||||||
|
|
||||||
case GRAPHEME_WIDTH_DOUBLE:
|
case GRAPHEME_WIDTH_DOUBLE:
|
||||||
if (unlikely(wc == 0xfe0f))
|
if (unlikely(wc == 0xfe0f))
|
||||||
width = 2;
|
width = 2;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue