config: add grapheme-width-method=default

This is the new default mode, and tries to do "the right thing". That
is, recognize and handle:

* Variation Selector 16 (graphical presentation)
* ZWJ sequences
* Skin tones and hair-styles
* Country flags

Things known to be incorrect:

* "Invalid" country letter combinations are still treated as
  flags. That is, the combined width is 2, even though it should be 4.
This commit is contained in:
Daniel Eklöf 2022-12-14 14:35:00 +01:00
parent 3b9aca6a3d
commit ab39ed99df
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 80 additions and 11 deletions

View file

@ -2371,7 +2371,7 @@ parse_section_tweak(struct context *ctx)
return value_to_enum(
ctx,
(const char *[]){"wcswidth", "double-width", "max", NULL},
(const char *[]){"default", "wcswidth", "double-width", "max", NULL},
(int *)&conf->tweak.grapheme_width_method);
}
@ -2977,7 +2977,7 @@ config_load(struct config *conf, const char *conf_path,
#if defined(FOOT_GRAPHEME_CLUSTERING) && FOOT_GRAPHEME_CLUSTERING
.grapheme_shaping = fcft_caps & FCFT_CAPABILITY_GRAPHEME_SHAPING,
#endif
.grapheme_width_method = GRAPHEME_WIDTH_WCSWIDTH,
.grapheme_width_method = GRAPHEME_WIDTH_DEFAULT,
.delayed_render_lower_ns = 500000, /* 0.5ms */
.delayed_render_upper_ns = 16666666 / 2, /* half a frame period (60Hz) */
.max_shm_pool_size = 512 * 1024 * 1024,