From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#14634: 24.3.50; face attributes for font appearance (:font etc.) Date: Sun, 16 Jun 2013 02:15:17 -0700 (PDT) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1371374170 14647 80.91.229.3 (16 Jun 2013 09:16:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Jun 2013 09:16:10 +0000 (UTC) To: 14634@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 16 11:16:08 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uo94C-0000wX-AJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Jun 2013 11:16:08 +0200 Original-Received: from localhost ([::1]:51888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo94B-0005y3-KL for geb-bug-gnu-emacs@m.gmane.org; Sun, 16 Jun 2013 05:16:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo948-0005xw-G0 for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 05:16:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uo947-0003Pj-2F for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 05:16:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:53304) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo946-0003Pe-UE for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 05:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Uo946-000632-KC for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 05:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 16 Jun 2013 09:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 14634 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.137137413123136 (code B ref -1); Sun, 16 Jun 2013 09:16:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Jun 2013 09:15:31 +0000 Original-Received: from localhost ([127.0.0.1]:47620 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uo93a-000613-7d for submit@debbugs.gnu.org; Sun, 16 Jun 2013 05:15:30 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47576) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Uo93Y-00060q-2p for submit@debbugs.gnu.org; Sun, 16 Jun 2013 05:15:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uo93R-0003MZ-Lh for submit@debbugs.gnu.org; Sun, 16 Jun 2013 05:15:22 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51209) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo93R-0003MV-Is for submit@debbugs.gnu.org; Sun, 16 Jun 2013 05:15:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo93Q-0005wk-Au for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 05:15:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uo93P-0003ML-2N for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 05:15:20 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:39446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo93O-0003MH-Rh for bug-gnu-emacs@gnu.org; Sun, 16 Jun 2013 05:15:19 -0400 Original-Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r5G9FEaY002096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 16 Jun 2013 09:15:15 GMT Original-Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5G9FGwn026463 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 16 Jun 2013 09:15:17 GMT Original-Received: from abhmt118.oracle.com (abhmt118.oracle.com [141.146.116.70]) by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r5G9FG2B001561 for ; Sun, 16 Jun 2013 09:15:16 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7 (607090) [OL 12.0.6668.5000 (x86)] X-Source-IP: acsinet22.oracle.com [141.146.126.238] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:75198 Archived-At: Trying to figure out how to use face attribute :font, or, since that does not seem to work, to at least use other font-related face attributes. See also bug #14629, which is about the doc for face attribute :font. Suppose I want to show a string using a `face' text property that reflects a particular font, as given by its XLFD. For example, given this value from, say, a frame's `font' parameter: "-outline-Lucida Bright-bold-italic-normal-serif-14-*-*-*-p-*-iso8859-1" Suppose I want to propertize that string, for use elsewhere, with property `face' so that it appears in the same font (WYSIWYG). If `myfont' is a variable whose value is that XLFD string, you can try just using the string as the value of face attribute :font: (propertize myfont 'face (list :font myfont)) But that doesn't work - it seems to have no effect. Too bad. You can try splitting that XLFD string and using some of the fields: (let* ((splits (split-string myfont "-")) (foundry (nth 1 splits)) (family (nth 2 splits)) (weight (nth 3 splits)) (slant (nth 4 splits)) (width (nth 5 splits)))=20 (propertize myfont 'face (list :foundry foundry :family family :weight weight :slant slant :width width))) IOW: (propertize myfont 'face (list :foundry "outline" :family "Lucida Bright" :weight "bold" :slant "italic" :width "normal")) But that doesn't really show the font as it should either. It doesn't appear italic at all. And you apparently cannot get the size/height this way (by parsing the XLFD). There seems to be no correspondence between the value of PIXELS or HEIGHT from the XLFD and the available face attribute for size (i.e., :height). Nor does there seem to be any correspondence between face attribute :height and the sizes returned by `font-info' (neither SIZE nor HEIGHT). (Note that SIZE is not even explained - the `font-info' doc string just says it is "the pixelsize", whatever that means!) Why does :height use units of 1/10 point? None of the ways I can find to get info about a font's size use such units. And its not clear how to convert what you can obtain from the XLFD or from `font-info' into a :height value you can use as a face attribute. Why not make `font-info' return info that can be used as face attributes? And why not make face attributes that correspond to the font properties that Emacs uses elsewhere? (emacs) `Fonts' mentions these, for "fontconfig patterns": `style' and `spacing' (in addition to `slant', `weight', and `width'). And for XLFD it mentions all of the XLFD fields. Why can't we use such info as face attributes? Am I missing something, or is it a bug that you cannot easily specify a font's properties as face attributes? In general, this seems quite confusing and buggy. And isn't it a bug that specifying :slant "italic" has no effect? That is easy to see: emacs -Q In *scratch*, turn off font-lock-mode, then type this, then hit `C-x C-e': (put-text-property 92 126=20 =09=09 'face (list :foundry "outline" =09=09=09 :family "Lucida Bright" =09=09=09 :weight "bold" :slant "italic" =09=09=09 :width "normal")) You will see the words "to create a file, visit that file" change font, but they will not be italic... (I don't think it is bold either, but I cannot be sure.) `C-u C-x =3D' shows that the property was applied, but it is not reflected. Yet if you use `M-x customize-face default', and you set the family to "Lucida Bright", the foundry to "outline", the width to "normal", the weight to "bold", and the slant to "italic", you will see the font as it should be (bold italic). In GNU Emacs 24.3.50.1 (i686-pc-mingw32) of 2013-06-13 on ODIEONE Bzr revision: 112978 xfq.free@gmail.com-20130613224333-3yfl8navh3c1vmxy Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --prefix=3D/c/Devel/emacs/binary --enable-checking=3Dyes,glyphs CFLAGS=3D'-O0 -g3' CPPFLAGS=3D'-Ic:/Devel/emacs/include' LDFLAGS=3D'-Lc:/Devel/emacs/lib''