From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Error when using Unifont and trying to launch M-x term Date: Thu, 16 May 2024 10:03:02 +0300 Message-ID: <86eda2jl21.fsf@gnu.org> References: <8684bb0021409771f1532cee9cb0424f@rodrigomorales.site> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8156"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 16 09:04:24 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s7VA7-0001vJ-Uh for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 16 May 2024 09:04:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s7V92-0007Gu-Nk; Thu, 16 May 2024 03:03:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7V90-0007GF-Qm for help-gnu-emacs@gnu.org; Thu, 16 May 2024 03:03:14 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s7V90-00005e-HM for help-gnu-emacs@gnu.org; Thu, 16 May 2024 03:03:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=3Lq6cikW+TQgWGTKW1ZkUiAibElAPymKC1eb3m8CsLY=; b=bYnqujDVluIEMydhvnCD tAjXoBfkVg91rToW4NFxht0TEiFHk8jNVXvjoacLn0Nh19HIE8KtmS7wYd5r2+GRXl8DpxSZmdisQ QHVzv4qDZaCJvaIhXOzcBXWHXwYoeYMTdNQUBmgX4RckdMMrWyimyzQjbZjmRnYxESoogCMHWhUFc Ra8UGPOxoTVMACqjyhqitBcCZWUn56fmtJ7Eb2jYhLjqrNShMWk0bAoRbWjbVvPJwoYPRnGz+nIWT BdFIog2ralzcO8jHW3AqMWoeG9oKAKz8p+hrVkovDUKpP6SfeqyzY59csOcp7EFkJb34pfk8Gu//f 2054wjrv4LRqcw==; In-Reply-To: <8684bb0021409771f1532cee9cb0424f@rodrigomorales.site> (message from Rodrigo Morales on Wed, 15 May 2024 14:46:11 -0500) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146769 Archived-At: > Date: Wed, 15 May 2024 14:46:11 -0500 > From: Rodrigo Morales > > > > I downloaded the file =unifont-15.1.05.pcf.gz= from https://unifoundry.com/unifont/index.html . I decompressed it using =gunzip= and moved the file to =~/.fonts=. Afterwards, I executed =fc-cache -f=. > > I started Emacs using =$ emacs -Q=. I evaluated the following sexp to change the default font. > > #+BEGIN_SRC elisp > (progn > (set-fontset-font "fontset-startup" '(#x000000 . #x3FFFFF) "Unifont") > (set-fontset-font "fontset-default" '(#x000000 . #x3FFFFF) "Unifont")) > #+END_SRC > > I executed =M-x term=, and I got the message =window-max-chars-per-line: Invalid font name: -GNU-Unifont-medium-normal-normal-Sans-Serif-16-*-*-*-c-80-iso10646-1= in the minibuffer and =term= wasn't started. I tried executing =M-x term= again but the same message was shown and =term= wasn't started. > > The backtrace is shown below. I obtained by starting =emacs -Q= again, enabling =toggle-debug-on-error=, evaluating the same sexp shown above for changing the default font, and executing =M-x term=. > > #+BEGIN_SRC text > Debugger entered--Lisp error: (error "Invalid font name: -GNU-Unifont-medium-normal-norm...") > window-font-width(nil nil) > window-max-chars-per-line() > term-mode() > make-term("terminal" "/bin/zsh" nil) > term("/bin/zsh") > funcall-interactively(term "/bin/zsh") > command-execute(term record) > execute-extended-command(nil "term" "term") > funcall-interactively(execute-extended-command nil "term" "term") > command-execute(execute-extended-command) > #+END_SRC > > Why am I getting that error? Maybe because you are setting up your fonts and fontsets incorrectly? For example, you cannot affect the default font, the one used for the ASCII characters, via set-fontset-font, at least not in the naïve way you are doing that. Instead, you should do it the "traditional" way, by adding this: (add-to-list 'default-frame-alist '(font . "Unifont")) to your init file, and then tell Emacs (again in the init file) that Unifont should be used for the entire Unicode space of non-ASCII characters: (set-fontset-font t 'unicode "Unifont" nil 'prepend) In addition, you may need to customize face-font-family-alternatives, and specifically the alternatives for "Sans Serif" (not sure about this, but that's where the "-Sans-Serif" suffix above might be coming from), if the above two measures are still not enough. Please try the above, and if it also produces an error, report a bug using "M-x report-emacs-bug RET", with all the details. P.S. Let me just note, and I will only do this once, that doing all of that just to have all the lines in "M-x term" be the same height in 110% of cases is IMNSHO too much effort for a little gain. Your time and energy will be spent much better by looking at fonts for characters that make the line height higher, then finding alternative fonts for those characters which don't have that effect, and configuring your fontset to use those better fonts for those problematic characters. As a nice bonus, this will leave you with much nicer fonts than Unifont can ever be.