all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Eason Huang <aqua0210@foxmail.com>
Cc: 64780@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 08:48:22 +0300	[thread overview]
Message-ID: <83cz0ka449.fsf@gnu.org> (raw)
In-Reply-To: <tencent_3D6D2F2B255648321B33E0D96B419B5D7208@qq.com> (message from Eason Huang on Sat, 22 Jul 2023 09:23:28 +0800)

> 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.





  reply	other threads:[~2023-07-22  5:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22  1:23 bug#64780: 30.0.50; set-face-attribute can not set the medium weight of IBM Plex Mono on Windows 10 Eason Huang
2023-07-22  5:48 ` Eli Zaretskii [this message]
2023-07-22  7:21   ` Eason Huang
2023-07-22  8:53     ` Eli Zaretskii
2023-07-22  7:21   ` Eason Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83cz0ka449.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=64780@debbugs.gnu.org \
    --cc=aqua0210@foxmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.