unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* getting unicode chars to show on Windows
@ 2009-08-25  6:20 Xah Lee
  2009-08-25 17:16 ` B. T. Raven
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Xah Lee @ 2009-08-25  6:20 UTC (permalink / raw)
  To: help-gnu-emacs

i have this unicode file
http://xahlee.org/emacs/unicode.txt

when viewed in latest Safari, Google Chrome, Opera, Firefox, on
Windows (Vista), all char shows. But many chars don't show in emacs 23
for Windows of the same machine. I tried many fonts... Courier New,
Lucida Console, Lucida Sans Unicode... but none shows all as browsers
do.

any one got idea how to fix this?

Lucida Sans Unicode shows most, but unfortunately, it's not monospaced
font.

Thanks.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: getting unicode chars to show on Windows
  2009-08-25  6:20 getting unicode chars to show on Windows Xah Lee
@ 2009-08-25 17:16 ` B. T. Raven
  2009-08-25 18:31 ` Eli Zaretskii
       [not found] ` <mailman.5342.1251225106.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 19+ messages in thread
From: B. T. Raven @ 2009-08-25 17:16 UTC (permalink / raw)
  To: help-gnu-emacs

Xah Lee wrote:
> i have this unicode file
> http://xahlee.org/emacs/unicode.txt
> 
> when viewed in latest Safari, Google Chrome, Opera, Firefox, on
> Windows (Vista), all char shows. But many chars don't show in emacs 23
> for Windows of the same machine. I tried many fonts... Courier New,
> Lucida Console, Lucida Sans Unicode... but none shows all as browsers
> do.
> 
> any one got idea how to fix this?
> 
> Lucida Sans Unicode shows most, but unfortunately, it's not monospaced
> font.
> 
> Thanks.
> 
>   Xah
> ∑ http://xahlee.org/
> 
> ☄


Try Arial Unicode MS. That covers the widest swath of Unicode ranges of 
any font supplied by MS. Code 2000 might show even more. I don't know if 
you can construct fontsets on the w32 build of Emacs (I could never get 
them to work) but that route might get you the same coverage as with 
Arial Unicode MS.

Ed


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

* Re: getting unicode chars to show on Windows
  2009-08-25  6:20 getting unicode chars to show on Windows Xah Lee
  2009-08-25 17:16 ` B. T. Raven
@ 2009-08-25 18:31 ` Eli Zaretskii
  2009-08-26  5:48   ` AW: " Christian.Strobl
  2009-08-26  5:50   ` Christian.Strobl
       [not found] ` <mailman.5342.1251225106.2239.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 19+ messages in thread
From: Eli Zaretskii @ 2009-08-25 18:31 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Xah Lee <xahlee@gmail.com>
> Date: Mon, 24 Aug 2009 23:20:51 -0700 (PDT)
> 
> i have this unicode file
> http://xahlee.org/emacs/unicode.txt
> 
> when viewed in latest Safari, Google Chrome, Opera, Firefox, on
> Windows (Vista), all char shows. But many chars don't show in emacs 23
> for Windows of the same machine.

I see almost all of them, with the same Emacs 23.1.  According to
"C-u C-x =", Arial Unicode font is your friend.  But in my case, Emacs
uses it automatically, even in "emacs -Q".




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

* Re: getting unicode chars to show on Windows
       [not found] ` <mailman.5342.1251225106.2239.help-gnu-emacs@gnu.org>
@ 2009-08-25 22:38   ` B. T. Raven
  2009-08-25 22:42     ` B. T. Raven
                       ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: B. T. Raven @ 2009-08-25 22:38 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii wrote:
>> From: Xah Lee <xahlee@gmail.com>
>> Date: Mon, 24 Aug 2009 23:20:51 -0700 (PDT)
>>
>> i have this unicode file
>> http://xahlee.org/emacs/unicode.txt
>>
>> when viewed in latest Safari, Google Chrome, Opera, Firefox, on
>> Windows (Vista), all char shows. But many chars don't show in emacs 23
>> for Windows of the same machine.
> 
> I see almost all of them, with the same Emacs 23.1.  According to
> "C-u C-x =", Arial Unicode font is your friend.  But in my case, Emacs
> uses it automatically, even in "emacs -Q".
> 
> 

Eli:

Could the glyphs that still show up as boxes (math, industrial, 
computing, etc.) be made to appear if a fontset is used?

Why don't the ipa Symbols appear? They are part of Arial Unicode.

Btw, Xah, I think it's a great bit of black humor to include the chinese 
swastikas, sickle and hammer, among cultural symbols. I guess the 
destruction of culture still has something to do with culture. u+2638

p.s. Now I find most of the other open boxes in Arial Unicode also (via 
babelmap).

Ed


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

* Re: getting unicode chars to show on Windows
  2009-08-25 22:38   ` B. T. Raven
@ 2009-08-25 22:42     ` B. T. Raven
  2009-08-26  3:21     ` Eli Zaretskii
       [not found]     ` <mailman.5389.1251256888.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 19+ messages in thread
From: B. T. Raven @ 2009-08-25 22:42 UTC (permalink / raw)
  To: help-gnu-emacs

B. T. Raven wrote:
> Eli Zaretskii wrote:
>>> From: Xah Lee <xahlee@gmail.com>
>>> Date: Mon, 24 Aug 2009 23:20:51 -0700 (PDT)
>>>
>>> i have this unicode file
>>> http://xahlee.org/emacs/unicode.txt
>>>
>>> when viewed in latest Safari, Google Chrome, Opera, Firefox, on
>>> Windows (Vista), all char shows. But many chars don't show in emacs 23
>>> for Windows of the same machine.
>>
>> I see almost all of them, with the same Emacs 23.1.  According to
>> "C-u C-x =", Arial Unicode font is your friend.  But in my case, Emacs
>> uses it automatically, even in "emacs -Q".
>>
>>
> 
> Eli:
> 
> Could the glyphs that still show up as boxes (math, industrial, 
> computing, etc.) be made to appear if a fontset is used?
> 
> Why don't the ipa Symbols appear? They are part of Arial Unicode.
> 
> Btw, Xah, I think it's a great bit of black humor to include the chinese 
> swastikas, sickle and hammer, among cultural symbols. I guess the 
> destruction of culture still has something to do with culture. u+2638
> 
> p.s. Now I find most of the other open boxes in Arial Unicode also (via 
> babelmap).
> 
> Ed


Code2000 font shows all of them but the glyphs aren't very crisp looking.


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

* Re: getting unicode chars to show on Windows
  2009-08-25 22:38   ` B. T. Raven
  2009-08-25 22:42     ` B. T. Raven
@ 2009-08-26  3:21     ` Eli Zaretskii
       [not found]     ` <mailman.5389.1251256888.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2009-08-26  3:21 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Tue, 25 Aug 2009 17:38:02 -0500
> From: "B. T. Raven" <nihil@nihilo.net>
> 
> Could the glyphs that still show up as boxes (math, industrial, 
> computing, etc.) be made to appear if a fontset is used?

I think so, but for me they appear without any customizations at all.

> Why don't the ipa Symbols appear? They are part of Arial Unicode.

I don't know enough about these issues.  I suggest to submit a bug
report with "M-x report-emacs-bug".




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

* AW: getting unicode chars to show on Windows
  2009-08-25 18:31 ` Eli Zaretskii
@ 2009-08-26  5:48   ` Christian.Strobl
  2009-08-26  5:50   ` Christian.Strobl
  1 sibling, 0 replies; 19+ messages in thread
From: Christian.Strobl @ 2009-08-26  5:48 UTC (permalink / raw)
  To: eliz, help-gnu-emacs



maybe you have to install the Arial Unicode font first. here are some informations

http://en.wikipedia.org/wiki/Arial_Unicode_MS
http://support.microsoft.com/kb/287247



-----Ursprüngliche Nachricht-----
Von: help-gnu-emacs-bounces+christian.strobl=dlr.de@gnu.org im Auftrag von Eli Zaretskii
Gesendet: Di 25.08.2009 20:31
An: help-gnu-emacs@gnu.org
Betreff: Re: getting unicode chars to show on Windows
 
> From: Xah Lee <xahlee@gmail.com>
> Date: Mon, 24 Aug 2009 23:20:51 -0700 (PDT)
> 
> i have this unicode file
> http://xahlee.org/emacs/unicode.txt
> 
> when viewed in latest Safari, Google Chrome, Opera, Firefox, on
> Windows (Vista), all char shows. But many chars don't show in emacs 23
> for Windows of the same machine.

I see almost all of them, with the same Emacs 23.1.  According to
"C-u C-x =", Arial Unicode font is your friend.  But in my case, Emacs
uses it automatically, even in "emacs -Q".







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

* AW: getting unicode chars to show on Windows
  2009-08-25 18:31 ` Eli Zaretskii
  2009-08-26  5:48   ` AW: " Christian.Strobl
@ 2009-08-26  5:50   ` Christian.Strobl
  1 sibling, 0 replies; 19+ messages in thread
From: Christian.Strobl @ 2009-08-26  5:50 UTC (permalink / raw)
  To: eliz, help-gnu-emacs



maybe you have to install Arial Unicode MS first. here you find some informations:

http://en.wikipedia.org/wiki/Arial_Unicode_MS
http://support.microsoft.com/kb/287247



-----Ursprüngliche Nachricht-----
Von: help-gnu-emacs-bounces+christian.strobl=dlr.de@gnu.org im Auftrag von Eli Zaretskii
Gesendet: Di 25.08.2009 20:31
An: help-gnu-emacs@gnu.org
Betreff: Re: getting unicode chars to show on Windows
 
> From: Xah Lee <xahlee@gmail.com>
> Date: Mon, 24 Aug 2009 23:20:51 -0700 (PDT)
> 
> i have this unicode file
> http://xahlee.org/emacs/unicode.txt
> 
> when viewed in latest Safari, Google Chrome, Opera, Firefox, on
> Windows (Vista), all char shows. But many chars don't show in emacs 23
> for Windows of the same machine.

I see almost all of them, with the same Emacs 23.1.  According to
"C-u C-x =", Arial Unicode font is your friend.  But in my case, Emacs
uses it automatically, even in "emacs -Q".







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

* Re: getting unicode chars to show on Windows
       [not found]     ` <mailman.5389.1251256888.2239.help-gnu-emacs@gnu.org>
@ 2009-08-26 11:35       ` Xah Lee
  2009-08-26 22:09         ` Jason Rumney
  2009-08-27  3:22         ` Eli Zaretskii
  0 siblings, 2 replies; 19+ messages in thread
From: Xah Lee @ 2009-08-26 11:35 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 25, 8:21 pm, Eli Zaretskii <e...@gnu.org> wrote:
> > Date: Tue, 25 Aug 2009 17:38:02 -0500
> > From: "B. T. Raven" <ni...@nihilo.net>
>
> > Could the glyphs that still show up as boxes (math, industrial,
> > computing, etc.) be made to appear if a fontset is used?
>
> I think so, but for me they appear without any customizations at all.
>
> > Why don't the ipa Symbols appear? They are part of Arial Unicode.
>
> I don't know enough about these issues.  I suggest to submit a bug
> report with "M-x report-emacs-bug".

thanks Raven & Eli.

humm... it show for you Eli out of the box. Strange.

i don't have Arial Unicode MS, since it is part of Windows Office and
OS X 10.5 both i don't have.

my current choice is Lucida Sans Unicode, which provide the most
unicode chars among my choices, but is not monospaced font. Works out
well, except dired, and unusable in M-x calendar. The unicode here
also lacks a lot, e.g. half of the bottom page's chars won't show
  http://xahlee.org/emacs/unicode.txt
but still is the font that shows the most on my machine.

Code2000 shows almost all the unicode, but the font is so bad... it's
not readable.

Fixsys is not too bad, too dark and thick for me. It doesn't show more
unicode than Lucida Sans Unicode. (it's bitmapped font. However,
there's a TrueType version you can download from the web)

Courier New and Lucida Console are both very good. monospaced, but
they don't show that much unicode except the most basic ones.

am guessing the problem really needs to be solved by some sort of font
substitution. Browsers apparantly are all doing it and perfectly on my
machine since they show all chars without user needing to set fonts.

i guess in emacs that is fontset? I'm not sure if it is just fontset,
or emacs also calls the OS's font api to complete part of the
display...

Eli, what version of emacs are you using? are you sure it's straight
compile from source without customization?

PS (i am pretty sure i posted this yesterday, but can't see the msg in
google groups. This is a repost with some modification. Thanks to
Christian too.)

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: getting unicode chars to show on Windows
  2009-08-26 11:35       ` Xah Lee
@ 2009-08-26 22:09         ` Jason Rumney
  2009-08-27 18:36           ` Xah Lee
  2009-08-27  3:22         ` Eli Zaretskii
  1 sibling, 1 reply; 19+ messages in thread
From: Jason Rumney @ 2009-08-26 22:09 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 26, 7:35 pm, Xah Lee <xah...@gmail.com> wrote:

> humm... it show for you Eli out of the box. Strange.

Some fonts, particularly CJK ones which tend to cover a substantial
part of the BMP but have many gaps, seem to get in the way of (nearly)
full coverage fonts like Arial Unicode MS by default.

> am guessing the problem really needs to be solved by some sort of font
> substitution. Browsers apparantly are all doing it and perfectly on my
> machine since they show all chars without user needing to set fonts.

I don't know how the browsers are doing it, perhaps they come with
predefined lists of fonts that are commonly installed on Windows to
cover different ranges.

> i guess in emacs that is fontset? I'm not sure if it is just fontset,
> or emacs also calls the OS's font api to complete part of the
> display...

Yes, in Emacs that is a fontset, and the difference between what
people are reporting is caused by the fact that the default fontset
defines rules that are based on information other than the font name
by default.  If you know what fonts best support different characters
on your system, I'd recommend redefining the default fontset to use
your preferred fonts using (set-fontset-font t ... ...). There are
many examples of using this function in lisp/international/fontset.el,
along with a list of scripts that Emacs recognizes as the third
argument (in script-representative-chars); another simple one below:

(set-fontset-font t 'phonetic "Lucida Sans Unicode")



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

* Re: getting unicode chars to show on Windows
  2009-08-26 11:35       ` Xah Lee
  2009-08-26 22:09         ` Jason Rumney
@ 2009-08-27  3:22         ` Eli Zaretskii
  1 sibling, 0 replies; 19+ messages in thread
From: Eli Zaretskii @ 2009-08-27  3:22 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Xah Lee <xahlee@gmail.com>
> Date: Wed, 26 Aug 2009 04:35:58 -0700 (PDT)
> 
> Eli, what version of emacs are you using? are you sure it's straight
> compile from source without customization?

Like I said, it's stock Emacs 23.1 compiled from the official release
tarball.




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

* Re: getting unicode chars to show on Windows
  2009-08-26 22:09         ` Jason Rumney
@ 2009-08-27 18:36           ` Xah Lee
  2009-08-28 10:40             ` Florian Beck
       [not found]             ` <mailman.5571.1251456046.2239.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 19+ messages in thread
From: Xah Lee @ 2009-08-27 18:36 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 26, 3:09 pm, Jason Rumney <jasonrum...@gmail.com> wrote:
> On Aug 26, 7:35 pm, Xah Lee <xah...@gmail.com> wrote:
>
> > humm... it show for you Eli out of the box. Strange.
>
> Some fonts, particularly CJK ones which tend to cover a substantial
> part of the BMP but have many gaps, seem to get in the way of (nearly)
> full coverage fonts like Arial Unicode MS by default.
>
> > am guessing the problem really needs to be solved by some sort of font
> > substitution. Browsers apparantly are all doing it and perfectly on my
> > machine since they show all chars without user needing to set fonts.
>
> I don't know how the browsers are doing it, perhaps they come with
> predefined lists of fonts that are commonly installed on Windows to
> cover different ranges.
>
> > i guess in emacs that is fontset? I'm not sure if it is just fontset,
> > or emacs also calls the OS's font api to complete part of the
> > display...
>
> Yes, in Emacs that is a fontset, and the difference between what
> people are reporting is caused by the fact that the default fontset
> defines rules that are based on information other than the font name
> by default.  If you know what fonts best support different characters
> on your system, I'd recommend redefining the default fontset to use
> your preferred fonts using (set-fontset-font t ... ...). There are
> many examples of using this function in lisp/international/fontset.el,
> along with a list of scripts that Emacs recognizes as the third
> argument (in script-representative-chars); another simple one below:
>
> (set-fontset-font t 'phonetic "Lucida Sans Unicode")

Thanks. Spent a couple of hours reading about emacs fonts... am still
pretty much nowhere.... agh emacs.

 Xah


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

* Re: getting unicode chars to show on Windows
  2009-08-27 18:36           ` Xah Lee
@ 2009-08-28 10:40             ` Florian Beck
       [not found]             ` <mailman.5571.1251456046.2239.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 19+ messages in thread
From: Florian Beck @ 2009-08-28 10:40 UTC (permalink / raw)
  To: Xah Lee; +Cc: help-gnu-emacs

Xah Lee <xahlee@gmail.com> writes:

> On Aug 26, 3:09 pm, Jason Rumney <jasonrum...@gmail.com> wrote:
>> On Aug 26, 7:35 pm, Xah Lee <xah...@gmail.com> wrote:
>>
>> > humm... it show for you Eli out of the box. Strange.
>>
>> Some fonts, particularly CJK ones which tend to cover a substantial
>> part of the BMP but have many gaps, seem to get in the way of (nearly)
>> full coverage fonts like Arial Unicode MS by default.
>>
>> > am guessing the problem really needs to be solved by some sort of font
>> > substitution. Browsers apparantly are all doing it and perfectly on my
>> > machine since they show all chars without user needing to set fonts.
>>
>> I don't know how the browsers are doing it, perhaps they come with
>> predefined lists of fonts that are commonly installed on Windows to
>> cover different ranges.
>>
>> > i guess in emacs that is fontset? I'm not sure if it is just fontset,
>> > or emacs also calls the OS's font api to complete part of the
>> > display...
>>
>> Yes, in Emacs that is a fontset, and the difference between what
>> people are reporting is caused by the fact that the default fontset
>> defines rules that are based on information other than the font name
>> by default.  If you know what fonts best support different characters
>> on your system, I'd recommend redefining the default fontset to use
>> your preferred fonts using (set-fontset-font t ... ...). There are
>> many examples of using this function in lisp/international/fontset.el,
>> along with a list of scripts that Emacs recognizes as the third
>> argument (in script-representative-chars); another simple one below:
>>
>> (set-fontset-font t 'phonetic "Lucida Sans Unicode")
>
> Thanks. Spent a couple of hours reading about emacs fonts... am still
> pretty much nowhere.... agh emacs.

Not sure what exactly your problem is, but here are a couple of pointers:

To figure out what character ranges, fonts, etc I need, I use this site:

http://www.alanwood.net/unicode/fontsbyrange.html

Then you simply specify the font you want for specific characters (like
Jason wrote), e.g.

(set-fontset-font t 'cherokee
  (font-spec :family "MPH 2B Damase" :size 24))

Instead of the script name 'cherokee you can also use a range '(5024 .
5119) or '(#x13A0 . #x13FF) or specify the first and last character '(?Ꭰ
. ?᏿).

After you have done this for the most important characters you can use
something like

(set-fontset-font t nil (font-spec :family "Code2000") nil 'prepend)

Called with 'prepend, set-fontset-font will only affect characters that
had no font previously, so you can use Code2000 as a fallback.

If you want to use several fontsets or start from scratch, the easiest
way is to define a fontset

(create-fontset-from-fontset-spec
  "-*-DejaVu Sans Mono-medium-r-normal-*-14-*-*-*-*-*-fontset-mono")

This fontset will be called fontset-mono, so you would use

(set-fontset-font "fontset-mono" 'cherokee
  (font-spec :family "MPH 2B Damase" :size 24))

to modify it.

Hope that helps.



  
  
-- 
Florian Beck




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

* Re: getting unicode chars to show on Windows
       [not found]             ` <mailman.5571.1251456046.2239.help-gnu-emacs@gnu.org>
@ 2009-08-28 14:00               ` Xah Lee
  2009-08-28 23:40                 ` Florian Beck
                                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Xah Lee @ 2009-08-28 14:00 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Florian,

thank for your info. I'll need to study it more... getting any unicode
char to display ... also wished to understand emacs fontset in some
detail, so am a bit slow and taking it easy. There are several posts
on this font issue recently... i think Peter? posted a fonset code
that supposed to make all unicode display... (saved to be studied
later) A complication with emacs/fonts is that different OS comes with
different sets of fonts, and for particular platform emacs also deals
font differently ...

Though, right now there's this one thing i need. How do i set a font
for the current frame?
What i want is a toggle-font code so that i can press a key and have
the font set to either a monospaced or variable-spaced one, and just
for the current frame. More specifically:

• what's the elisp function that makes the current frame use Courier
New? (i'll also need to know the full string or whatever that emacs
uses for what Windows calls the Courier New font.)

Thanks.

 Xah

On Aug 28, 3:40 am, Florian Beck <abstrakt...@t-online.de> wrote:
> > Thanks. Spent a couple of hours reading about emacs fonts... am still
> > pretty much nowhere.... agh emacs.
>
> Not sure what exactly your problem is, but here are a couple of pointers:
>
> To figure out what character ranges, fonts, etc I need, I use this site:
>
> http://www.alanwood.net/unicode/fontsbyrange.html
>
> Then you simply specify the font you want for specific characters (like
> Jason wrote), e.g.
>
> (set-fontset-font t 'cherokee
>   (font-spec :family "MPH 2B Damase" :size 24))
>
> Instead of the script name 'cherokee you can also use a range '(5024 .
> 5119) or '(#x13A0 . #x13FF) or specify the first and last character '(?Ꭰ
> . ?᏿).
>
> After you have done this for the most important characters you can use
> something like
>
> (set-fontset-font t nil (font-spec :family "Code2000") nil 'prepend)
>
> Called with 'prepend, set-fontset-font will only affect characters that
> had no font previously, so you can use Code2000 as a fallback.
>
> If you want to use several fontsets or start from scratch, the easiest
> way is to define a fontset
>
> (create-fontset-from-fontset-spec
>   "-*-DejaVu Sans Mono-medium-r-normal-*-14-*-*-*-*-*-fontset-mono")
>
> This fontset will be called fontset-mono, so you would use
>
> (set-fontset-font "fontset-mono" 'cherokee
>   (font-spec :family "MPH 2B Damase" :size 24))
>
> to modify it.
>
> Hope that helps.
>
> --
> Florian Beck


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

* Re: getting unicode chars to show on Windows
  2009-08-28 14:00               ` Xah Lee
@ 2009-08-28 23:40                 ` Florian Beck
  2009-08-29  0:20                 ` Drew Adams
       [not found]                 ` <mailman.5608.1251505221.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 19+ messages in thread
From: Florian Beck @ 2009-08-28 23:40 UTC (permalink / raw)
  To: Xah Lee; +Cc: help-gnu-emacs

Xah Lee <xahlee@gmail.com> writes:

> Hi Florian,
>
> thank for your info. I'll need to study it more... getting any unicode
> char to display ... also wished to understand emacs fontset in some
> detail, so am a bit slow and taking it easy. There are several posts
> on this font issue recently... i think Peter? posted a fonset code
> that supposed to make all unicode display...  

Unlikely, unless you have the appropriate fonts installed. There are
some fonts that cover many characters, like Code2000/Code2001 or Arial
Unicode Ms, but, as you found out, the quality is not the best. Thats
why I recommended using `set-fontset-font' to set the best font for a
particular range.

Start with defining two fontsets, e.g.

(create-fontset-from-fontset-spec
  "-*-Courier New-medium-r-normal-*-14-*-*-*-*-*-fontset-mono")

(create-fontset-from-fontset-spec
  "-*-DejaVu Serif-medium-r-normal-*-14-*-*-*-*-*-fontset-serif")

or whatever you want to use for variable pitch.

Don't worry about the string. The second element  »Courier New« is the
font family, the last is the name of the fontset.

Switch with
(set-frame-font "fontset-mono") and
(set-frame-font "fontset-serif").

[Use a keybinding, e.g. (global-set-key (kbd "<f8>") '(lambda () (interactive)
(set-frame-font "fontset-serif")))]

Once you find a better font for a particular range, use

(set-fontset-font "fontset-mono" 'cherokee
  (font-spec :family "MPH 2B Damase" :size 24))

to modify your fontset.  

> (saved to be studied later) A complication with emacs/fonts is that
> different OS comes with different sets of fonts, and for particular
> platform emacs also deals font differently ...
>
> Though, right now there's this one thing i need. How do i set a font
> for the current frame?

With `set-frame-font'.

[You might also want to look into `buffer-face-mode' which allows a
per-buffer setting, but works with faces.] 

> What i want is a toggle-font code so that i can press a key and have
> the font set to either a monospaced or variable-spaced one, and just
> for the current frame. 

First, try `variable-pitch-mode'. This works on the current buffer and
may be all you want.

> More specifically:
>
> • what's the elisp function that makes the current frame use Courier
> New? 

(set-frame-font "Courier New")

This also takes a fontset as an argument: 

(set-frame-font "fontset-mono")

> (i'll also need to know the full string or whatever that emacs uses
> for what Windows calls the Courier New font.)

Finding the right font name can be a bit tricky. But

(font-family-list)

shows the available fonts.

>
> Thanks.
>
>  Xah
>
> On Aug 28, 3:40 am, Florian Beck <abstrakt...@t-online.de> wrote:
>> > Thanks. Spent a couple of hours reading about emacs fonts... am still
>> > pretty much nowhere.... agh emacs.
>>
>> Not sure what exactly your problem is, but here are a couple of pointers:
>>
>> To figure out what character ranges, fonts, etc I need, I use this site:
>>
>> http://www.alanwood.net/unicode/fontsbyrange.html
>>
>> Then you simply specify the font you want for specific characters (like
>> Jason wrote), e.g.
>>
>> (set-fontset-font t 'cherokee
>>   (font-spec :family "MPH 2B Damase" :size 24))
>>
>> Instead of the script name 'cherokee you can also use a range '(5024 .
>> 5119) or '(#x13A0 . #x13FF) or specify the first and last character '(?Ꭰ
>> . ?᏿).
>>
>> After you have done this for the most important characters you can use
>> something like
>>
>> (set-fontset-font t nil (font-spec :family "Code2000") nil 'prepend)
>>
>> Called with 'prepend, set-fontset-font will only affect characters that
>> had no font previously, so you can use Code2000 as a fallback.
>>
>> If you want to use several fontsets or start from scratch, the easiest
>> way is to define a fontset
>>
>> (create-fontset-from-fontset-spec
>>   "-*-DejaVu Sans Mono-medium-r-normal-*-14-*-*-*-*-*-fontset-mono")
>>
>> This fontset will be called fontset-mono, so you would use
>>
>> (set-fontset-font "fontset-mono" 'cherokee
>>   (font-spec :family "MPH 2B Damase" :size 24))
>>
>> to modify it.
>>
>> Hope that helps.
>>
>> --
>> Florian Beck
>

-- 
Florian Beck




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

* RE: getting unicode chars to show on Windows
  2009-08-28 14:00               ` Xah Lee
  2009-08-28 23:40                 ` Florian Beck
@ 2009-08-29  0:20                 ` Drew Adams
       [not found]                 ` <mailman.5608.1251505221.2239.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 19+ messages in thread
From: Drew Adams @ 2009-08-29  0:20 UTC (permalink / raw)
  To: 'Xah Lee', help-gnu-emacs

> How do i set a font for the current frame?

M-x icicle-font S-TAB

Choose any available font, using completion. Use `M-SPC', if you want to match
different font parts separately (taking the intersection).

> What i want is a toggle-font code so that i can press a key and have
> the font set to either a monospaced or variable-spaced one, and just
> for the current frame. More specifically: what's the elisp function
> that makes the current frame use Courier New? (i'll also need to
> know the full string or whatever that emacs uses for what Windows
> calls the Courier New font.)

(set-frame-parameter nil 'font "-*-Courier
New-normal-r-*-*-14-112-96-96-c-*-iso8859-1")

or whatever font you want.

M-: (frame-parameters) is your friend.

 





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

* Re: getting unicode chars to show on Windows
       [not found]                 ` <mailman.5608.1251505221.2239.help-gnu-emacs@gnu.org>
@ 2009-08-29 16:22                   ` Xah Lee
  2009-08-30 17:38                     ` Jason Rumney
  2009-08-31 15:23                     ` Drew Adams
  0 siblings, 2 replies; 19+ messages in thread
From: Xah Lee @ 2009-08-29 16:22 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 28, 5:20 pm, "Drew Adams" <drew.ad...@oracle.com> wrote:
> > How do i set a font for the current frame?
>
> M-x icicle-font S-TAB
>
> Choose any available font, using completion. Use `M-SPC', if you want to match
> different font parts separately (taking the intersection).
>
> > What i want is a toggle-font code so that i can press a key and have
> > the font set to either a monospaced or variable-spaced one, and just
> > for the current frame. More specifically: what's the elisp function
> > that makes the current frame use Courier New? (i'll also need to
> > know the full string or whatever that emacs uses for what Windows
> > calls the Courier New font.)
>
> (set-frame-parameter nil 'font "-*-Courier
> New-normal-r-*-*-14-112-96-96-c-*-iso8859-1")
>
> or whatever font you want.
>
> M-: (frame-parameters) is your friend.

Thanks Drew & Florian.

Spent another 1 hour on this, didn't want to go further at this moment
but wanted to report some findings and reply.

finally was able to get something useful:

(defun cycle-font ()
  "Change font in current frame, cycling thru a predefined set of
fonts."
  (interactive)
  (if (not (eq last-command this-command))
      (progn
        (set-frame-parameter nil 'font "-*-Courier New-normal-r-*-
*-14-112-96-96-c-*-iso8859-1")
        (put this-command 'state "2"))
    (cond
     ((string= (get this-command 'state) "1")
      (set-frame-parameter nil 'font "-*-Courier New-normal-r-*-
*-13-112-96-96-c-*-iso8859-1") (put this-command 'state "2"))
     ((string= (get this-command 'state) "2" )
      (set-frame-parameter nil 'font "-outline-Lucida Sans Unicode-
normal-normal-normal-sans-13-*-*-*-p-*-iso8859-1") (put this-command
'state "3"))
     ((string= (get this-command 'state) "3")
      (set-frame-parameter nil 'font "-outline-Code2000-normal-normal-
normal-*-13-*-*-*-p-*-iso8859-1") (put this-command 'state "1"))
     )
    )
  )


(global-set-key (kbd "<C-f9>") 'cycle-font)

This is for Windows Vista machine. Press a button it'll cycle among 3
fonts. Mostly for the purpose of switching between mono-width courier
and variable-width lucida.

The Code2000 is there just for the occation of viewing some unicode.
Code2000 is so bad that it renders ascii dash/hyphen as invisible if
the font size is not huge.

Code2000 is not part of Windows Vista. You have to downloaded it, i
wouldn't recommend it, just that i happened to already did and that
seems to be the font containing the most unicode

the elisp dealing is also painful, or, much less than ideal. Here's a
outline of my problem.

So, Drew showed me this

(set-frame-parameter nil 'font "-*-Courier New-normal-r-*-
*-14-112-96-96-c-*-iso8859-1")

which is great. So, i wanted Lucida. So, logically, i replaced the
courier name to lucida like this:

(set-frame-parameter nil 'font "-*-Lucida Sans Unicode-normal-r-*-
*-14-112-96-96-c-*-iso8859-1")

but emacs spits out error. I didn't know what those 112, 96, 96 are,
so i figured i replace them with asterisk. Tried a few variations, no
go. After a while, i found this works:

(set-frame-parameter nil 'font "Lucida Sans Unicode")
(set-frame-parameter nil 'font "courier new")
(set-frame-parameter nil 'font "Fixedsys")
(set-frame-parameter nil 'font "FixedsysTTF")

but i do need to set size because the size spec is not equivalent
among fonts. e.g. One font at size 14 will be too large/small for
another font at 14.

So i need something like.:

(set-frame-parameter nil 'font "Lucida Sans Unicode" 'size 12)

after looking up some inline doc or elisp doc in few min, i can't find
out what's the available parms for set-frame-parameter. But i did find
this function:

(frame-parameters)

which gives out all the params/value pairs in a frame. So, after a
while finding no easier way, i went thru the rather tedious process of
using the menu to set a font, then run the frame-parameters and get
the value of the font. So, i get the right font string spec for the
fonts i want. e.g.

"-*-Courier New-normal-r-*-*-13-112-96-96-c-*-iso8859-1"
"-outline-Lucida Sans Unicode-normal-normal-normal-sans-13-*-*-*-p-*-
iso8859-1"
"-outline-Code2000-normal-normal-normal-*-15-*-*-*-p-*-iso8859-1"
"-raster-Fixedsys-normal-normal-normal-mono-15-*-*-*-c-*-iso8859-1"
"-outline-FixedsysTTF-semi-bold-normal-normal-mono-16-*-*-*-c-*-
iso8859-1"

btw, in my haphazard notes i found font-spec, e.g..

(font-spec :family "Unicode Symbols" :size 24)

which turns out not useful here.

now i got cycle-font, next job when i have time would be setting
monospaced font whenever dired is opened or calendar (recently someone
asked for that, which prob means lots others have the same
question)... and also the job of getting all unicode to show...

---------------

ok a question. Is there a doc that list all the params of set-frame-
parameter?

i've not attempted to read the elisp doc for the frame section or font/
faces section in some cover-to-cover manner... well eventually i'll
have to do that.

the cycle-font command above can be improved too... not happy with the
state cycle code... hackish.

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: getting unicode chars to show on Windows
  2009-08-29 16:22                   ` Xah Lee
@ 2009-08-30 17:38                     ` Jason Rumney
  2009-08-31 15:23                     ` Drew Adams
  1 sibling, 0 replies; 19+ messages in thread
From: Jason Rumney @ 2009-08-30 17:38 UTC (permalink / raw)
  To: help-gnu-emacs

On Aug 30, 12:22 am, Xah Lee <xah...@gmail.com> wrote:

> (set-frame-parameter nil 'font "Lucida Sans Unicode")
> (set-frame-parameter nil 'font "courier new")
> (set-frame-parameter nil 'font "Fixedsys")
> (set-frame-parameter nil 'font "FixedsysTTF")
>
> but i do need to set size because the size spec is not equivalent
> among fonts. e.g. One font at size 14 will be too large/small for
> another font at 14.

(set-frame-parameter nil 'font "Lucida Sans Unicode-12")

Appendix C.7 in the Emacs manual contains a section about font names.
It is a bit X specific - stating which naming schemes work for Xft and
X fonts, but on Windows the first three methods should work.


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

* RE: getting unicode chars to show on Windows
  2009-08-29 16:22                   ` Xah Lee
  2009-08-30 17:38                     ` Jason Rumney
@ 2009-08-31 15:23                     ` Drew Adams
  1 sibling, 0 replies; 19+ messages in thread
From: Drew Adams @ 2009-08-31 15:23 UTC (permalink / raw)
  To: 'Xah Lee', help-gnu-emacs

> > M-: (frame-parameters) is your friend.
>
> after looking up some inline doc or elisp doc in few min, i can't find
> out what's the available parms for set-frame-parameter. But i did find
> this function:
> 
> (frame-parameters)

Reading is your friend too. ;-)

If you prefer to ask here rather than reading the manuals, then maybe read the
replies you get? ;-)

> Is there a doc that list all the params of set-frame-parameter?

`C-h i', choose Elisp manual
`i frame-parameter' gives a short node with the parameter access functions

Node `Frame Parameters' is the chapter on parameters. Its sections:

* Parameter Access - the node reached from `i frame-parameter'

* Initial Parameters - alists for defining future frames

* Window Frame Parameters - most frame parameters, described individually

* Size and Position - access shortcuts for the size/position params described in
Window Frame Parameters

* Geometry - for use with XResources (X-Window geometry specs) 

Again, reading is your friend. ;-)

Note: There cannot be an exhaustive list of frame parameters, because you can
add your own, interpreted by your own code to do what you want. There are also a
few "internal" frame parameters (nothing in Emacs is really internal) that are
not documented much, if at all.






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

end of thread, other threads:[~2009-08-31 15:23 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-25  6:20 getting unicode chars to show on Windows Xah Lee
2009-08-25 17:16 ` B. T. Raven
2009-08-25 18:31 ` Eli Zaretskii
2009-08-26  5:48   ` AW: " Christian.Strobl
2009-08-26  5:50   ` Christian.Strobl
     [not found] ` <mailman.5342.1251225106.2239.help-gnu-emacs@gnu.org>
2009-08-25 22:38   ` B. T. Raven
2009-08-25 22:42     ` B. T. Raven
2009-08-26  3:21     ` Eli Zaretskii
     [not found]     ` <mailman.5389.1251256888.2239.help-gnu-emacs@gnu.org>
2009-08-26 11:35       ` Xah Lee
2009-08-26 22:09         ` Jason Rumney
2009-08-27 18:36           ` Xah Lee
2009-08-28 10:40             ` Florian Beck
     [not found]             ` <mailman.5571.1251456046.2239.help-gnu-emacs@gnu.org>
2009-08-28 14:00               ` Xah Lee
2009-08-28 23:40                 ` Florian Beck
2009-08-29  0:20                 ` Drew Adams
     [not found]                 ` <mailman.5608.1251505221.2239.help-gnu-emacs@gnu.org>
2009-08-29 16:22                   ` Xah Lee
2009-08-30 17:38                     ` Jason Rumney
2009-08-31 15:23                     ` Drew Adams
2009-08-27  3:22         ` Eli Zaretskii

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