* bug#29631: 25.3; Unable to use custom fontset as frame default font
@ 2017-12-09 21:32 Thomas Morgan
2017-12-10 17:28 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Morgan @ 2017-12-09 21:32 UTC (permalink / raw)
To: 29631
I started Emacs with `emacs -Q', entered the following expression
in *scratch*, and evaluated it with C-M-x:
(progn
;; Create a new fontset called fontset-liberation.
(create-fontset-from-fontset-spec
"-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation")
;; Set its primary font to Liberation Mono.
(set-fontset-font "fontset-liberation" 'unicode-bmp "Liberation Mono")
;; Add a fallback to Freemono for characters that Liberation Mono lacks.
(set-fontset-font "fontset-liberation" 'unicode-bmp "Freemono:size=40"
nil 'append)
;; Set the frame's default font to the new fontset.
(set-face-font 'default "fontset-liberation")
;; Return font objects for "a", an ASCII character that Liberation Mono has,
;; and "ȷ" (LATIN SMALL LETTER DOTLESS J), a character in Freemono but
;; not in Liberation Mono.
(list (font-at 0 nil "a") (font-at 0 nil "ȷ")))
The result was this:
(#<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1">
#<font-object "-1ASC-Liberation Serif-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1">)
The font for ASCII character "a" was Liberation Mono as expected, but
I expected the second font to be Freemono and it was Liberation Serif.
I checked which fontset is being used as default:
(face-attribute 'default :fontset)
It's fontset-auto1, not fontset-liberation:
"-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-fontset-auto1"
I typed `M-x describe-fontset RET fontset-auto1 RET'.
Fontset: -1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-fontset-auto1
CHAR RANGE (CODE RANGE)
FONT NAME (REQUESTED and [OPENED])
C-@ .. (#x43 .. #x9F)
-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
.. ɏ (#xA0 .. #x24F)
-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
[-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1]
[-1ASC-Liberation Serif-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1]
ɐ .. [#x3FFF7F] (#x250 .. #x3FFF7F)
-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
[\200] .. [\377] (#x3FFF80 .. #x3FFFFF)
-*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
---<fallback to the default fontset>---
[...]
(Non-UTF8 characters are replaced with representations in brackets.)
So fontset-auto1 includes Liberation Serif but not Freemono.
fontset-auto1 seems to be generated from fontset-liberation's primary
font without regard for its fallback fonts.
To test whether changing the fallback font in fontset-auto1 has
an effect, I restarted Emacs with `emacs -Q' and evaluated the
following expression, which modifies fontset-auto1 instead of
fontset-liberation.
(progn
;; Create a new fontset called fontset-liberation.
(create-fontset-from-fontset-spec
"-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation")
;; Set the frame's default font to the new fontset.
(set-face-font 'default "fontset-liberation")
;; Set the frame's primary font to Liberation Mono.
(set-fontset-font "fontset-auto1" 'unicode-bmp "Liberation Mono")
;; Add a fallback to Freemono for characters that Liberation Mono lacks.
(set-fontset-font "fontset-auto1" 'unicode-bmp "Freemono:size=40"
nil 'append)
;; Return font objects for "a", an ASCII character that Liberation Mono has,
;; and "ȷ" (LATIN SMALL LETTER DOTLESS J), a character in Freemono but
;; not in Liberation Mono.
(list (font-at 0 nil "a") (font-at 0 nil "ȷ")))
This changed the font for the non-ASCII character to Freemono
and returned what I expected:
(#<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1">
#<font-object "-GNU -FreeMono-normal-normal-normal-*-40-*-*-*-m-0-iso10646-1">)
(Incidentally, evaluating the above progn without restarting Emacs
causes a core dump, but I have a smaller test case for that and I'll
make another report about it.)
It looks as if fontset-auto1 is generated by fontset_from_font
in fontset.c, but I don't understand why the specified fontset
(fontset-liberation) is not used and I haven't been able to find
anything in the manual that clarifies this behavior. I'd like
to know how to use a custom fontset for a frame's default face
(and for other faces), but if that's not supported, this may be
a documentation bug.
Information from report-emacs-bug:
In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
of 2017-11-05 built on localhost
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
Configured using:
'configure --disable-dependency-tracking
--prefix=/nix/store/7px74nmmy9wnl594jsk0lcgz1ygsbwfj-emacs-25.3
--with-modules --with-x-toolkit=gtk3 --with-xft'
Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES
Important settings:
value of $LC_ALL: en_US.utf8
value of $LC_COLLATE: C
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: Lisp Interaction
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
(#<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1"> #<font-object "-GNU -FreeMono-normal-normal-normal-*-40-*-*-*-m-0-iso10646-1">)
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)
Memory information:
((conses 16 87168 5967)
(symbols 48 19960 0)
(miscs 40 56 121)
(strings 32 14566 4561)
(string-bytes 1 435478)
(vectors 16 11914)
(vector-slots 8 439170 4779)
(floats 8 166 74)
(intervals 56 242 21)
(buffers 976 18))
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#29631: 25.3; Unable to use custom fontset as frame default font
2017-12-09 21:32 bug#29631: 25.3; Unable to use custom fontset as frame default font Thomas Morgan
@ 2017-12-10 17:28 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2017-12-10 17:28 UTC (permalink / raw)
To: Thomas Morgan, Kenichi Handa; +Cc: 29631
> From: Thomas Morgan <tlm@ziiuu.com>
> Date: Sat, 09 Dec 2017 16:32:39 -0500
>
> I started Emacs with `emacs -Q', entered the following expression
> in *scratch*, and evaluated it with C-M-x:
>
> (progn
> ;; Create a new fontset called fontset-liberation.
> (create-fontset-from-fontset-spec
> "-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation")
>
> ;; Set its primary font to Liberation Mono.
> (set-fontset-font "fontset-liberation" 'unicode-bmp "Liberation Mono")
>
> ;; Add a fallback to Freemono for characters that Liberation Mono lacks.
> (set-fontset-font "fontset-liberation" 'unicode-bmp "Freemono:size=40"
> nil 'append)
>
> ;; Set the frame's default font to the new fontset.
>
> (set-face-font 'default "fontset-liberation")
>
> ;; Return font objects for "a", an ASCII character that Liberation Mono has,
> ;; and "ȷ" (LATIN SMALL LETTER DOTLESS J), a character in Freemono but
> ;; not in Liberation Mono.
> (list (font-at 0 nil "a") (font-at 0 nil "ȷ")))
>
> The result was this:
>
> (#<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1">
> #<font-object "-1ASC-Liberation Serif-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1">)
>
> The font for ASCII character "a" was Liberation Mono as expected, but
> I expected the second font to be Freemono and it was Liberation Serif.
>
> I checked which fontset is being used as default:
>
> (face-attribute 'default :fontset)
>
> It's fontset-auto1, not fontset-liberation:
>
> "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-fontset-auto1"
>
> I typed `M-x describe-fontset RET fontset-auto1 RET'.
>
> Fontset: -1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-fontset-auto1
> CHAR RANGE (CODE RANGE)
> FONT NAME (REQUESTED and [OPENED])
> C-@ .. (#x43 .. #x9F)
> -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
> .. ɏ (#xA0 .. #x24F)
> -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
> [-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1]
> [-1ASC-Liberation Serif-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1]
> ɐ .. [#x3FFF7F] (#x250 .. #x3FFF7F)
> -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
> [\200] .. [\377] (#x3FFF80 .. #x3FFFFF)
> -*-*-*-*-*-*-*-*-*-*-*-*-iso10646-1
>
> ---<fallback to the default fontset>---
> [...]
>
> (Non-UTF8 characters are replaced with representations in brackets.)
>
> So fontset-auto1 includes Liberation Serif but not Freemono.
> fontset-auto1 seems to be generated from fontset-liberation's primary
> font without regard for its fallback fonts.
>
> To test whether changing the fallback font in fontset-auto1 has
> an effect, I restarted Emacs with `emacs -Q' and evaluated the
> following expression, which modifies fontset-auto1 instead of
> fontset-liberation.
>
> (progn
> ;; Create a new fontset called fontset-liberation.
> (create-fontset-from-fontset-spec
> "-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation")
>
> ;; Set the frame's default font to the new fontset.
> (set-face-font 'default "fontset-liberation")
>
> ;; Set the frame's primary font to Liberation Mono.
> (set-fontset-font "fontset-auto1" 'unicode-bmp "Liberation Mono")
>
> ;; Add a fallback to Freemono for characters that Liberation Mono lacks.
> (set-fontset-font "fontset-auto1" 'unicode-bmp "Freemono:size=40"
> nil 'append)
>
> ;; Return font objects for "a", an ASCII character that Liberation Mono has,
> ;; and "ȷ" (LATIN SMALL LETTER DOTLESS J), a character in Freemono but
> ;; not in Liberation Mono.
> (list (font-at 0 nil "a") (font-at 0 nil "ȷ")))
>
> This changed the font for the non-ASCII character to Freemono
> and returned what I expected:
>
> (#<font-object "-1ASC-Liberation Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1">
> #<font-object "-GNU -FreeMono-normal-normal-normal-*-40-*-*-*-m-0-iso10646-1">)
>
> (Incidentally, evaluating the above progn without restarting Emacs
> causes a core dump, but I have a smaller test case for that and I'll
> make another report about it.)
>
> It looks as if fontset-auto1 is generated by fontset_from_font
> in fontset.c, but I don't understand why the specified fontset
> (fontset-liberation) is not used and I haven't been able to find
> anything in the manual that clarifies this behavior. I'd like
> to know how to use a custom fontset for a frame's default face
> (and for other faces), but if that's not supported, this may be
> a documentation bug.
CC'ing Handa-san in the hope that he could provide some insights.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-10 17:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-09 21:32 bug#29631: 25.3; Unable to use custom fontset as frame default font Thomas Morgan
2017-12-10 17:28 ` Eli Zaretskii
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.