bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29630: 25.3; Unable to change fontset using :family face attribute


From: Thomas Morgan
Subject: bug#29630: 25.3; Unable to change fontset using :family face attribute
Date: Sat, 09 Dec 2017 16:26:48 -0500

I started Emacs with `emacs -Q' and created a new fontset by entering
the following expression in *scratch* and evaluating it with C-M-x.

  (create-fontset-from-fontset-spec
   "-*-Liberation Mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation")

I wanted to use this as the default font for the frame so I checked
the Emacs Lisp manual.  Section 37.12.1, Face Attributes, explains 
the :family attribute:

  Font family or fontset (a string).  See (emacs)Fonts, for more
  information about font families.  The function `font-family-list'
  (see below) returns a list of available family names.
  See (elisp)Fontsets, for information about fontsets.

According to this, a string representing a fontset can be used
as the value of the :family attribute.

I tried using the fontset alias "fontset-liberation" by evaluating
the following expression in *scratch* as above.

  (progn
    (set-face-attribute 'default nil :family "fontset-liberation")
    (font-at 0 nil "a"))

This changed the frame's font to something other than Liberation Mono
and returned:

  #<font-object "-CYRE-Podkova-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1">

I expected it to be Liberation Mono.

I thought perhaps the problem was that I used the fontset alias
rather than the fontset name, so I tried the fontset name instead:

  (progn
    (set-face-attribute 'default nil :family
                        "-*-liberation 
mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation")
    (font-at 0 nil "a"))

This signaled an error: "Invalid face foundry".

I checked the manual again and read the sections linked to from the
quote above: (emacs)Fonts and (elisp)Fontsets.  They don't seem to
explain how to specify a fontset with the :family face attribute.

The documentation for the :font attribute doesn't say that it can 
be a fontset.  But (elisp)Font and Color Parameters says the `font'
frame parameter can be the name of a fontset and the frame parameter 
is "equivalent to the `font' attribute of the `default' face".  So 
one can infer that the :font attribute of a face can be a fontset 
name.  I tested this:

  (progn
    (set-face-attribute 'default nil :font
                        "-*-liberation 
mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation")
    (font-at 0 nil "a"))

This changes the font to Liberation Mono as expected:

  #<font-object "-1ASC-Liberation 
Mono-normal-normal-normal-*-15-*-*-*-m-0-iso10646-1">

I also tried equivalent expressions with set-face-font and
using the fontset alias, all of which succeeded.

The font is correct but the fontset is actually fontset-auto1, 
not fontset-liberation.  I'll make another report about that.

I think the documentation for the :family attribute should be 
changed to explain how to refer to a fontset if it's possible
to do that.  If it's not possible to specify a fontset with the
:family attribute, the text about fontsets should be removed.

Here is 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
"-*-liberation mono-normal-normal-normal-*-*-*-*-*-m-0-fontset-liberation"
Mark set
#<font-object "-CYRE-Podkova-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1">
Mark set
Entering debugger...
Back to top level
Mark set
#<font-object "-1ASC-Liberation 
Mono-normal-normal-normal-*-15-*-*-*-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 mail-prsvr mail-utils
help-mode easymenu cl-loaddefs pcase cl-lib debug 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 100076 5220)
 (symbols 48 21018 0)
 (miscs 40 3069 127)
 (strings 32 18822 4645)
 (string-bytes 1 764635)
 (vectors 16 15076)
 (vector-slots 8 511125 5409)
 (floats 8 167 42)
 (intervals 56 249 0)
 (buffers 976 18))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]