From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Testing font things Date: Tue, 22 Nov 2022 08:24:47 +0800 Message-ID: <87bkoz6dkg.fsf@yahoo.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9383"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 22 01:26:20 2022 Return-path: Envelope-to: ged-emacs-devel@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 1oxH7E-0002DN-Dc for ged-emacs-devel@m.gmane-mx.org; Tue, 22 Nov 2022 01:26:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxH6Q-0003qT-A7; Mon, 21 Nov 2022 19:25:30 -0500 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 1oxH6O-0003py-GD for emacs-devel@gnu.org; Mon, 21 Nov 2022 19:25:28 -0500 Original-Received: from sonic309-22.consmr.mail.ne1.yahoo.com ([66.163.184.148]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxH6K-00016t-Fs for emacs-devel@gnu.org; Mon, 21 Nov 2022 19:25:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1669076698; bh=9eF25AgtxQK62iSaSn4igiLAg9fq9eyrhS6CfC7j5mQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=jfEz67ZRoXPnKgXCCDlWaxWyee3ssZ7+u2U3q74PLll1/VcYs7x43QkXuMANxugBuqZSA5nnH+UEOMMcRCMoe6n90/kMMB5zw6gC8SMOOtJRtCq87SCZcVUkY2hq61nb91oRFdc+FpIL42pTM7HEcRyKAj6nIH7CgC2SKFCny1W9tpQGS3K6wpcRYuCZt7iiExTArYbz1q318zfV4fOoopwYI64WY1Wr9kJorulGNqtuD6DRBcKG78+Ngv6F8wZDuR3mzar/vx/BzrizF4kdRLu43BvY+q/IlA0J52BNYBikoviHy4aqPpd/pW+bcxL19ZlkO3YG2XX81b0NRwdagA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1669076698; bh=OddhktpsnAPgfyMQuUXx1q4AgNp80Y6L4G1IKvbyZnc=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=WH8zqB/+JeCuw937imGjEqBc6IBZGu/AEoWxfg6T/0rdSwBGK/3pkXDuLaMaGcSL3GK5YSB8bh3XjXw6QFwdytlfxPUmiMYA452u42Hzh6YfXaHAa9rx1EANh61NfYMF9nQVUZe75qHzAH+ikekK5vI64rkEvnzbXN8fQNp4SoNvw2j2UcRsYORMTyX0L7fB63qhBDH7MEKHe2ziNFGUnkVaOQRtLEKRRM5HriJ+cMa2eS6N90Rve1WoibbLU/EBINY8BAqan3g2YibiRjiTiCfiMAP6YrZpqHBZH6sJbafpSb/a7Q0NXcNbgR5Pi9eW4b3hmh2eCtMlOHA+7R831A== X-YMail-OSG: Wdtn09oVM1mTZiXF0GuxHvn95zUD2gBYkUqCChTkkrTFVYky4CuID2MKAnc7IQx t.Uq6pyxe89iA0pxawr7hYYC_HzH41XzOAm99whsmly90iDKcMk1SwXPk7jv7Nu5uAMhJ98Tx10H ZyYv_bSLIEIM78NKZp8xFlhrlUkoL.YakL9bZ1FWWB0MHYhegmml4LmJQTixFW_AsRwEIsqPzplY 3w.s5jdAAOGT4IpjLSuitDS3HSshbmIgqlVZ7glzN6PM6ZM0THa7s74aOMgj8HYQJ.0l8zXlpYNI te488QGZn8wK5EO_hYz1N0hr0FVUhaROrNG9zw6SGru_GXJEGHR4kAU2mOBuSFmjSXptMIS_9i29 2HtglkhU8vdt0V0TyxhJY4QSdHsyfShKrZzoL1STWqj2E9f8ERABoriGcTgxm.asy.Jtg.ENJQkH efyWhsKeGyvN3y4dyHnM3o3M92HYabJvo_PSmQSmSkeGti8ZXndNl1HcLkRbppv2A.LDVrcv5Oao o7vNjUHg6lhDIbP7woyNMdLaFggjN5VyXT3gPly1b1qTHRcRbAf8xJAGMuOM0lkeKBCCRZ4Og3wj Q_JSyy_GjjrP7DaaD3fGP2EvPgRv2RLlDrAdVkI8uMGBo.BGS8GIcoPwXrICvfH2QOusK87vFJbd TZyGY3HDEpHTGB_4K2MagvtTw2pcnB4yZ3nHoLV3FNRsiOWSVs83zpUbyacSnj3mOqWw18PSVbnx 624skF.t9vVEw55XdH_FUfxy_xE.vloFdF0l04kKG8G5dI.aLurpxJHlqCruoujG0EvwLIyjXpCc BSBUcomOcwAisQa7Jth22I.mKsVJ_z8HrFnjKEo4Js X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ne1.yahoo.com with HTTP; Tue, 22 Nov 2022 00:24:58 +0000 Original-Received: by hermes--production-sg3-6c8895b545-lgf2t (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 85e91f033a2b9c08e265a5228b00be52; Tue, 22 Nov 2022 00:24:53 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Mon, 21 Nov 2022 08:42:01 -0500") X-Mailer: WebService/1.1.20863 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.184.148; envelope-from=luangruo@yahoo.com; helo=sonic309-22.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300316 Archived-At: Stefan Monnier writes: > The code in font-tests.el looks like: > > (defvar font-tests--gui-frame > (unless noninteractive ;; I get "killed by SIGIO" in batch mode :-( > (with-demoted-errors "%S" > (make-frame-on-display > (getenv "DISPLAY") > '((visibility . nil) > ;; Tell the window manager not to ask the user to > ;; manually place the frame/window. > (user-position . t) > (left . 0) > (top . 0) > (no-other-frame . t)))))) > > (defvar font-tests--dejavu-sans > (when font-tests--gui-frame > (list-fonts (font-spec :family "DejaVu Sans") > font-tests--gui-frame))) > > (defvar font-tests--misc-fixed > (when font-tests--gui-frame > (list-fonts > (font-spec :name "-misc-fixed-*-*-semicondensed-*-13-*-*-*-*-*-*-*") > font-tests--gui-frame))) > > (ert-deftest font-tests--bug59347 () > (skip-unless (and font-tests--misc-fixed font-tests--dejavu-sans)) > (face-spec-set > 'default > '((t :font "-misc-fixed-*-*-semicondensed-*-13-*-*-*-*-*-*-*"))) > (face-spec-set 'font-tests-dejavu '((t :family "DejaVu Sans"))) > (with-temp-buffer > (let ((w (frame-root-window font-tests--gui-frame))) > (set-window-buffer w (current-buffer)) > (insert "hello " (propertize "world" 'face 'font-tests-dejavu)) > (should (member (font-at (1+ (point-min)) w) > font-tests--misc-fixed)) > (should (member (font-at (1- (point-max)) w) > font-tests--dejavu-sans))))) > > But this fails because `fonts-at` gets me a "font-object" whereas > `list-fonts` gets me "font entities". How can I convert one to > the other? You should resort to comparing font attributes with `font-get' instead. I don't think what you want is reliably possible.