From unknown Tue Jun 24 20:52:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#64013 <64013@debbugs.gnu.org> To: bug#64013 <64013@debbugs.gnu.org> Subject: Status: [PATCH] macfont.m: Fix values for font widths and weights on macOS Reply-To: bug#64013 <64013@debbugs.gnu.org> Date: Wed, 25 Jun 2025 03:52:07 +0000 retitle 64013 [PATCH] macfont.m: Fix values for font widths and weights on = macOS reassign 64013 emacs submitter 64013 Stanislav Yaglo severity 64013 normal tag 64013 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 12 08:33:19 2023 Received: (at submit) by debbugs.gnu.org; 12 Jun 2023 12:33:19 +0000 Received: from localhost ([127.0.0.1]:39147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8gjU-0001YM-Me for submit@debbugs.gnu.org; Mon, 12 Jun 2023 08:33:18 -0400 Received: from lists.gnu.org ([209.51.188.17]:56694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8fwx-0008NI-JH for submit@debbugs.gnu.org; Mon, 12 Jun 2023 07:43:10 -0400 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 1q8fww-0004kl-7b for bug-gnu-emacs@gnu.org; Mon, 12 Jun 2023 07:43:06 -0400 Received: from st43p00im-zteg10071901.me.com ([17.58.63.169]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q8fwu-0008Dv-9l for bug-gnu-emacs@gnu.org; Mon, 12 Jun 2023 07:43:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1686570180; bh=zcXih/VZ1ZcUcMY6KBX1a2PbaI1REBrcMhzgOUrNP5c=; h=To:From:Subject:Date:Message-id:Content-Type:MIME-Version; b=ThRI8QAsA239MBrmCEutXfGnlPhRVQ0fBiqoslbVWD5FD4x+Hc8ltE6X+b+ovKdEM vrWjf7cSaRvpn7DiaEWl0icYTuays3GcVvhuPMH/+4Jwzao/o1JWFcyF5n1VOR+R3U 8eVJS5BoneT7PAAfXguEJEw5Jdx4qtYFLcvfToeHil/tSIogz/1yflEgzErjLkwZgx mEvsUDoSBIMuieKQuwGN1Si6mlY56y5smdMY86ZEReLfHRKqBkm3eQpHd5M4PNNsZu IgHSh72UVxqkbKWIQLogSan9UMeA99CG1W0ZBkzHTH9LI1YY8ECt1GUUYsfUB+6nRp hYeeu2I6mK9xg== Received: from st43p00im-zteg10071901.me.com (st43p00im-zteg10071901.me.com [17.58.63.169]) by st43p00im-zteg10071901.me.com (Postfix) with ESMTPS id 5F656840307 for ; Mon, 12 Jun 2023 11:43:00 +0000 (UTC) Received: from localhost (st43p00im.dlb-asmtpoutvip.me.com [10.76.196.233]) by st43p00im-zteg10071901.me.com (Postfix) with ESMTPA id 98E9D8402AC for ; Mon, 12 Jun 2023 11:42:53 +0000 (UTC) To: bug-gnu-emacs@gnu.org From: Stanislav Yaglo Subject: =?utf-8?B?W1BBVENIXSBtYWNmb250Lm06IEZpeCB2YWx1ZXMgZm9yIGZvbnQgd2lkdGhz?= =?utf-8?B?IGFuZCB3ZWlnaHRzIG9uIG1hY09T?= Date: Mon, 12 Jun 2023 11:42:53 -0000 X-Mailer: iCloud MailClientcurrent MailServer2315B73.10000-Famine2315-0-dba3af02e28b Message-id: Content-Type: multipart/alternative; boundary=Apple-Webmail-42--4a0e50de-515d-4891-a6ce-84c41e510dca MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: QihSpDgBPH_tejsR3TePohwi-AEgDBm6 X-Proofpoint-GUID: QihSpDgBPH_tejsR3TePohwi-AEgDBm6 X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.138,18.0.816,17.11.62.513.0000000_definitions?= =?UTF-8?Q?=3D2022-01-17=5F04:2020-02-14=5F02,2022-01-17=5F04,2021-12-02?= =?UTF-8?Q?=5F01_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 malwarescore=0 clxscore=1011 spamscore=0 mlxscore=0 adultscore=0 phishscore=0 mlxlogscore=591 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2306120101 Received-SPF: pass client-ip=17.58.63.169; envelope-from=yaglo@me.com; helo=st43p00im-zteg10071901.me.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 12 Jun 2023 08:33:14 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --Apple-Webmail-42--4a0e50de-515d-4891-a6ce-84c41e510dca Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8; format=flowed Hi everyone,Currently, on macOS, font weights are not handled correctly, w= hich causes Emacs to choose different font weights and widths than what yo= u request. As one example, if you want to choose "Cascadia Code:weight=3Ds= emi-light", you will get Cascadia Code Light instead. Same for font widths= , what you specify is not always what you get.There's some interpolation g= oing on which I didn't remove as it's potentially handy for in-between val= ues, but the problem itself is that the corresponding values are not corre= ct for the majority of fonts, for example, kCTFontWeightTrait is specified= as -0.24 corresponding to 87.5 , but in reality, it is usually 50 (light)= , and the same for the other values. As you can see here, it won't work as= we have 50 followed by 87.5 and then (a lower) 80, and then 140:{-0.4, 50= },=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* light */{-0.24, 87.5},=C2=A0=C2=A0 /* = (semi-light + normal) / 2 */{0, 80},=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 /* normal */{0.24, 140},=C2=A0=C2=A0=C2=A0=C2=A0 /* (semi-bold += normal) / 2 */It probably is a typo, as in the second (duplicate) table o= f values in the code, 100 is treated as normal instead of 80, which also i= sn't correct, as 100 is medium, not normal:{-0.4, 50},=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 /* light */{-0.24, 87.5},=C2=A0=C2=A0 /* (semi-light + normal) /= 2 */{0, 100},=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* normal */{0.24, 140},=C2=A0=C2= =A0=C2=A0=C2=A0 /* (semi-bold + normal) / 2 */For font widths, there's onl= y two kCTFontWidthTrait=C2=A0values in the range that are handled currentl= y =E2=80=94 from 0 to 1, and they are handled as linear font values from 1= 00 to 200, which isn't correct either. For condensed fonts,=C2=A0kCTFontWi= dthTrait is negative, which is not accounted for, and the slope is linear = only from -0.4 (50, ultra-condensed) until 0.2 (125, expanded), and from t= here until ultra-expanded is much steeper.I've included all values that ar= e listed in font.c for explicitness even if some values can be calculated = with the code that interpolates the values. Also, I haven't refactored the= duplication of the structs and code as I think this is a different issue = and should be done separately to keep this patch on point of the issue bei= ng fixed, and I will probably submit a patch for this later to avoid code = duplication and potential issues in the future as with the current 80/100 = problem mentioned above.Kind regards,Stanislav Yaglo --Apple-Webmail-42--4a0e50de-515d-4891-a6ce-84c41e510dca Content-Type: multipart/mixed; type="text/html"; boundary=Apple-Webmail-64--4a0e50de-515d-4891-a6ce-84c41e510dca --Apple-Webmail-64--4a0e50de-515d-4891-a6ce-84c41e510dca Content-Type: multipart/related; type="text/html"; boundary=Apple-Webmail-86--4a0e50de-515d-4891-a6ce-84c41e510dca --Apple-Webmail-86--4a0e50de-515d-4891-a6ce-84c41e510dca Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8;
Hi everyone,

Currently, on macOS, f= ont weights are not handled correctly, which causes Emacs to choose differ= ent font weights and widths than what you request. As one example, if you = want to choose "Cascadia Code:weight=3Dsemi-light", you will get Cascadia = Code Light instead. Same for font widths, what you specify is not always w= hat you get.

There's some interpolation going= on which I didn't remove as it's potentially handy for in-between values,= but the problem itself is that the corresponding values are not correct f= or the majority of fonts, for example, kCTFontWeightTrait is specified as = -0.24 corresponding to 87.5 , but in reality, it is usually 50 (light), an= d the same for the other values. As you can see here, it won't work as we = have 50 followed by 87.5 and then (a lower) 80, and then 140:

{-0.4, 50},      /* light *= /
{-0.24, 87.5},   /* (semi-light + normal)= / 2 */
{0, 80},      &= nbsp;  /* normal */
{0.24, 140}, = ;    /* (semi-bold + normal) / 2 */
It probably is a typo, as in the second (duplicate) table of = values in the code, 100 is treated as normal instead of 80, which also isn= 't correct, as 100 is medium, not normal:

{-0.24, = 87.5},   /* (semi-light + normal) / 2 */
{0, 100},        /* normal */
{0.24, 140},     /* (semi-bold + normal) = / 2 */

For font widths, there's only t= wo kCTFontWidthTrait values in the range that are handled currently =E2= =80=94 from 0 to 1, and they are handled as linear font values from 100 to= 200, which isn't correct either. For condensed fonts, kCTFontWidthTr= ait is negative, which is not accounted for, and the slope is linear only = from -0.4 (50, ultra-condensed) until 0.2 (125, expanded), and from there = until ultra-expanded is much steeper.

I've in= cluded all values that are listed in font.c for explicitness even if some = values can be calculated with the code that interpolates the values. Also,= I haven't refactored the duplication of the structs and code as I think t= his is a different issue and should be done separately to keep this patch = on point of the issue being fixed, and I will probably submit a patch for = this later to avoid code duplication and potential issues in the future as= with the current 80/100 problem mentioned above.

=
Kind regards,
Stanislav Yaglo

<= /div> --Apple-Webmail-86--4a0e50de-515d-4891-a6ce-84c41e510dca-- --Apple-Webmail-64--4a0e50de-515d-4891-a6ce-84c41e510dca Content-Transfer-Encoding: BASE64 Content-Disposition: attachment; filename="0001-Fix-values-for-font-widths-and-weights-on-macOS.patch" Content-Type: application/octet-stream; name="0001-Fix-values-for-font-widths-and-weights-on-macOS.patch" Content-Id: <9940cec8-36d9-4921-9482-4126b7010307@icloud.com> RnJvbSBkYWEzNmI0YWMxZjM0NTAxNjg1NjQ5MzIyOTlkYjgwYzk3NDIzNmJlIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBTdGFuaXNsYXYgWWFnbG8gPHlhZ2xvQG1lLmNvbT4K RGF0ZTogTW9uLCAxMiBKdW4gMjAyMyAxMTo1NjozNyArMDEwMApTdWJqZWN0OiBbUEFUQ0hd IG1hY2ZvbnQubTogRml4IHZhbHVlcyBmb3IgZm9udCB3aWR0aHMgYW5kIHdlaWdodHMgb24g bWFjT1MKCi0tLQogc3JjL21hY2ZvbnQubSB8IDk2ICsrKysrKysrKysrKysrKysrKysrKysr KysrKysrKysrKysrKy0tLS0tLS0tLS0tLS0tLQogMSBmaWxlIGNoYW5nZWQsIDY4IGluc2Vy dGlvbnMoKyksIDI4IGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL3NyYy9tYWNmb250Lm0g Yi9zcmMvbWFjZm9udC5tCmluZGV4IDlmOWY2ZjRlZmFmLi5jYjdmOTM3ZmEwZCAxMDA2NDQK LS0tIGEvc3JjL21hY2ZvbnQubQorKysgYi9zcmMvbWFjZm9udC5tCkBAIC04NTUsMjEgKzg1 NSw0MiBAQCBzdGF0aWMgdm9pZCBtYWNfZm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gMSwgMjUwIH0sICAgICAvKiB1bHRyYS1oZWF2eSwgdWx0cmFoZWF2eSAq LworICAgICAgICAgICAgeyBDR0ZMT0FUX01BWCwgQ0dGTE9BVF9NQVggfSB9LAorICAgICAg ICAgIG1hY19mb250X2Rlc2NyaXB0b3JfZ2V0X2FkanVzdGVkX3dlaWdodCB9LAorICAgICAg ICB7IEZPTlRfU0xBTlRfSU5ERVgsCisgICAgICAgICAga0NURm9udFNsYW50VHJhaXQsCisg ICAgICAgICAgeyB7IDAsIDEwMCB9LCB7IDAuMSwgMjAwIH0sIHsgQ0dGTE9BVF9NQVgsIENH RkxPQVRfTUFYIH0gfSwKKyAgICAgICAgICBOVUxMIH0sCisgICAgICAgIHsgRk9OVF9XSURU SF9JTkRFWCwKKyAgICAgICAgICBrQ1RGb250V2lkdGhUcmFpdCwKKyAgICAgICAgICB7IHsg LTAuNCwgNTAgfSwgLyogdWx0cmEtY29uZGVuc2VkLCB1bHRyYWNvbmRlbnNlZCAqLworICAg ICAgICAgICAgeyAtMC4zLCA2MyB9LCAvKiBleHRyYS1jb25kZW5zZWQsIGV4dHJhY29uZGVu c2VkICovCisgICAgICAgICAgICB7IC0wLjIsIDc1IH0sIC8qIGNvbmRlbnNlZCwgY29tcHJl c3NlZCwgbmFycm93ICovCisgICAgICAgICAgICB7IC0wLjEsIDg3IH0sIC8qIHNlbWktY29u ZGVuc2VkLCBzZW1pY29uZGVuc2VkLCBkZW1pY29uZGVuc2VkICovCisgICAgICAgICAgICB7 IDAsIDEwMCB9LCAgIC8qIG5vcm1hbCwgbWVkaXVtLCByZWd1bGFyLCB1bnNwZWNpZmllZCAq LworICAgICAgICAgICAgeyAwLjEsIDExMyB9LCAvKiBzZW1pLWV4cGFuZGVkLCBzZW1pZXhw YW5kZWQsIGRlbWlleHBhbmRlZCAqLworICAgICAgICAgICAgeyAwLjIsIDEyNSB9LCAvKiBl eHBhbmRlZCAqLworICAgICAgICAgICAgeyAwLjMsIDE1MCB9LCAvKiBleHRyYS1leHBhbmRl ZCwgZXh0cmFleHBhbmRlZCAqLworICAgICAgICAgICAgeyAwLjQsIDIwMCB9LCAvKiB1bHRy YS1leHBhbmRlZCwgdWx0cmFleHBhbmRlZCwgd2lkZSAqLworICAgICAgICAgICAgeyBDR0ZM T0FUX01BWCwgQ0dGTE9BVF9NQVggfSB9LAorICAgICAgICAgIE5VTEwgfQorICAgICAgfTsK ICAgICAgIGludCBpOwogCiAgICAgICBmb3IgKGkgPSAwOyBpIDwgQVJSQVlFTFRTIChudW1l cmljX3RyYWl0cyk7IGkrKykKQEAgLTE5NDAsMTkgKzE5NjEsMzggQEAgc3RhdGljIGludCBt YWNmb250X3ZhcmlhdGlvbl9nbHlwaHMgKHN0cnVjdCBmb250ICosIGludCBjLAogICBzdHJ1 Y3QgewogICAgIGVudW0gZm9udF9wcm9wZXJ0eV9pbmRleCBpbmRleDsKICAgICBDRlN0cmlu Z1JlZiB0cmFpdDsKLSAgICBDR1BvaW50IHBvaW50c1s2XTsKLSAgfSBudW1lcmljX3RyYWl0 c1tdID0KLSAgICAgIHt7Rk9OVF9XRUlHSFRfSU5ERVgsIGtDVEZvbnRXZWlnaHRUcmFpdCwK LSAgICAgICAge3stMC40LCA1MH0sCQkvKiBsaWdodCAqLwotICAgICAgICAgey0wLjI0LCA4 Ny41fSwJCS8qIChzZW1pLWxpZ2h0ICsgbm9ybWFsKSAvIDIgKi8KLSAgICAgICAgIHswLCAx MDB9LAkJLyogbm9ybWFsICovCi0gICAgICAgICB7MC4yNCwgMTQwfSwJCS8qIChzZW1pLWJv bGQgKyBub3JtYWwpIC8gMiAqLwotICAgICAgICAgezAuNCwgMjAwfSwJCS8qIGJvbGQgKi8K LSAgICAgICAgIHtDR0ZMT0FUX01BWCwgQ0dGTE9BVF9NQVh9fX0sCi0gICAgICAge0ZPTlRf U0xBTlRfSU5ERVgsIGtDVEZvbnRTbGFudFRyYWl0LAotICAgICAgICB7ezAsIDEwMH0sIHsw LjEsIDIwMH0sIHtDR0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BVF9NQVgsIENHRkxPQVRfTUFYIH0gfSB9Cisg IH07CiAKICAgcmVnaXN0cnkgPSBBUkVGIChzcGVjLCBGT05UX1JFR0lTVFJZX0lOREVYKTsK ICAgaWYgKE5JTFAgKHJlZ2lzdHJ5KQotLSAKMi4zOS4yIChBcHBsZSBHaXQtMTQzKQoK --Apple-Webmail-64--4a0e50de-515d-4891-a6ce-84c41e510dca-- --Apple-Webmail-42--4a0e50de-515d-4891-a6ce-84c41e510dca-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 12 09:31:28 2023 Received: (at 64013) by debbugs.gnu.org; 12 Jun 2023 13:31:28 +0000 Received: from localhost ([127.0.0.1]:39208 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8hdn-0003BJ-ST for submit@debbugs.gnu.org; Mon, 12 Jun 2023 09:31:28 -0400 Received: from sonic310-23.consmr.mail.ne1.yahoo.com ([66.163.186.204]:40031) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8hdl-0003B4-B3 for 64013@debbugs.gnu.org; Mon, 12 Jun 2023 09:31:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1686576679; bh=OLrpIm+1fHra9M34D79Cvo9YLCx+PRwxK53nGoUP/24=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=r9d3/Ut4If/gWPeN9t4Xmn29askIe+pTMTdgbdMWsDqLg/kweSGqmlQzBzp6EiYOm7oymsqTn1A3PrsIgacwIkTgCKS5lLvLV5ARhevpjen+TgA+058sC2+W5WyLFUjn98qUPqYkWzravTlgx1/u0nVin97Ot8qBVd1sjKwnmZaZiibS4bhQj2qLLMghbJ0xoX3VE5voR5YMJOKsNCqZeHTRajth2ljOBS+DDNGgLlEk4GOooeFBjAEyi06PSCFz0+954Yd9EvPmyiiT2Y6hkBrH4XAw74dg/JdrwWFfPTQa8/2g/68vx/lKZBTFpjP3+QNx+3S3otkhH2dd23daTQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1686576679; bh=GS6b77GiX0zRw8njEKDI1y7npzMH3DmDHoBCIg9264A=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=NWnCqbsKroKVv2xQIfYhP2FKdz5gTSg8/ptxCTR4twj34HK4alqw72UR56aRYINRIuL54XSA+TDb6HAgLpMAzAeZ8HwSQ1KRfmnmcaVe9oRaVMcqhr9U5SS7/8kUYKf/qvX6BO1/3f3EO7vvqOU+a61JkkC9HNB27ouENoi3fp7Is27ObK4/fr/OJ/oStBftT/d7xEr5MOgDBFY799fGjFEKIzNxk69gm9gu6ZLVq5vNeJKUEDO6FfRT0okcEBaDIwVXdMnvuCpr3EomCMJ8Ko+RjPy2aGQSiuTJFsQ+8QsL2kT7duFPpO4Kb3O5gRQbnNg7K5mmFWux3phJA7cjXw== X-YMail-OSG: 0lkGsp8VM1k3vaq8vKfKyit_2sUEFmxTTimkFCVckaD0Z06U_Ml2nU7Tz2LnWNO 69Z7nUmOEFnqX64kYq944WUG7UlD5ciiZWh.xxfUMGmoDQcHYZh4SFiRaEeRvnqfNKcfck6TnqhQ 3JSznNnUBDa6bPpulmkS8WqvmgbRaXwIcDkGlVE2zlTneUtdn40OyUbMc7Avv_13f0vzrIi9c1O6 h.a.ssYJzrI8SX4I0oIxQ36b0kUWYNpD3yHYEQ_Xu8P2CdZBHwXDJF8hKP6h7AejPe7ad4sJp376 9W3DBextoalnAfLQ9i743l2A1fFiongnj5HNR2VKAdwAncmolTtvs8326whZQ7wqFMwHX8UsNQDi se6A0O8PXWT4CIzTsO3LHCFNKBUXDZnRTeHk68hruDprr7zFCubJaSNgL1hHTZunGXZthlwDH8op xvcdq8wGxm9CUeDsE.BHe5NDATkNkBwR9hWcuemcJ0yW7vTN3ab4N0NMXUZMZATw.KMEaJEmXo9S Dpszi6axqrjMSDrUlnYnYj9p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qVYSeArJJy3h6YiSwsl9E72W_1O0y7QIVZ3WM837am654oUi VxRRFRQUmwLc0Hpfnk3auuvMBg5mil2tWLEvXPut1EwTMl62CxAkh6KawOi69QD07RH8.l7yiPwZ apu1TR6VDwnmUZpkEnRGvKkhTHRBdhxRDFeUmqoXGLWBdUfSV054Gmre4YSKBlzcIjQgAAoLsZk5 mFN_y7Q4zNQgZ02ZgNpXiTEcM9eoizigwz0JIzUfF2ZMkhQOAYICKruDNmOwizzLlF1bTZzEJ5B0 bDJDxYGBUh1RiZTTJAabgGAdc_POlghcHrlg60yu3P914d1UQeFEcp9k4LDYC3vDVXZCkhWxNNr5 seiYCe7n8VKUKY_5dd2wfpnSht3RRzzncz_qjbuTGLlX7MQaqZvkKbTAPpLHC4v4PwAzeP7_PNCZ elpqxgLPLCGp3XZxXvfPPP3RuYNtTJSrSB1IqxJYzzU2XGfIwgDEbkXnNO3ERdS9Hqp0.KKREWLR WcNjfmuQioK_YbvI3hJP_mo_zZc8QBvhxtd.TmwvQcXjmYRGzMBtbLgrKu9W0FmdhLQBSi0eGkiZ gsxndXjpsWQgzYTV4BAqTvodvJOtTCi5dAfOH.RDrvt7sJ7ABe00KS1zIuaoCPdYQaZwAnVaiNFL ZSwF1oluc4QHt3FT3CHg1kn3_kRASWbw9kxQADSu3FLErGDi3XcMDjyMMTORO__qm X-Sonic-MF: X-Sonic-ID: f4e514da-936c-419a-bdfc-5328146c1568 Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ne1.yahoo.com with HTTP; Mon, 12 Jun 2023 13:31:19 +0000 Received: by hermes--production-sg3-748897c457-ncjl6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID b34137f3662febe749256e4d2468fb30; Mon, 12 Jun 2023 13:31:16 +0000 (UTC) From: Po Lu To: Stanislav Yaglo Subject: Re: bug#64013: [PATCH] macfont.m: Fix values for font widths and weights on macOS In-Reply-To: (Stanislav Yaglo's message of "Mon, 12 Jun 2023 11:42:53 -0000") References: Date: Mon, 12 Jun 2023 21:31:11 +0800 Message-ID: <87zg54hko0.fsf@yahoo.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.21516 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 2574 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64013 Cc: 64013@debbugs.gnu.org, YAMAMOTO Mitsuharu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stanislav Yaglo writes: > Hi everyone, > > Currently, on macOS, font weights are not handled correctly, which causes= Emacs to choose different font weights and widths than what you > request. As one example, if you want to choose "Cascadia Code:weight=3Dse= mi-light", you will get Cascadia Code Light instead. Same for font > widths, what you specify is not always what you get. > > There's some interpolation going on which I didn't remove as it's potenti= ally handy for in-between values, but the problem itself is that the > corresponding values are not correct for the majority of fonts, for examp= le, kCTFontWeightTrait is specified as -0.24 corresponding to 87.5 , but > in reality, it is usually 50 (light), and the same for the other values. = As you can see here, it won't work as we have 50 followed by 87.5 and then > (a lower) 80, and then 140: > > {-0.4, 50}, /* light */ > {-0.24, 87.5}, /* (semi-light + normal) / 2 */ > {0, 80}, /* normal */ > {0.24, 140}, /* (semi-bold + normal) / 2 */ > > It probably is a typo, as in the second (duplicate) table of values in th= e code, 100 is treated as normal instead of 80, which also isn't correct, as > 100 is medium, not normal: > > {-0.4, 50}, /* light */ > {-0.24, 87.5}, /* (semi-light + normal) / 2 */ > {0, 100}, /* normal */ > {0.24, 140}, /* (semi-bold + normal) / 2 */ > > For font widths, there's only two kCTFontWidthTrait values in the range t= hat are handled currently =E2=80=94 from 0 to 1, and they are handled as > linear font values from 100 to 200, which isn't correct either. For conde= nsed fonts, kCTFontWidthTrait is negative, which is not accounted for, > and the slope is linear only from -0.4 (50, ultra-condensed) until 0.2 (1= 25, expanded), and from there until ultra-expanded is much steeper. > > I've included all values that are listed in font.c for explicitness even = if some values can be calculated with the code that interpolates the values. > Also, I haven't refactored the duplication of the structs and code as I t= hink this is a different issue and should be done separately to keep this > patch on point of the issue being fixed, and I will probably submit a pat= ch for this later to avoid code duplication and potential issues in the > future as with the current 80/100 problem mentioned above. > > Kind regards, > Stanislav Yaglo Thanks. Have you signed copyright papers for this change? I've also copied in YAMAMOTO Mitsuharu , who might have additional comments on this code. From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 12 12:09:24 2023 Received: (at 64013) by debbugs.gnu.org; 12 Jun 2023 16:09:24 +0000 Received: from localhost ([127.0.0.1]:40407 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8k6c-0007qN-5U for submit@debbugs.gnu.org; Mon, 12 Jun 2023 12:09:24 -0400 Received: from ci74p00im-qukt09081701.me.com ([17.57.156.6]:64169) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q8iWs-0004wv-5b for 64013@debbugs.gnu.org; Mon, 12 Jun 2023 10:28:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1686580096; bh=q8asRcWq4ZbANpl8EUG1tCcw4HU0BgKkwWpStbpIWEg=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=JzbfQWOiTYNFyBkO4RokiNrKVJ8xyymyfeK3G1PPqzBbNbceBrziV48dLuXNBxJp+ VetPH03CSRlf5W2XQFGTzVKjU3Sdq++VR9I/71696S2ml5f9x2XjQLJ9bWtBpSCt3+ QNosDcPoEuHu8k4rlMlHvZagL/ERvHED909hk3NbFewdX4+/kul/cUuJ37fpxe3dhr yKUD+NeNl4XgLLyNianXQu0mOK+pHiizbOsx+NS1aHM1vArcuqxHZlvi9+f8HmTJd0 bG6YBVpMrV0CU4Ar1aVBoXPgGOjlWbTCwa8BgXJTkSkVbs6Bzx12mjl85ACEbHW4bG yFCmw8Of0TGsw== Received: from LO2P265MB0671.GBRP265.PROD.OUTLOOK.COM (ci77p00im-dlb-asmtp-mailmevip.me.com [17.57.156.26]) by ci74p00im-qukt09081701.me.com (Postfix) with ESMTPSA id 2FC4D46C01F1; Mon, 12 Jun 2023 14:28:15 +0000 (UTC) From: "yaglo@me.com" To: Po Lu Subject: Re: bug#64013: [PATCH] macfont.m: Fix values for font widths and weights on macOS Thread-Topic: bug#64013: [PATCH] macfont.m: Fix values for font widths and weights on macOS Thread-Index: AWVkNDQ0fFr1+qOSU2g4iFLGxWN8pmVkNDQ0ZmYwazTiE7gnMw== X-MS-Exchange-MessageSentRepresentingType: 1 Date: Mon, 12 Jun 2023 14:28:12 +0000 Message-ID: References: <87zg54hko0.fsf@yahoo.com> In-Reply-To: <87zg54hko0.fsf@yahoo.com> Accept-Language: en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-Exchange-Organization-SCL: -1 X-MS-TNEF-Correlator: X-MS-Exchange-Organization-RecordReviewCfmType: 0 Content-Type: multipart/alternative; boundary="_000_LO2P265MB06714CB2E2413D7A7CA31576F454ALO2P265MB0671GBRP_" MIME-Version: 1.0 X-Proofpoint-GUID: hAAhIyDbJpJUwaeLBiqw_7ePvuN24Ybm X-Proofpoint-ORIG-GUID: hAAhIyDbJpJUwaeLBiqw_7ePvuN24Ybm X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.425,18.0.572,17.11.62.513.0000000_definitions?= =?UTF-8?Q?=3D2022-01-11=5F01:2022-01-11=5F01,2020-02-14=5F11,2021-12-02?= =?UTF-8?Q?=5F01_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 clxscore=1011 malwarescore=0 mlxlogscore=999 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2306120124 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 64013 X-Mailman-Approved-At: Mon, 12 Jun 2023 12:09:20 -0400 Cc: "64013@debbugs.gnu.org" <64013@debbugs.gnu.org>, YAMAMOTO Mitsuharu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --_000_LO2P265MB06714CB2E2413D7A7CA31576F454ALO2P265MB0671GBRP_ Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable I=92m in the process of sorting the paperwork with my employer as well. I w= ill send an update to this thread when it=92s confirmed and the copyright p= apers have been signed. Kind regards, Stanislav Yaglo ________________________________ From: bug-gnu-emacs-bounces+yaglo=3Dme.com@gnu.org on behalf of Po Lu via Bug reports for GNU Emacs, th= e Swiss army knife of text editors Sent: Monday, June 12, 2023 2:31:11 PM To: Stanislav Yaglo Cc: 64013@debbugs.gnu.org <64013@debbugs.gnu.org>; YAMAMOTO Mitsuharu Subject: bug#64013: [PATCH] macfont.m: Fix values for font widths and weigh= ts on macOS Stanislav Yaglo writes: > Hi everyone, > > Currently, on macOS, font weights are not handled correctly, which causes= Emacs to choose different font weights and widths than what you > request. As one example, if you want to choose "Cascadia Code:weight=3Dse= mi-light", you will get Cascadia Code Light instead. Same for font > widths, what you specify is not always what you get. > > There's some interpolation going on which I didn't remove as it's potenti= ally handy for in-between values, but the problem itself is that the > corresponding values are not correct for the majority of fonts, for examp= le, kCTFontWeightTrait is specified as -0.24 corresponding to 87.5 , but > in reality, it is usually 50 (light), and the same for the other values. = As you can see here, it won't work as we have 50 followed by 87.5 and then > (a lower) 80, and then 140: > > {-0.4, 50}, /* light */ > {-0.24, 87.5}, /* (semi-light + normal) / 2 */ > {0, 80}, /* normal */ > {0.24, 140}, /* (semi-bold + normal) / 2 */ > > It probably is a typo, as in the second (duplicate) table of values in th= e code, 100 is treated as normal instead of 80, which also isn't correct, a= s > 100 is medium, not normal: > > {-0.4, 50}, /* light */ > {-0.24, 87.5}, /* (semi-light + normal) / 2 */ > {0, 100}, /* normal */ > {0.24, 140}, /* (semi-bold + normal) / 2 */ > > For font widths, there's only two kCTFontWidthTrait values in the range t= hat are handled currently =97 from 0 to 1, and they are handled as > linear font values from 100 to 200, which isn't correct either. For conde= nsed fonts, kCTFontWidthTrait is negative, which is not accounted for, > and the slope is linear only from -0.4 (50, ultra-condensed) until 0.2 (1= 25, expanded), and from there until ultra-expanded is much steeper. > > I've included all values that are listed in font.c for explicitness even = if some values can be calculated with the code that interpolates the values= . > Also, I haven't refactored the duplication of the structs and code as I t= hink this is a different issue and should be done separately to keep this > patch on point of the issue being fixed, and I will probably submit a pat= ch for this later to avoid code duplication and potential issues in the > future as with the current 80/100 problem mentioned above. > > Kind regards, > Stanislav Yaglo Thanks. Have you signed copyright papers for this change? I've also copied in YAMAMOTO Mitsuharu , who might have additional comments on this code. --_000_LO2P265MB06714CB2E2413D7A7CA31576F454ALO2P265MB0671GBRP_ Content-Type: text/html; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable
I=92m in the process of sorting the paperwork with my empl= oyer as well. I will send an update to this thread when it=92s confirmed an= d the copyright papers have been signed.

Kind regards,
Stanislav Yaglo

From: bug-gnu-emacs-bounces= +yaglo=3Dme.com@gnu.org <bug-gnu-emacs-bounces+yaglo=3Dme.com@gnu.org>= ; on behalf of Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org>
Sent: Monday, June 12, 2023 2:31:11 PM
To: Stanislav Yaglo <yaglo@me.com>
Cc: 64013@debbugs.gnu.org <64013@debbugs.gnu.org>; YAMAMOTO Mi= tsuharu <mituharu@math.s.chiba-u.ac.jp>
Subject: bug#64013: [PATCH] macfont.m: Fix values for font widths an= d weights on macOS
 
Stanislav Yaglo <yaglo@me.com> writes:

> Hi everyone,
>
> Currently, on macOS, font weights are not handled correctly, which cau= ses Emacs to choose different font weights and widths than what you
> request. As one example, if you want to choose "Cascadia Code:wei= ght=3Dsemi-light", you will get Cascadia Code Light instead. Same for = font
> widths, what you specify is not always what you get.
>
> There's some interpolation going on which I didn't remove as it's pote= ntially handy for in-between values, but the problem itself is that the
> corresponding values are not correct for the majority of fonts, for ex= ample, kCTFontWeightTrait is specified as -0.24 corresponding to 87.5 , but=
> in reality, it is usually 50 (light), and the same for the other value= s. As you can see here, it won't work as we have 50 followed by 87.5 and th= en
> (a lower) 80, and then 140:
>
> {-0.4, 50},      /* light */
> {-0.24, 87.5},   /* (semi-light + normal) / 2 */
> {0, 80},         /* normal */<= br> > {0.24, 140},     /* (semi-bold + normal) / 2 */ >
> It probably is a typo, as in the second (duplicate) table of values in= the code, 100 is treated as normal instead of 80, which also isn't correct= , as
> 100 is medium, not normal:
>
> {-0.4, 50},      /* light */
> {-0.24, 87.5},   /* (semi-light + normal) / 2 */
> {0, 100},        /* normal */
> {0.24, 140},     /* (semi-bold + normal) / 2 */ >
> For font widths, there's only two kCTFontWidthTrait values in the rang= e that are handled currently =97 from 0 to 1, and they are handled as
> linear font values from 100 to 200, which isn't correct either. For co= ndensed fonts, kCTFontWidthTrait is negative, which is not accounted for, > and the slope is linear only from -0.4 (50, ultra-condensed) until 0.2= (125, expanded), and from there until ultra-expanded is much steeper.
>
> I've included all values that are listed in font.c for explicitness ev= en if some values can be calculated with the code that interpolates the val= ues.
> Also, I haven't refactored the duplication of the structs and code as = I think this is a different issue and should be done separately to keep thi= s
> patch on point of the issue being fixed, and I will probably submit a = patch for this later to avoid code duplication and potential issues in the<= br> > future as with the current 80/100 problem mentioned above.
>
> Kind regards,
> Stanislav Yaglo

Thanks.  Have you signed copyright papers for this change?
I've also copied in YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>= ;,
who might have additional comments on this code.



--_000_LO2P265MB06714CB2E2413D7A7CA31576F454ALO2P265MB0671GBRP_-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 03 07:51:29 2023 Received: (at control) by debbugs.gnu.org; 3 Sep 2023 11:51:29 +0000 Received: from localhost ([127.0.0.1]:39875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcldZ-0004pP-53 for submit@debbugs.gnu.org; Sun, 03 Sep 2023 07:51:29 -0400 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:53347) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qcldW-0004p9-4I for control@debbugs.gnu.org; Sun, 03 Sep 2023 07:51:27 -0400 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-500cfb168c6so989576e87.2 for ; Sun, 03 Sep 2023 04:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693741870; x=1694346670; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=JjKhuVtEkwBiMbB+dTpb/4fgh0MYFI2x/4RWK9JnmlE=; b=kk8ZvQaHRX1G6StO2fht1nUEy4saOnQfteSa5rufkb4OIJ1s4pcwz+MqvyNEPYlRzd 4wfUKVfKoLm6UK1qKs/EjH9gG09sCF5p+zpxSdvo+veanRlvxg+qOJgNSwSAmw8mbprQ 7dwJEAW/rcPHWwHHhaKgvEUgWonhx6Y1Z3Aa5xGyE4fy0aLMcHtT1MI7XdNU2PaNEBXl LD6PK8kbWAogV9DxnrFwarOptfqt5eFNIsS6rgWzR1mZxgsojPIq77iUsaNRpOUEgIop LC5WBz2gkfqBfJ9DUuR3R5PwTI+les93tlX6TCfffJab1AmndL15vf+A+PuOzyvv/3Na tVCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693741870; x=1694346670; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JjKhuVtEkwBiMbB+dTpb/4fgh0MYFI2x/4RWK9JnmlE=; b=iPaSm/B4jGKP+RX22WkRVZJo/hIZ3h2jM6cJGAFqBosOj8qC5gL8LCkx7pQZEtV+NJ BaliT3P5hz3whsM6c8auS6sC0AMfgOneQC/C8kuYmrz0pKoLrs2ABj9z4PoPhlfEGMVL MWHDZ43Jxffmm8U7J1LyDCN7jSPf+2pVQAqJzF840ilT/S9W3IW8kIeebX8YZ5QIu/Lp fCHANjS6J8+fY8RvqGNArhhwlYFn10ur0oCL1QWslBBnlYj6TvNuMjRCQXvRQJlElIc0 /OKYcve36mxe5juGJZwZllnnDCBoJXcCfYUTx+QnEh3N6Z0UyoCgJuIS9Gv1fBLteDaq 4IEA== X-Gm-Message-State: AOJu0Ywi06RkyVwHJzJfpPZHRtD2AppY3P1jTE3tBtG5RiT59y4MmCJi 5e1TJD7qsEEFkbSaDTWDV2slqVRjDP2YwefbuF1qiT4vFSg= X-Google-Smtp-Source: AGHT+IHBd3oY/K3oknzSETrh+Ysn7gxyicnGLoH44D1XaqCAJz4RwWEJGqgcF+sLInioFE9k/TEyyJQvvog++X4sxec= X-Received: by 2002:a05:6512:3610:b0:4fd:d213:dfd0 with SMTP id f16-20020a056512361000b004fdd213dfd0mr3945917lfs.11.1693741869859; Sun, 03 Sep 2023 04:51:09 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 3 Sep 2023 04:51:09 -0700 From: Stefan Kangas MIME-Version: 1.0 Date: Sun, 3 Sep 2023 04:51:09 -0700 Message-ID: Subject: control message for bug #64013 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 64013 + pending quit From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 08 08:43:26 2023 Received: (at 64013) by debbugs.gnu.org; 8 Sep 2023 12:43:27 +0000 Received: from localhost ([127.0.0.1]:42526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeapa-0003mX-6k for submit@debbugs.gnu.org; Fri, 08 Sep 2023 08:43:26 -0400 Received: from st43p00im-ztdg10073201.me.com ([17.58.63.177]:41426) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qeXsi-0001rn-Vb for 64013@debbugs.gnu.org; Fri, 08 Sep 2023 05:34:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=1a1hai; t=1694165661; bh=Ge61LBJBzD0oyhLcGc+MQkRZoHIfFP0YCbhI6YG8w8k=; h=Content-Type:From:Mime-Version:Subject:Date:Message-Id:To; b=oWm2+NZG5fGJ3pld+tsFZyTchwLU0/c38BxWv6CCsdv7/MDe5QtMRuhSBGLdbfnBq Fq3RDcJZ7zHymgQ933MD7lopag6xf9U3dFiEqo3I6X7cwVY+eZxbqWCe6+mqrkv0E+ 9gdGK80I0CN4L2ntLijyGZky4EhrFZx84TtY3NBnCZ5ajPMLKeqKnahtQgL9Z5BRoo dtRooNd1bRxyh+/m+vVW2auJvaQ4ZOl322Vb8tlMjqy0evmN5i5P3qN/I2hzHDOiwk 66x2BjU6cyGN1wuelD/A7PruJJA3LgnsN2B54ANpCPP6pAO3r2E0w0rSqTRGhD8XWp DxOHPMGo+Xzxg== Received: from smtpclient.apple (st43p00im-dlb-asmtp-mailmevip.me.com [17.42.251.41]) by st43p00im-ztdg10073201.me.com (Postfix) with ESMTPSA id DA2C49A02CE; Fri, 8 Sep 2023 09:34:20 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Stanislav Yaglo Mime-Version: 1.0 (1.0) Subject: Re: bug#64013: [PATCH] macfont.m: Fix values for font widths and weights on macOS Date: Fri, 8 Sep 2023 10:34:08 +0100 Message-Id: <132F9964-D44D-4E49-80DD-F8939744A0A2@me.com> References: <87zg54hko0.fsf@yahoo.com> In-Reply-To: <87zg54hko0.fsf@yahoo.com> To: Po Lu X-Mailer: iPhone Mail (20D67) X-Proofpoint-GUID: aZmq43wU7EXMZt6MBo48j-9cczsK4qq0 X-Proofpoint-ORIG-GUID: aZmq43wU7EXMZt6MBo48j-9cczsK4qq0 X-Proofpoint-Virus-Version: =?UTF-8?Q?vendor=3Dfsecure_engine=3D1.1.170-22c6f66c430a71ce266a39bfe25bc?= =?UTF-8?Q?2903e8d5c8f:6.0.591,18.0.572,17.11.176.26.0000000_definitions?= =?UTF-8?Q?=3D2023-07-31=5F02:2023-07-31=5F02,2020-02-14=5F11,2023-05-22?= =?UTF-8?Q?=5F02_signatures=3D0?= X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2309080088 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 64013 X-Mailman-Approved-At: Fri, 08 Sep 2023 08:43:23 -0400 Cc: 64013@debbugs.gnu.org, YAMAMOTO Mitsuharu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Hi, Update - I=E2=80=99ve sorted the copyright assignment docs, so everything sh= ould be good to move forward. Kind regards, Stanislav Yaglo > On 12 Jun 2023, at 14:31, Po Lu wrote: >=20 > =EF=BB=BFStanislav Yaglo writes: >=20 >> Hi everyone, >>=20 >> Currently, on macOS, font weights are not handled correctly, which causes= Emacs to choose different font weights and widths than what you >> request. As one example, if you want to choose "Cascadia Code:weight=3Dse= mi-light", you will get Cascadia Code Light instead. Same for font >> widths, what you specify is not always what you get. >>=20 >> There's some interpolation going on which I didn't remove as it's potenti= ally handy for in-between values, but the problem itself is that the >> corresponding values are not correct for the majority of fonts, for examp= le, kCTFontWeightTrait is specified as -0.24 corresponding to 87.5 , but >> in reality, it is usually 50 (light), and the same for the other values. A= s you can see here, it won't work as we have 50 followed by 87.5 and then >> (a lower) 80, and then 140: >>=20 >> {-0.4, 50}, /* light */ >> {-0.24, 87.5}, /* (semi-light + normal) / 2 */ >> {0, 80}, /* normal */ >> {0.24, 140}, /* (semi-bold + normal) / 2 */ >>=20 >> It probably is a typo, as in the second (duplicate) table of values in th= e code, 100 is treated as normal instead of 80, which also isn't correct, as= >> 100 is medium, not normal: >>=20 >> {-0.4, 50}, /* light */ >> {-0.24, 87.5}, /* (semi-light + normal) / 2 */ >> {0, 100}, /* normal */ >> {0.24, 140}, /* (semi-bold + normal) / 2 */ >>=20 >> For font widths, there's only two kCTFontWidthTrait values in the range t= hat are handled currently =E2=80=94 from 0 to 1, and they are handled as >> linear font values from 100 to 200, which isn't correct either. For conde= nsed fonts, kCTFontWidthTrait is negative, which is not accounted for, >> and the slope is linear only from -0.4 (50, ultra-condensed) until 0.2 (1= 25, expanded), and from there until ultra-expanded is much steeper. >>=20 >> I've included all values that are listed in font.c for explicitness even i= f some values can be calculated with the code that interpolates the values. >> Also, I haven't refactored the duplication of the structs and code as I t= hink this is a different issue and should be done separately to keep this >> patch on point of the issue being fixed, and I will probably submit a pat= ch for this later to avoid code duplication and potential issues in the >> future as with the current 80/100 problem mentioned above. >>=20 >> Kind regards, >> Stanislav Yaglo >=20 > Thanks. Have you signed copyright papers for this change? > I've also copied in YAMAMOTO Mitsuharu , > who might have additional comments on this code. From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 01 05:22:03 2024 Received: (at 64013-done) by debbugs.gnu.org; 1 Feb 2024 10:22:03 +0000 Received: from localhost ([127.0.0.1]:40276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVUCp-0005mB-2o for submit@debbugs.gnu.org; Thu, 01 Feb 2024 05:22:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rVUCm-0005le-CF for 64013-done@debbugs.gnu.org; Thu, 01 Feb 2024 05:22:01 -0500 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 1rVUCW-0002ax-Qt; Thu, 01 Feb 2024 05:21:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ye01++y+h7jlgFGHve+ThTgnqFdgWdF3+i7NGUBQH58=; b=TKz58HcC/cD6sgbmz7Jv jrHPBXtK8Ka6anYRHXJRbPQo5wJbffq+LuBiBjJjRhcO5zSOS9Wbb+C73+e20Wzi4q7S/IcdahaMr ga72JVZFUWn0f5fJFnd1S3uhzSzpjgjAWnpTULEGAE655CmTUvCdIM/w2k82J9L96dSswYyarp/lw hlvytF3vNu/cadryMzl5JvGLWBI+OT5vj3p9d+Kp/9OaiH0i9j+ZHTUkXnH4GLOGg7RDc44nYU1of m2CX3bGpgrVTc85j/LFRVDMsWmPqMmGKWzRv3TN4NUPwdgJwkWKb3fC/pWrRvdBO7oRSeUuGjOq9W 6qC1089uLVtLXg==; Date: Thu, 01 Feb 2024 12:21:40 +0200 Message-Id: <86y1c4zdqj.fsf@gnu.org> From: Eli Zaretskii To: Stanislav Yaglo In-Reply-To: (message from Stanislav Yaglo on Mon, 12 Jun 2023 11:42:53 -0000) Subject: Re: [PATCH] macfont.m: Fix values for font widths and weights on macOS References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64013-done Cc: 64013-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stanislav Yaglo > Date: Mon, 12 Jun 2023 11:42:53 -0000 > > Currently, on macOS, font weights are not handled correctly, which causes > Emacs to choose different font weights and widths than what you request. As > one example, if you want to choose "Cascadia Code:weight=semi-light", you > will get Cascadia Code Light instead. Same for font widths, what you specify > is not always what you get. > > There's some interpolation going on which I didn't remove as it's potentially > handy for in-between values, but the problem itself is that the corresponding > values are not correct for the majority of fonts, for example, > kCTFontWeightTrait is specified as -0.24 corresponding to 87.5 , but in > reality, it is usually 50 (light), and the same for the other values. As you > can see here, it won't work as we have 50 followed by 87.5 and then (a lower) > 80, and then 140: > > {-0.4, 50}, /* light */ > {-0.24, 87.5}, /* (semi-light + normal) / 2 */ > {0, 80}, /* normal */ > {0.24, 140}, /* (semi-bold + normal) / 2 */ > > It probably is a typo, as in the second (duplicate) table of values in the > code, 100 is treated as normal instead of 80, which also isn't correct, as > 100 is medium, not normal: > > {-0.4, 50}, /* light */ > {-0.24, 87.5}, /* (semi-light + normal) / 2 */ > {0, 100}, /* normal */ > {0.24, 140}, /* (semi-bold + normal) / 2 */ > > For font widths, there's only two kCTFontWidthTrait values in the range that > are handled currently — from 0 to 1, and they are handled as linear font > values from 100 to 200, which isn't correct either. For condensed fonts, > kCTFontWidthTrait is negative, which is not accounted for, and the slope is > linear only from -0.4 (50, ultra-condensed) until 0.2 (125, expanded), and > from there until ultra-expanded is much steeper. > > I've included all values that are listed in font.c for explicitness even if > some values can be calculated with the code that interpolates the values. > Also, I haven't refactored the duplication of the structs and code as I think > this is a different issue and should be done separately to keep this patch on > point of the issue being fixed, and I will probably submit a patch for this > later to avoid code duplication and potential issues in the future as with > the current 80/100 problem mentioned above. Thanks, installed on the master branch, and closing the bug. From unknown Tue Jun 24 20:52:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 29 Feb 2024 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator