Re: Can not change face weight on Windows

Francis Wright <[email protected]> Wed, 11 Sep 2024 16:24:33 +0000
Newsgroups gmane.emacs.windows
Message-ID <AS4PR08MB7950E7386A86AF59D5AFCC14E59B2@AS4PR08MB7950.eurprd08.prod.outlook.com>
--_000_AS4PR08MB7950E7386A86AF59D5AFCC14E59B2AS4PR08MB7950eurp_
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

On Windows 11, I installed the latest version of Cascadia Code (2404.23). T=
hen, in Emacs 29.2, I clicked on Set Default Font... in the Options menu. I=
n the resulting dialogue, I selected Cascadia Code and was offered a lot of=
 font styles including ExtraLight and Light. Light is clearly lighter than =
Regular and ExtraLight is clearly lighter than Light. I selected Light and =
size 11. Closing the dialogue and clicking on Save Options in the Options m=
enu wrote the following to my .emacs file:

(custom-set-faces
 '(default ((t (:family "Cascadia Code Light" :foundry "outline" :slant nor=
mal :weight light :height 108 :width normal)))))

Based on that, I tried

(set-face-attribute 'default nil :family "Cascadia Code Light" :height 108)

which seems to work correctly.

(set-face-attribute 'default nil :family "Cascadia Code Light" :weight 'lig=
ht :height 108)

also works, but specifying the weight explicitly seems to be redundant. I p=
resume this recipe will also work for the fixed-pitch font, but I haven't t=
ried it.

Best of luck!
Francis

________________________________
From: [email protected] <help-emac=
[email protected]> on behalf of Chang Xiaod=
uan <[email protected]>
Sent: 11 September 2024 9:00 AM
To: [email protected] <[email protected]>
Subject: Can not change face weight on Windows


Hello,

I am trying to use Cascadia Code<https://github.com/microsoft/cascadia-code=
.git> for the default and fixed-pitch faces
in Emacs. However, I feel the regular weight too dense for me, so I
want to use the light version.

I have the following code in my init.el file:

(set-face-attribute 'default nil
              :font "Cascadia Code"
              :weight 'light
              :height 160)
(set-face-attribute 'fixed-pitch nil
              :font "Cascadia Code"
              :weight 'light
              :height 1.0)


However, evaluating these expressions does not make any
change. Executing describe-face on default and fixed-pitch shows that
the weight is still regular.

I have doubted that this issue is exclusive on Windows, so I installed
the same font files and evaluated the same code on a Linux virtual
machine. This time, Emacs correctly sets the weight to light.

So, is this a bug on Emacs? Is this a problem of Windows? Any chance
this behavior can be fixed?

Thanks for any help.

Regards,

=96
Chang Xiaoduan

--_000_AS4PR08MB7950E7386A86AF59D5AFCC14E59B2AS4PR08MB7950eurp_
Content-Type: text/html; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DWindows-1=
252">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
On Windows 11, I installed the latest version of Cascadia Code (2404.23). T=
hen, in Emacs 29.2, I clicked on Set Default Font... in the Options menu. I=
n the resulting dialogue, I selected Cascadia Code and was offered a lot of=
 font styles including ExtraLight
 and Light. Light is clearly lighter than Regular and ExtraLight is clearly=
 lighter than Light. I selected Light and size 11.&nbsp;Closing the dialogu=
e and clicking on Save Options in&nbsp;the Options menu wrote the following=
 to my .emacs file:</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
(custom-set-faces</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
&nbsp;'(default ((t (:family &quot;Cascadia Code Light&quot; :foundry &quot=
;outline&quot; :slant normal :weight light :height 108 :width normal)))))</=
div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Based on that, I tried</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
(set-face-attribute 'default nil :family &quot;Cascadia Code Light&quot; :h=
eight 108)<br>
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
which seems to work correctly.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
(set-face-attribute 'default nil :family &quot;Cascadia Code Light&quot; :w=
eight 'light :height 108)<br>
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
also works, but specifying the weight explicitly seems to be redundant. I p=
resume this recipe will also work for the fixed-pitch font, but I haven't t=
ried it.</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
Best of luck!<br>
Francis</div>
<div id=3D"appendonsend"></div>
<div style=3D"font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;=
 color: rgb(0, 0, 0);">
<br>
</div>
<hr style=3D"display: inline-block; width: 98%;">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><span style=3D"font-family: Calibri, =
sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b>&nbsp;help-e=
[email protected] &lt;help-emacs-windows=
[email protected]&gt; on behalf
 of Chang Xiaoduan &lt;[email protected]&gt;<br>
<b>Sent:</b>&nbsp;11 September 2024 9:00 AM<br>
<b>To:</b>&nbsp;[email protected] &lt;[email protected]&g=
t;<br>
<b>Subject:</b>&nbsp;Can not change face weight on Windows</span>
<div>&nbsp;</div>
</div>
<div id=3D"x_content" style=3D"font-family:&quot;Arial&quot;;font-size:10pt=
;line-height:11pt">
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
Hello,</p>
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
I am trying to use <span style=3D"color: rgb(0, 113, 197);"><a href=3D"http=
s://github.com/microsoft/cascadia-code.git" id=3D"OWA2f43d4ee-47d2-89d0-4ea=
f-33d1f3ed7ec4" class=3D"OWAAutoLink" data-auth=3D"NotApplicable" style=3D"=
color: rgb(0, 113, 197); margin-top: 0px; margin-bottom: 0px;">Cascadia
 Code</a></span>&nbsp;for the <span style=3D"font-family: monospace; backgr=
ound-color: rgb(249, 249, 249);">
<code>default</code></span>&nbsp;and <span style=3D"font-family: monospace;=
 background-color: rgb(249, 249, 249);">
<code>fixed-pitch</code></span>&nbsp;faces<br>
in Emacs. However, I feel the regular weight too dense for me, so I<br>
want to use the light version.</p>
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
I have the following code in my <span style=3D"font-family: monospace; back=
ground-color: rgb(249, 249, 249);">
<code>init.el</code></span>&nbsp;file:</p>
<div style=3D"margin-top: 10px;">
<pre style=3D"margin: 0px;"><div style=3D"line-height: 12pt; font-size: 9pt=
;">(set-face-attribute 'default nil=0A=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=3D"color: rgb(=
115, 28, 82);">:font</span> <span style=3D"color: rgb(47, 63, 131);">&quot;=
Cascadia Code&quot;</span>=0A=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=3D"color: rgb(=
115, 28, 82);">:weight</span> 'light=0A=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=3D"color: rgb(=
115, 28, 82);">:height</span> 160)=0A=
(set-face-attribute 'fixed-pitch nil=0A=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=3D"color: rgb(=
115, 28, 82);">:font</span> <span style=3D"color: rgb(47, 63, 131);">&quot;=
Cascadia Code&quot;</span>=0A=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=3D"color: rgb(=
115, 28, 82);">:weight</span> 'light=0A=
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style=3D"color: rgb(=
115, 28, 82);">:height</span> 1.0)=0A=
</div></pre>
</div>
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
However, evaluating these expressions does not make any<br>
change. Executing <span style=3D"font-family: monospace; background-color: =
rgb(249, 249, 249);">
<code>describe-face</code></span>&nbsp;on <span style=3D"font-family: monos=
pace; background-color: rgb(249, 249, 249);">
<code>default</code></span>&nbsp;and <span style=3D"font-family: monospace;=
 background-color: rgb(249, 249, 249);">
<code>fixed-pitch</code></span>&nbsp;shows that<br>
the weight is still regular.</p>
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
I have doubted that this issue is exclusive on Windows, so I installed<br>
the same font files and evaluated the same code on a Linux virtual<br>
machine. This time, Emacs correctly sets the weight to light.</p>
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
So, is this a bug on Emacs? Is this a problem of Windows? Any chance<br>
this behavior can be fixed?</p>
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
Thanks for any help.</p>
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
Regards,</p>
<div id=3D"x_orge0ccb5b" style=3D"font-family:&quot;Arial&quot;;font-size:1=
0pt;margin-bottom:20px;font-family:&quot;Arial&quot;;font-size:10pt;line-he=
ight:11pt">
<p style=3D"line-height: 11pt; margin-top: 10px; margin-bottom: 0px; font-f=
amily: Arial; font-size: 10pt;">
=96<br>
<b>Chang Xiaoduan</b></p>
</div>
</div>
</body>
</html>

--_000_AS4PR08MB7950E7386A86AF59D5AFCC14E59B2AS4PR08MB7950eurp_--