From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Shuguang Sun <shuguang79@qq.com>
Newsgroups: gmane.emacs.help
Subject: Re: Font setting for runemacs and frame
Date: Thu, 14 Feb 2019 23:28:08 +0800
Message-ID: <35790.6146253058$1550159077@news.gmane.org>
References: <vk5yr2cdgw73.fsf@qq.com> <83lg2louan.fsf@gnu.org>
	<vk5yimxo9xlw.fsf@qq.com> <838sykpd8a.fsf@gnu.org>
	<vk5ybm3g2s3t.fsf@qq.com> <83lg2io1hi.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="194824"; mail-complaints-to="usenet@blaine.gmane.org"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)
Cc: help-gnu-emacs@gnu.org
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Feb 14 16:44:33 2019
Return-path: <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geh-help-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256)
	(Exim 4.89)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1guJBg-000oYB-U3
	for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Feb 2019 16:44:33 +0100
Original-Received: from localhost ([127.0.0.1]:50481 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>)
	id 1guJBf-000755-Jt
	for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Feb 2019 10:44:31 -0500
Original-Received: from eggs.gnu.org ([209.51.188.92]:56469)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <shuguang79@qq.com>) id 1guIwM-0003wH-Kv
	for help-gnu-emacs@gnu.org; Thu, 14 Feb 2019 10:28:44 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <shuguang79@qq.com>) id 1guIwJ-0007Wi-V0
	for help-gnu-emacs@gnu.org; Thu, 14 Feb 2019 10:28:42 -0500
Original-Received: from [103.7.28.233] (port=23437 helo=smtpbg65.qq.com)
	by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <shuguang79@qq.com>) id 1guIwI-0007JC-Uw
	for help-gnu-emacs@gnu.org; Thu, 14 Feb 2019 10:28:39 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qq.com; s=s201512;
	t=1550158092; bh=2ckGpd0cKUt/voOPpsAoqqDHMJMC8UjsPd720gu1Ok4=;
	h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:MIME-Version:Content-Type;
	b=y7qceuZ9Us7h28yGb/BzCLKzH/tUnBXgTJWoxDWt7z66oOurWjuietc6Ow7NtH00b
	tciX97MTYbHvdnXEaGvLsh1lGMEbTZidsb/vJJDDSs0wLUV0O3RZjI48cIkEfZtqkE
	H/r1n4jcaMfddWt/YYkvvCR1JNLzlWVR/NareCeA=
X-QQ-mid: esmtp5t1550158091tzlpbr05f
Original-Received: from rshmx11052 (unknown [211.144.221.1])
	by esmtp4.qq.com (ESMTP) with 
	id ; Thu, 14 Feb 2019 23:28:10 +0800 (CST)
X-QQ-SSF: 01000000000000F0F4200F00000000G
X-QQ-FEAT: 0ZH8o+qZJ13HiN86lttrklBjD78f36TIiW6uKagUzjgK97z+/HRtMenWC7Vsc
	hrkCgu7WkXSC4mzR1KGjLD4I85knqaGEHHEQjFLYDar9bQ1ngCVKBweUWr1iy+n3bdPZW2O
	FD9e7WDh3kPTpiE7lShdAxJfCLlNBLlKLBxa20L8LXGXCMuPNvtD5RPBA3gm/STo0iEtNfj
	2eX9IPeMWz6vChh7I+WC4FHljb+m7YDlMSlsr6IImC90K8LShq60Ug/cNCgbJ0g6pXQuSgF
	F4UZX3MaUyAba7hDPSjd0t3f8HGcMlWVxb3g==
X-QQ-GoodBg: 0
In-Reply-To: <83lg2io1hi.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Feb
	2019 17:04:25 +0200")
X-QQ-SENDSIZE: 520
Feedback-ID: esmtp:qq.com:bgforeign:bgforeign4
X-QQ-Bgrelay: 1
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x
X-Received-From: 103.7.28.233
X-BeenThere: help-gnu-emacs@gnu.org
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: Users list for the GNU Emacs text editor <help-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/help-gnu-emacs/>
List-Post: <mailto:help-gnu-emacs@gnu.org>
List-Help: <mailto:help-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/help-gnu-emacs>,
	<mailto:help-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "help-gnu-emacs"
	<help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.help:119403
Archived-At: <http://permalink.gmane.org/gmane.emacs.help/119403>

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Shuguang Sun <shuguang79@qq.com>
>> Cc: help-gnu-emacs@gnu.org
>> Date: Wed, 13 Feb 2019 13:08:06 +0800
>> 
>> (cl-pushnew '(w32 (font . "Consolas-16"))
>>             window-system-default-frame-alist)
>> 
>> or 
>> 
>> (add-to-list 'default-frame-alist '(font . "Consolas-16"))
>> 
>> To set the default font as Consolas-16 in w32 system.
>
> This will only work for frames other than the first frame.
>
>> To specify font for fontset, cjk etc., I use the code below and actually
>> make it a function and call it in after-make-frame-functions (new frame
>> in daemon mode) or call it after-init-hook (intended for runemacs with
>> `if (not (daemonp))`).
>> 
>> (dolist (charset '(kana han cjk-misc bopomofo chinese-gbk gb18030))
>>   (set-fontset-font nil charset
>>                     (font-spec :family "Microsoft Yahei")
>>                     nil 'prepend))
>
> Why do you need to call this in a hook?  Why not just at top level of
> your .emacs file?

Years ago, it didn't work for server or daemon, and I tried the hook way.
Now it seems to work well.

>
>> However with the setting of window-system-default-frame-alist or
>> default-frame-alist above, it takes no effect until I make a new frame
>> (after-make-frame-functions).
>
> This is documented behavior: to modify the looks ofg the first frame,
> you need to set initial-frame-alist in addition to
> default-frame-alist.
>
>
Thanks! Now I understand.

-- 
Best Regards
Shuguang Sun