help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getting unicode chars to show on Windows


From: Florian Beck
Subject: Re: getting unicode chars to show on Windows
Date: Sat, 29 Aug 2009 01:40:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Xah Lee <address@hidden> 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 <address@hidden> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]