diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2021-10-21 04:30:02 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2021-10-21 04:30:02 +0200 |
commit | 65fd3ca84f75aee0dfebb87fa793dae57c1caf35 (patch) | |
tree | 929b299592e19b39fafc0bbbcccdc6175133f8ef /src/font.c | |
parent | 4e9764e6a155aa403d69d38fa06f4a774140f63c (diff) | |
download | emacs-65fd3ca84f75aee0dfebb87fa793dae57c1caf35.tar.gz |
Support the "medium" font weight
* lisp/faces.el (set-face-attribute): Mention new font weights in
doc string.
* src/font.c (struct table_entry): Allow more synonyms.
(weight_table): Expand to support separating medium and normal
weights. Also add heavy/ultra-heavy and some other variants.
(font_parse_fcname): Support more names.
* src/gtkutil.c (xg_weight_to_symbol): Support all the Pango weights.
(xg_style_to_symbol): Make into functions.
(xg_get_font): Adjust.
* src/w32font.c (w32_to_fc_weight): Use symbols.
* src/xfaces.c (syms_of_xfaces): Add the new symbols.
Diffstat (limited to 'src/font.c')
-rw-r--r-- | src/font.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/font.c b/src/font.c index 6cd4a6b5c11..5e761abc5e6 100644 --- a/src/font.c +++ b/src/font.c @@ -57,24 +57,26 @@ struct table_entry int numeric; /* The first one is a valid name as a face attribute. The second one (if any) is a typical name in XLFD field. */ - const char *names[5]; + const char *names[6]; }; /* Table of weight numeric values and their names. This table must be - sorted by numeric values in ascending order. */ + sorted by numeric values in ascending order and the numeric values + must approximately match the weights in the font files. */ static const struct table_entry weight_table[] = { { 0, { "thin" }}, - { 20, { "ultra-light", "ultralight" }}, - { 40, { "extra-light", "extralight" }}, + { 40, { "ultra-light", "ultralight", "extra-light", "extralight" }}, { 50, { "light" }}, - { 75, { "semi-light", "semilight", "demilight", "book" }}, - { 100, { "normal", "medium", "regular", "unspecified" }}, - { 180, { "semi-bold", "semibold", "demibold", "demi" }}, + { 55, { "semi-light", "semilight", "demilight" }}, + { 80, { "regular", "normal", "unspecified", "book" }}, + { 100, { "medium" }}, + { 180, { "semi-bold", "semibold", "demibold", "demi-bold", "demi" }}, { 200, { "bold" }}, - { 205, { "extra-bold", "extrabold" }}, - { 210, { "ultra-bold", "ultrabold", "black" }} + { 205, { "extra-bold", "extrabold", "ultra-bold", "ultrabold" }}, + { 210, { "black", "heavy" }}, + { 250, { "ultra-heavy", "ultraheavy" }} }; /* Table of slant numeric values and their names. This table must be @@ -1484,11 +1486,20 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font) #define PROP_MATCH(STR) (word_len == strlen (STR) \ && memcmp (p, STR, strlen (STR)) == 0) - if (PROP_MATCH ("light") + if (PROP_MATCH ("thin") + || PROP_MATCH ("ultra-light") + || PROP_MATCH ("light") + || PROP_MATCH ("semi-light") + || PROP_MATCH ("book") || PROP_MATCH ("medium") + || PROP_MATCH ("normal") + || PROP_MATCH ("semibold") || PROP_MATCH ("demibold") || PROP_MATCH ("bold") - || PROP_MATCH ("black")) + || PROP_MATCH ("ultra-bold") + || PROP_MATCH ("black") + || PROP_MATCH ("heavy") + || PROP_MATCH ("ultra-heavy")) FONT_SET_STYLE (font, FONT_WEIGHT_INDEX, val); else if (PROP_MATCH ("roman") || PROP_MATCH ("italic") |