[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64780: 30.0.50; set-face-attribute can not set the medium weight of
From: |
Eli Zaretskii |
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 08:48:22 +0300 |
> From: Eason Huang <aqua0210@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.
> 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.