From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?S=E9bastien_Vauban?= Newsgroups: gmane.emacs.help Subject: Re: Testing that a font is installed Date: Tue, 26 Feb 2008 11:52:05 +0100 Organization: Sebastien Vauban Message-ID: <87zlto0z3e.fsf@mundaneum.com> References: <87d4qlqnmh.fsf@mundaneum.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1204026059 12868 80.91.229.12 (26 Feb 2008 11:40:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Feb 2008 11:40:59 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 26 12:41:20 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JTyBO-0004lu-2q for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Feb 2008 12:41:14 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JTyAr-00052f-Rw for geh-help-gnu-emacs@m.gmane.org; Tue, 26 Feb 2008 06:40:41 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!syros.belnet.be!aotearoa.belnet.be!news.belnet.be!feed1.news.be.easynet.net!reader0.news.be.easynet.net!not-for-mail Original-Newsgroups: gnu.emacs.help X-Www-site: Under construction... User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:lDJXw+FzyRwE30nr7+W8lNUfKio= Original-Lines: 207 Original-NNTP-Posting-Date: 26 Feb 2008 10:52:05 GMT Original-NNTP-Posting-Host: 81.188.7.152 Original-X-Trace: 1204023125 reader0.news.be.easynet.net 1585 [::ffff:81.188.7.152]:16743 Original-X-Complaints-To: abuse@be.easynet.net Original-Xref: shelby.stanford.edu gnu.emacs.help:156509 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:51879 Archived-At: 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-ub= untu/ 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=3D17:foundry=3Dmicrosoft:wei= ght=3Dmedium:slant=3Dr:width=3Dnormal | full name: consolas:pixelsize=3D17:foundry=3Dmicrosoft:wei= ght=3Dmedium:slant=3Dr:width=3Dnormal | 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-9= 6-96-c-*-*-*") --8<---------------cut here---------------end--------------->8--- is what I've in my `.emacs' file [=B9] 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-n= ormal-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-koi8-r" "koi8-r"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso8859-2" "iso8859-2"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"] ["consolas" normal 0 normal normal t "-outline-consolas-normal-r-n= ormal-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-2" "iso8859-2"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-koi8-r" "koi8-r"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"] ["consolas" normal 0 normal italic t "-outline-consolas-normal-i-n= ormal-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-koi8-r" "koi8-r"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-2" "iso8859-2"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"] ["consolas" normal 0 bold normal t "-outline-consolas-bold-r-norma= l-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso8859-7" "iso8859-7"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso8859-13" "iso8859-13"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso8859-4" "iso8859-4"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso8859-1" "iso8859-1"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-koi8-r" "koi8-r"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso8859-5" "iso8859-5"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso10646-1" "iso10646-1"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso8859-15" "iso8859-15"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-normal-*-*-96-96-c-*-iso8859-9" "iso8859-9"] ["consolas" normal 0 bold italic t "-outline-consolas-bold-i-norma= l-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-9= 6-96-c-*-*-*") (set-default-font "Consolas-8")) (set-default-font "-*-Courier New-*-*-*-*-12-90-*-*-*-*-*-*")) --8<---------------cut here---------------end--------------->8--- Any hints? Best regards, Seb [=B9] Just writing `(set-default-font "Consolas-8")))' is not successfull under Windows. Dunno why. --=20 S=E9bastien=A0Vauban