mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
Merge branch 'pua-double-width'
This commit is contained in:
commit
f74c5fa9f0
5 changed files with 35 additions and 8 deletions
|
|
@ -57,6 +57,9 @@
|
|||
(https://codeberg.org/dnkl/foot/issues/555).
|
||||
* `ENVIRONMENT` section in **foot**(1) and **footclient**(1) man pages
|
||||
(https://codeberg.org/dnkl/foot/issues/556).
|
||||
* `tweak.pua-double-width` option to `foot.ini`, letting you force
|
||||
_Private Usage Area_ codepoints to be treated as double-width
|
||||
characters.
|
||||
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
7
config.c
7
config.c
|
|
@ -2005,6 +2005,12 @@ parse_section_tweak(
|
|||
LOG_WARN("tweak: disabled overflowing double-width glyphs");
|
||||
}
|
||||
|
||||
else if (strcmp(key, "pua-double-width") == 0) {
|
||||
conf->tweak.pua_double_width = str_to_bool(value);
|
||||
if (conf->tweak.pua_double_width)
|
||||
LOG_WARN("tweak: PUA double width glyphs enabled");
|
||||
}
|
||||
|
||||
else if (strcmp(key, "damage-whole-window") == 0) {
|
||||
conf->tweak.damage_whole_window = str_to_bool(value);
|
||||
if (conf->tweak.damage_whole_window)
|
||||
|
|
@ -2573,6 +2579,7 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.damage_whole_window = false,
|
||||
.box_drawing_base_thickness = 0.04,
|
||||
.box_drawing_solid_shades = true,
|
||||
.pua_double_width = false,
|
||||
},
|
||||
|
||||
.notifications = tll_init(),
|
||||
|
|
|
|||
1
config.h
1
config.h
|
|
@ -237,6 +237,7 @@ struct config {
|
|||
off_t max_shm_pool_size;
|
||||
float box_drawing_base_thickness;
|
||||
bool box_drawing_solid_shades;
|
||||
bool pua_double_width;
|
||||
} tweak;
|
||||
|
||||
user_notifications_t notifications;
|
||||
|
|
|
|||
|
|
@ -826,7 +826,7 @@ any of these options.
|
|||
Default: _lanczos3_.
|
||||
|
||||
*allow-overflowing-double-width-glyphs*
|
||||
Boolean. when enabled, double width glyphs with a character width
|
||||
Boolean. When enabled, double width glyphs with a character width
|
||||
of 1 are allowed to overflow into the neighbouring cell.
|
||||
|
||||
One use case for this is fonts "icon" characters in the Unicode
|
||||
|
|
@ -839,8 +839,20 @@ any of these options.
|
|||
Note: this feature uses _heuristics_ to determine *which* glyphs
|
||||
should be allowed to overflow.
|
||||
|
||||
See also: *pua-double-width*
|
||||
|
||||
Default: _yes_.
|
||||
|
||||
*pua-double-width*
|
||||
Boolean. When enabled, Unicode code points from the private usage
|
||||
area (PUA) are always considered to be double width, regardless of
|
||||
the actual glyph width.
|
||||
|
||||
Ignored if *allow-overflowing-double-width-glyphs* has been
|
||||
disabled.
|
||||
|
||||
Default: _no_.
|
||||
|
||||
*render-timer*
|
||||
Enables a frame rendering timer, that prints the time it takes to
|
||||
render each frame, in microseconds, either on-screen, to stderr,
|
||||
|
|
|
|||
18
render.c
18
render.c
|
|
@ -499,9 +499,9 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
const struct fcft_glyph *glyph = NULL;
|
||||
const struct composed *composed = NULL;
|
||||
|
||||
if (cell->wc != 0) {
|
||||
wchar_t base = cell->wc;
|
||||
wchar_t base = cell->wc;
|
||||
|
||||
if (base != 0) {
|
||||
if (base >= CELL_COMB_CHARS_LO &&
|
||||
base < (CELL_COMB_CHARS_LO + term->composed_count))
|
||||
{
|
||||
|
|
@ -576,11 +576,15 @@ render_cell(struct terminal *term, pixman_image_t *pix,
|
|||
* - *this* cells is followed by an empty cell, or a space
|
||||
*/
|
||||
if (term->conf->tweak.allow_overflowing_double_width_glyphs &&
|
||||
glyph != NULL &&
|
||||
glyph->cols == 1 &&
|
||||
glyph->width >= term->cell_width * 15 / 10 &&
|
||||
glyph->width < 3 * term->cell_width &&
|
||||
col < term->cols - 1 &&
|
||||
((glyph != NULL &&
|
||||
glyph->cols == 1 &&
|
||||
glyph->width >= term->cell_width * 15 / 10 &&
|
||||
glyph->width < 3 * term->cell_width &&
|
||||
col < term->cols - 1) ||
|
||||
(term->conf->tweak.pua_double_width &&
|
||||
((base >= 0x00e000 && base <= 0x00f8ff) ||
|
||||
(base >= 0x0f0000 && base <= 0x0ffffd) ||
|
||||
(base >= 0x100000 && base <= 0x10fffd)))) &&
|
||||
(row->cells[col + 1].wc == 0 || row->cells[col + 1].wc == L' '))
|
||||
{
|
||||
cell_cols = 2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue