* How does fontset work in emacs?
@ 2012-12-31 2:14 winterTTr
2013-01-04 21:31 ` Peter Dyballa
0 siblings, 1 reply; 2+ messages in thread
From: winterTTr @ 2012-12-31 2:14 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 2356 bytes --]
I read some documentation about font configuration in Emacs, I found two
concept, which areFONT andFONTSET. Currently, my understanding is that,
fontset is a set of font which are grouped by thescript( aka encoding ),
and we can create a fontset and specify some set of chars to use specific
font.
But until now, some experiments code does not always work as I wish, so I
want to find what's the problem is?
First, I create my own fontset
(create-fontset-from-fontset-spec
"-outline-Cousine-normal-normal-normal-*-*-*-*-*-*-*-fontset-Consolas")
Then I want to use it as current emacs fontset( or is this possible? I am
not sure), the following code seems works:
(set-frame-font "fontset-Consolas" nil t)
Then I try to customize my fontset for some specific character or encoding:
(set-fontset-font "fontset-Consolas" 'han "Microsoft YaHei" nil 'prepend)
However, it's pity that this does not work, and the char in 'han category
do not change its font. Then I got some sample code and try the following
one:
(set-fontset-font "fontset-Default" 'han "Microsoft YaHei" nil 'prepend)
This time, it works, the char in 'han category use the correct font. But
why i need to change fontset-default instead of my fontset-consolas. Then I
try to revert my change, with following code:
(set-fontset-font "fontset-Default" 'han "Consolas" nil 'prepend)
However, the 'han category char remains the same, which I expect these char
should not display correctly, as I use a font does not contains those char.
Why does changing fontset-default not work this time?
Besides the code above, some more universal question:
1. How to change the emacs default fontset to my own one, is it possible?
2. Is multi fontset works at the same time or only one fontset work? Why
my test code need to changedefault instead of mine?
3. The set-fontset-font second parameter is target, how can I know which
script name is suitable for the char under current cursor. I can use
describe-char to display the char information, but I don't find which
word in this description is the correct one for that target param.
4. Some points worthy of notice for font configuration in emacs?
My question is kind of lengthy, so thanks for your patient and share your
suggestion.
BTW, the char that I used to test is #x6d4b, it's a chinese character.
-winterTTr
[-- Attachment #2: Type: text/html, Size: 14499 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: How does fontset work in emacs?
2012-12-31 2:14 How does fontset work in emacs? winterTTr
@ 2013-01-04 21:31 ` Peter Dyballa
0 siblings, 0 replies; 2+ messages in thread
From: Peter Dyballa @ 2013-01-04 21:31 UTC (permalink / raw)
To: winterTTr; +Cc: help-gnu-emacs
Am 31.12.2012 um 03:14 schrieb winterTTr:
> 1. How to change the emacs default fontset to my own one, is it possible?
I wouldn't try that but create my own fontset – if necessary (because a good fonts service delivers what GNU Emacs requests). I created fontsets like this (and much more complicated):
(create-fontset-from-fontset-spec "-b&h-lucida console-medium-r-*-*-9-*-*-*-*-*-fontset-09pt_lucida_console" t 'noerror)
(set-fontset-font "fontset-09pt_lucida_console" 'latin-iso8859-1 '("lucida console" . "iso8859-1"))
(set-fontset-font "fontset-09pt_lucida_console" 'latin-iso8859-2 '("lucida console" . "iso8859-2"))
(set-fontset-font "fontset-09pt_lucida_console" 'latin-iso8859-3 '("lucida console" . "iso8859-3"))
(set-fontset-font "fontset-09pt_lucida_console" 'latin-iso8859-4 '("lucida console" . "iso8859-4"))
(set-fontset-font "fontset-09pt_lucida_console" 'cyrillic-iso8859-5 '("lucida console" . "iso8859-5"))
(set-fontset-font "fontset-09pt_lucida_console" 'latin-iso8859-9 '("lucida console" . "iso8859-9"))
(set-fontset-font "fontset-09pt_lucida_console" 'latin-iso8859-15 '("lucida console" . "iso8859-15"))
(set-fontset-font "fontset-09pt_lucida_console" 'mule-unicode-0100-24ff '("lucida console" . "iso10646-1"))
(set-fontset-font "fontset-09pt_lucida_console" 'mule-unicode-2500-33ff '("lucida console" . "iso10646-1"))
(set-fontset-font "fontset-09pt_lucida_console" 'mule-unicode-e000-ffff '("lucida console" . "iso10646-1"))
(I now rely on font service.) When you've done that you can then use initial-frame-alist and default-frame-alist to "bind" the fontset to the frames. (I do it now like that: (font . "Lucida Sans Typewriter-8").)
> 2. Is multi fontset works at the same time or only one fontset work? Why
> my test code need to changedefault instead of mine?
At least it worked in GNU Emacsen 22 and 23 with more than one fontset. You just have to choose one and make it active in that frame. S-down-mouse-1 (mouse-appearance-menu) will offer you a menu from which you can choose any of your defined fontsets.
> 3. The set-fontset-font second parameter is target, how can I know which
> script name is suitable for the char under current cursor. I can use
> describe-char to display the char information, but I don't find which
> word in this description is the correct one for that target param.
I think the names, as based on the Character Blocks names in Unicode, are defined in the variable script-representative-chars.
> 4. Some points worthy of notice for font configuration in emacs?
Better use the well configured fonts service of your system!
--
Greetings
Pete
~ o
~_\\_/\
~ O O
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-04 21:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-31 2:14 How does fontset work in emacs? winterTTr
2013-01-04 21:31 ` Peter Dyballa
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).