From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs 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 Message-ID: <83cz0ka449.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5973"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 64780@debbugs.gnu.org To: Eason Huang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 22 07:48:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qN5Th-0001Ni-GN for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 22 Jul 2023 07:48:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qN5TO-0002nF-98; Sat, 22 Jul 2023 01:48:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN5TH-0002mz-83 for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 01:48:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qN5TG-0004SU-PJ for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 01:48:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qN5TF-0006Bk-O7 for bug-gnu-emacs@gnu.org; Sat, 22 Jul 2023 01:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 22 Jul 2023 05:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64780 X-GNU-PR-Package: emacs Original-Received: via spool by 64780-submit@debbugs.gnu.org id=B64780.169000487423735 (code B ref 64780); Sat, 22 Jul 2023 05:48:01 +0000 Original-Received: (at 64780) by debbugs.gnu.org; 22 Jul 2023 05:47:54 +0000 Original-Received: from localhost ([127.0.0.1]:35288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN5T8-0006Ah-1X for submit@debbugs.gnu.org; Sat, 22 Jul 2023 01:47:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qN5T3-00069e-UE for 64780@debbugs.gnu.org; Sat, 22 Jul 2023 01:47:52 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN5Sy-0004Kn-9i; Sat, 22 Jul 2023 01:47:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1H+0sLLTGj8+e4NvYu05KrWPpcfoYFrhEoRJy4++AO0=; b=kSft1WIDMtaG T083hOsR68t8VJ0YRTGKbSu4UYBMtt9nJVzjIpDNFvphrrXqqAtMH0ooc6Xo759hS9iM7y3vwaMe8 lX4tJpLz47nOjC4t14N/exwMGs2gTDMXMf/Qx4+vTXhTSknPJLhEbSxSZffboGkoQVMy5MG/StCL9 8ZlvcFsXf0V0FENEOcY3715uNvTViapHopqKxnngdzKGnlkZfePB2jDCG2YsfPFuP42X/+mK2C5Jq auxSaxl/6IDXdEN9aAdDPVVe8lSjCt14DL3uaPJ055EZhqYLCPTMEBvIuMDtmebr062Ch6N9F60Hc ebB+ZFg2X8SdRCRUe9RCgA==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qN5Sx-000542-Jx; Sat, 22 Jul 2023 01:47:44 -0400 In-Reply-To: (message from Eason Huang on Sat, 22 Jul 2023 09:23:28 +0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265772 Archived-At: > From: Eason Huang > 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.