From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: face-variable-width-p?
Date: Sun, 17 Feb 2008 10:09:08 -0700 [thread overview]
Message-ID: <fp9pnf$l8g$1@ger.gmane.org> (raw)
In-Reply-To: <55187009-C105-4A5C-A6E1-CCB347A0D435@gmail.com>
David Reitter wrote:
> I'm trying to figure out whether a given face (the default face in a
> frame, to be precise) uses a variable width font, but I can't find an
> appropriate function in Emacs.
> One could compare the pixel widths of 'w' and 'i', but I can't find a
> function that would give me the pixel width of a (propertized) string,
> either.
How about parsing the XLFD font name:
(let ((font (frame-parameter (selected-frame) 'font)))
(string-match xlfd-tight-regexp font)
(match-string xlfd-regexp-spacing-subnum font))
On my machine, font is
"-apple-monaco-medium-r-normal--12-120-72-72-m-120-iso10646-1",
but match-string returns "72" instead of "m". So perhaps there's
a bug in xlfd-tight-regexp that can be worked around:
(let ((font (frame-parameter (selected-frame) 'font)))
(string-match xlfd-tight-regexp font)
(match-string (1+ xlfd-regexp-spacing-subnum) font))
A variable-width font (aka proportional pitch) should return "p"
-- see section 3.1.2.10 (SPACING Field) in
http://ftp.xfree.org/pub/XFree86/4.5.0/doc/xlfd.txt
--
Kevin Rodgers
Denver, Colorado, USA
next prev parent reply other threads:[~2008-02-17 17:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-06 12:19 face-variable-width-p? David Reitter
2008-02-17 17:09 ` Kevin Rodgers [this message]
[not found] ` <mailman.7529.1203268160.18990.help-gnu-emacs@gnu.org>
2008-02-26 12:24 ` face-variable-width-p? David Reitter
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='fp9pnf$l8g$1@ger.gmane.org' \
--to=kevin.d.rodgers@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).