aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2021-11-10 20:17:33 +0200
committerEli Zaretskii2021-11-10 20:17:33 +0200
commit32086ea233b5f68c4fc2d90a05ef9a20d09b8f71 (patch)
tree9d207873a02451314131939500e462b497ffd992 /src
parenta491b73c765adde894acdbafc6fd97edd4343c2c (diff)
downloademacs-32086ea233b5f68c4fc2d90a05ef9a20d09b8f71.tar.gz
emacs-32086ea233b5f68c4fc2d90a05ef9a20d09b8f71.zip
Fix font weights on MS-Windows
* src/w32font.c (w32_decode_weight, w32_encode_weight) (w32_to_fc_weight): Adjust weight translations to match those in font.c and gtkutil.c:xg_weight_to_symbol. (Bug#51704)
Diffstat (limited to 'src')
-rw-r--r--src/w32font.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/src/w32font.c b/src/w32font.c
index 4ceb4302cee..752acdc9048 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1974,10 +1974,11 @@ w32_decode_weight (int fnweight)
1974 if (fnweight >= FW_EXTRABOLD) return 205; 1974 if (fnweight >= FW_EXTRABOLD) return 205;
1975 if (fnweight >= FW_BOLD) return 200; 1975 if (fnweight >= FW_BOLD) return 200;
1976 if (fnweight >= FW_SEMIBOLD) return 180; 1976 if (fnweight >= FW_SEMIBOLD) return 180;
1977 if (fnweight >= FW_NORMAL) return 100; 1977 if (fnweight >= FW_MEDIUM) return 100;
1978 if (fnweight >= FW_LIGHT) return 50; 1978 if (fnweight >= FW_NORMAL) return 80;
1979 if (fnweight >= FW_EXTRALIGHT) return 40; 1979 if (fnweight >= FW_LIGHT) return 50;
1980 if (fnweight > FW_THIN) return 20; 1980 if (fnweight >= FW_EXTRALIGHT) return 40;
1981 if (fnweight >= FW_THIN) return 20;
1981 return 0; 1982 return 0;
1982} 1983}
1983 1984
@@ -1988,10 +1989,11 @@ w32_encode_weight (int n)
1988 if (n >= 205) return FW_EXTRABOLD; 1989 if (n >= 205) return FW_EXTRABOLD;
1989 if (n >= 200) return FW_BOLD; 1990 if (n >= 200) return FW_BOLD;
1990 if (n >= 180) return FW_SEMIBOLD; 1991 if (n >= 180) return FW_SEMIBOLD;
1991 if (n >= 100) return FW_NORMAL; 1992 if (n >= 100) return FW_MEDIUM;
1992 if (n >= 50) return FW_LIGHT; 1993 if (n >= 80) return FW_NORMAL;
1993 if (n >= 40) return FW_EXTRALIGHT; 1994 if (n >= 50) return FW_LIGHT;
1994 if (n >= 20) return FW_THIN; 1995 if (n >= 40) return FW_EXTRALIGHT;
1996 if (n >= 20) return FW_THIN;
1995 return 0; 1997 return 0;
1996} 1998}
1997 1999
@@ -2000,14 +2002,15 @@ w32_encode_weight (int n)
2000static Lisp_Object 2002static Lisp_Object
2001w32_to_fc_weight (int n) 2003w32_to_fc_weight (int n)
2002{ 2004{
2003 if (n >= FW_HEAVY) return Qblack; 2005 if (n >= FW_HEAVY) return Qblack;
2004 if (n >= FW_EXTRABOLD) return Qextra_bold; 2006 if (n >= FW_EXTRABOLD) return Qextra_bold;
2005 if (n >= FW_BOLD) return Qbold; 2007 if (n >= FW_BOLD) return Qbold;
2006 if (n >= FW_SEMIBOLD) return intern ("demibold"); 2008 if (n >= FW_SEMIBOLD) return Qsemi_bold;
2007 if (n >= FW_NORMAL) return Qmedium; 2009 if (n >= FW_MEDIUM) return Qmedium;
2008 if (n >= FW_LIGHT) return Qlight; 2010 if (n >= FW_NORMAL) return Qnormal;
2011 if (n >= FW_LIGHT) return Qlight;
2009 if (n >= FW_EXTRALIGHT) return Qextra_light; 2012 if (n >= FW_EXTRALIGHT) return Qextra_light;
2010 return intern ("thin"); 2013 return Qthin;
2011} 2014}
2012 2015
2013/* Fill in all the available details of LOGFONT from FONT_SPEC. */ 2016/* Fill in all the available details of LOGFONT from FONT_SPEC. */