From: Eli Zaretskii <eliz@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Error when using Unifont and trying to launch M-x term
Date: Thu, 16 May 2024 10:03:02 +0300 [thread overview]
Message-ID: <86eda2jl21.fsf@gnu.org> (raw)
In-Reply-To: <8684bb0021409771f1532cee9cb0424f@rodrigomorales.site> (message from Rodrigo Morales on Wed, 15 May 2024 14:46:11 -0500)
> Date: Wed, 15 May 2024 14:46:11 -0500
> From: Rodrigo Morales <me@rodrigomorales.site>
>
>
>
> 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.
next prev parent reply other threads:[~2024-05-16 7:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-15 19:46 Error when using Unifont and trying to launch M-x term Rodrigo Morales
2024-05-16 7:03 ` Eli Zaretskii [this message]
2024-05-16 19:43 ` Rodrigo Morales
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86eda2jl21.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.