GNU bug report logs - #64780
30.0.50; set-face-attribute can not set the medium weight of IBM Plex Mono on Windows 10

Previous Next

Package: emacs;

Reported by: Eason Huang <aqua0210 <at> foxmail.com>

Date: Sat, 22 Jul 2023 01:26:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eason Huang <aqua0210 <at> foxmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64780 <at> debbugs.gnu.org
Subject: bug#64780: 30.0.50; set-face-attribute can not set the medium weight of IBM Plex Mono on Windows 10
Date: Sat, 22 Jul 2023 15:21:46 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Eason Huang <aqua0210 <at> foxmail.com>
>> Date: Sat, 22 Jul 2023 09:23:28 +0800
>>
>> I tried to use the medium weight of IBM Plex Mono font on Windows 10,
>> and find that `set-face-attribute` can not make it works as expectd.
>>
>> Steps to reproduce:
>>
>> 1. Download IBM Plex Mono font by this link:
>> https://github.com/IBM/plex/releases/download/v6.3.0/TrueType.zip
>> 2. Unzip the TrueType.zip and install the IBM Plex Mono
>> 3. Start Emacs with `emacs -Q`
>> 4. In the `*scratch*` buffer, eval the code below:
>> ```
>> (set-face-attribute 'default nil :font (format
>> "%s:pixelsize=%d:weight=medium" "IBM Plex Mono" 20))
>>
>> ```
>> 5. `M-x describe-char`, will get info about font as below:
>>  harfbuzz:-outline-IBM Plex Mono-regular-normal-normal-mono-20-*-*-*-c-*-iso8859-1 (#x03)
>>
>> And you can see the regular weight is used instead.
>
> Emacs on MS-Windows doesn't fully support any weights except these 4
> standard ones: regular, italic, bold, bold-italic.  AFAIU, it is a
> limitation of the APIs we use on Windows to enumerate font families.

Thanks for your explanation.

>> The workaround recently I used:
>>
>> ```
>> (set-face-attribute 'default nil :font (format
>> "%s:pixelsize=%d:weight=medium" "IBM Plex Mono Medm" 20))
>> ```
>> `M-x describe-char`, will get info about font as below:
>> harfbuzz:-outline-IBM Plex Mono Medm-medium-normal-normal-mono-20-*-*-*-c-*-iso8859-1 (#x18)
>>
>> But use the `IBM Plex Mono Medm` name is not convenient for me, because
>> I also want to switch to other weights sometimes, such as:
>>
>> ```
>> (set-face-attribute 'default nil :font (format "%s:pixelsize=%d:weight=regular" "IBM Plex Mono" 20))
>> (set-face-attribute 'default nil :font (format "%s:pixelsize=%d:weight=bold" "IBM Plex Mono" 20))
>> ```
>> It would be more consistent If we can use the `IBM Plex Mono` font name
>> with all font weights.
>
> Yes, those are all aspects of the above limitation.  You could
> configure the other faces (bold, italic, and bold-italic) explicitly
> to use the specific members of this font's family, like you did with
> the default face and the medium weight, but the basic problem I
> explained above will from time to time rear its ugly head and produce
> some unexpected results, when Emacs mutates a font to produce another
> weight of the same family.

Thanks for mention the potential risk.
So I will just use the regular weight on Windows if encounter issue.

-- 
Eason Huang





This bug report was last modified 1 year and 305 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.