unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Testing that a font is installed
@ 2008-02-25 11:30 Sébastien Vauban
  2008-02-26  4:14 ` Kevin Rodgers
       [not found] ` <mailman.7945.1203999281.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Sébastien Vauban @ 2008-02-25 11:30 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

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.

Thank you very much,
  Seb

-- 
Sébastien Vauban


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing that a font is installed
  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>
  1 sibling, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2008-02-26  4:14 UTC (permalink / raw)
  To: help-gnu-emacs

Sébastien Vauban wrote:
> 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")

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing that a font is installed
       [not found] ` <mailman.7945.1203999281.18990.help-gnu-emacs@gnu.org>
@ 2008-02-26 10:52   ` Sébastien Vauban
  2008-02-26 11:05     ` Jason Rumney
  0 siblings, 1 reply; 5+ messages in thread
From: Sébastien Vauban @ 2008-02-26 10:52 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing that a font is installed
  2008-02-26 10:52   ` Sébastien Vauban
@ 2008-02-26 11:05     ` Jason Rumney
  2008-02-26 13:22       ` Sébastien Vauban
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Rumney @ 2008-02-26 11:05 UTC (permalink / raw)
  To: help-gnu-emacs

On 26 Feb, 10:52, Sébastien Vauban <zthjwsqqa...@spammotel.com> wrote:

>         ,----[ *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
>         `----

It looks like you are using CVS emacs with the new font backend.
Currently, some of the old functions that deal with fonts are still
not using the new font backend, which is why (x-family-fonts
"Consolas") gives nil. I'd suggest using the functions of the new font
backend instead.

(list-fonts (font-spec :family "Consolas"))

As for XP, you appear not to be using the new font backend there. If
you use the CVS version and configure with --enable-font-backend, the
results will be consistent and you will be able to use "Consolas-8" on
both platforms and get rid of the ugly (if  running-ms-windows...)



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Testing that a font is installed
  2008-02-26 11:05     ` Jason Rumney
@ 2008-02-26 13:22       ` Sébastien Vauban
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Vauban @ 2008-02-26 13:22 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Jason,

>>         ,----[ *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
>>         `----
>
> It looks like you are using CVS emacs with the new font
> backend.

I'm using Emacs from the Ubuntu package provided by Alexandre
Vassalotti (see http://peadrop.com/blog/2007/01/06/pretty-emacs/):

    GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.12.0)
    of 2007-12-30 on iridium


> Currently, some of the old functions that deal with fonts are
> still not using the new font backend, which is why
> (x-family-fonts "Consolas") gives nil. I'd suggest using the
> functions of the new font backend instead.
>
> (list-fonts (font-spec :family "Consolas"))

It *works*, yes.


> As for XP, you appear not to be using the new font backend
> there.

I'm using the EmacsW32 binary provided by OurComments.org.


> If you use the CVS version and configure with
> --enable-font-backend ...

It seems that is not yet supported by EmacsW32. In fact, the
latest Emacs binary available on their site is quite old:

    GNU Emacs 22.0.990.1 (i386-mingw-nt5.1.2600) of 2007-05-23
    on LENNART-69DE564 (patched)


> ... the results will be consistent and you will be able to use
> "Consolas-8" on both platforms and get rid of the ugly (if
> running-ms-windows...)

As soon as the Windows binary gets updated (with the new font
backend), I'll try your advice.

Thank you very much!

Seb

-- 
Sébastien Vauban


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-26 13:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2008-02-26 11:05     ` Jason Rumney
2008-02-26 13:22       ` Sébastien Vauban

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).