From: "Sébastien Vauban" <zthjwsqqafhv@spammotel.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Testing that a font is installed
Date: Tue, 26 Feb 2008 11:52:05 +0100 [thread overview]
Message-ID: <87zlto0z3e.fsf@mundaneum.com> (raw)
In-Reply-To: mailman.7945.1203999281.18990.help-gnu-emacs@gnu.org
Hi Kevin,
>> Could someone tell me which function I could use to test
>> (under Ubuntu or under Windows) that a font is installed?
>>
>> For example, I would like to test, in my `.emacs', if
>> "Consolas" has been added to my system.
>
> (x-family-fonts "Consolas")
Being bootstrapped by that piece of information, I also found
the appropriate section about this on EmacsWiki:
"Testing if fonts are available?"
http://www.emacswiki.org/cgi-bin/wiki/SetFonts#toc4
Thank you for this.
Though, I must admit it behaves very very weirdly... I explain
myself:
1. --[ on Ubuntu ]-------------------------------------------------
--8<---------------cut here---------------start------------->8---
ELISP> (x-family-fonts "Consolas")
nil
ELISP> (x-family-fonts "consolas")
nil
--8<---------------cut here---------------end--------------->8---
The function returns an empty list of available fonts of
family "Consolas", though this is the one I'm currently
using in Emacs itself!!
I've installed it, following the "How To Install Vista
Fonts in Ubuntu" available at
http://ubuntu.wordpress.com/2007/09/16/installing-vista-fonts-in-ubuntu/
and I've put this in my `.emacs':
--8<---------------cut here---------------start------------->8---
(set-default-font "Consolas-8")))
--8<---------------cut here---------------end--------------->8---
And *it works*: I'm currently using Consolas for writing
this, but Emacs sort of tells he's unaware of it!??
But Emacs still finds information about Consolas via the
function `describe-font':
--8<---------------cut here---------------start------------->8---
ELISP> (describe-font "consolas")
"\n"
--8<---------------cut here---------------end--------------->8---
,----[ *Help* ]
| name (opened by): consolas:pixelsize=17:foundry=microsoft:weight=medium:slant=r:width=normal
| full name: consolas:pixelsize=17:foundry=microsoft:weight=medium:slant=r:width=normal
| size: 9
| height: 20
| baseline-offset: 0
| relative-compose: 0
`----
BTW, I've setted Consolas to 8pt and Emacs tells that
it's 9pt?
2. --[ on Windows XP ]---------------------------------------------
I've installed Consolas "manually" (by copying the .ttf
files in the fonts directory).
--8<---------------cut here---------------start------------->8---
(set-default-font "-outline-Consolas-normal-r-normal-normal-11-82-96-96-c-*-*-*")
--8<---------------cut here---------------end--------------->8---
is what I've in my `.emacs' file [¹] to tell him to use
Consolas.
--8<---------------cut here---------------start------------->8---
ELISP> (x-family-fonts "Consolas")
(["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-koi8-r" "koi8-r"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-2" "iso8859-2"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"]
["consolas" normal 0 normal normal t "-outline-consolas-normal-r-normal-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-2" "iso8859-2"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-koi8-r" "koi8-r"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"]
["consolas" normal 0 normal italic t "-outline-consolas-normal-i-normal-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-koi8-r" "koi8-r"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-2" "iso8859-2"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"]
["consolas" normal 0 bold normal t "-outline-consolas-bold-r-normal-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-koi8-r" "koi8-r"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"]
["consolas" normal 0 bold italic t "-outline-consolas-bold-i-normal-normal-*-*-96-96-c-*-iso8859-2" "iso8859-2"])
--8<---------------cut here---------------end--------------->8---
Emacs finds thus information about Consolas.
Weirdly enough, the function which more or less worked
under Ubuntu (to find me information about Consolas)
does not work in this case, under Windows!?
--8<---------------cut here---------------start------------->8---
ELISP> (describe-font "Consolas")
"No matching font being used"
ELISP> (describe-font "consolas")
"No matching font being used"
--8<---------------cut here---------------end--------------->8---
I'm lost. Both functions do not appear to work correctly,
neither under Ubuntu, neither under Windows.
What I'd like to have in my `.emacs' is something just like
this:
--8<---------------cut here---------------start------------->8---
(if (font-existsp "Consolas")
(if running-ms-windows
(set-default-font "-outline-Consolas-normal-r-normal-normal-11-82-96-96-c-*-*-*")
(set-default-font "Consolas-8"))
(set-default-font "-*-Courier New-*-*-*-*-12-90-*-*-*-*-*-*"))
--8<---------------cut here---------------end--------------->8---
Any hints?
Best regards,
Seb
[¹] Just writing `(set-default-font "Consolas-8")))' is not
successfull under Windows. Dunno why.
--
Sébastien Vauban
next prev parent reply other threads:[~2008-02-26 10:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-25 11:30 Testing that a font is installed Sébastien Vauban
2008-02-26 4:14 ` Kevin Rodgers
[not found] ` <mailman.7945.1203999281.18990.help-gnu-emacs@gnu.org>
2008-02-26 10:52 ` Sébastien Vauban [this message]
2008-02-26 11:05 ` Jason Rumney
2008-02-26 13:22 ` Sébastien Vauban
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=87zlto0z3e.fsf@mundaneum.com \
--to=zthjwsqqafhv@spammotel.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).