unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 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

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