unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36288: 27.0.50; Cannot use menu-set-font
@ 2019-06-19  7:48 Robert Pluim
  2019-06-20  2:54 ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Pluim @ 2019-06-19  7:48 UTC (permalink / raw)
  To: 36288

emacs -Q
M-x menu-set-font
select Ubuntu Mono Regular =>

"set-face-attribute: Font not available: #<font-spec xft nil Ubuntu\ Mono nil nil normal normal nil 10.0 nil nil nil ((:name . "Ubuntu Mono"))>"

I can select Ubuntu Mono using M-x customize-face. Why does
menu-set-font try to use an xft spec?

(frame-parameter nil 'font-backend) =>
(xfthb x)



In GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2019-06-19
Repository revision: 50c5d5621cb5e6d7c86829ac4b776d81e47b2189
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description: Ubuntu 18.04.2 LTS

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS PDUMPER LCMS2 GMP





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-19  7:48 bug#36288: 27.0.50; Cannot use menu-set-font Robert Pluim
@ 2019-06-20  2:54 ` YAMAMOTO Mitsuharu
  2019-06-20  7:51   ` Robert Pluim
  2019-06-23  6:34   ` YAMAMOTO Mitsuharu
  0 siblings, 2 replies; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2019-06-20  2:54 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 36288

On Wed, 19 Jun 2019 16:48:04 +0900,
Robert Pluim wrote:
> 
> emacs -Q
> M-x menu-set-font
> select Ubuntu Mono Regular =>
> 
> "set-face-attribute: Font not available: #<font-spec xft nil Ubuntu\ Mono nil nil normal normal nil 10.0 nil nil nil ((:name . "Ubuntu Mono"))>"
> 
> I can select Ubuntu Mono using M-x customize-face. Why does
> menu-set-font try to use an xft spec?
> 
> (frame-parameter nil 'font-backend) =>
> (xfthb x)

Maybe better to use the first entry of the font-backend frame
parameter rather than hardcoded one?

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

diff --git a/src/gtkutil.c b/src/gtkutil.c
index dccee159254..de4b25f7794 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2281,19 +2281,16 @@ xg_get_font (struct frame *f, const char *default_name)
 	  gint        size   = pango_font_description_get_size (desc);
 	  PangoWeight weight = pango_font_description_get_weight (desc);
 	  PangoStyle  style  = pango_font_description_get_style (desc);
+	  Lisp_Object frame, font_type_wanted;
 
-#ifdef USE_CAIRO
-#define FONT_TYPE_WANTED (Qftcr)
-#else
-#define FONT_TYPE_WANTED (Qxft)
-#endif
+	  XSETFRAME (frame, f);
+	  font_type_wanted = XCAR (Fframe_parameter (frame, Qfont_backend));
 	  font = CALLN (Ffont_spec,
 			QCname, build_string (name),
 			QCsize, make_float (pango_units_to_double (size)),
 			QCweight, XG_WEIGHT_TO_SYMBOL (weight),
 			QCslant, XG_STYLE_TO_SYMBOL (style),
-			QCtype,
-                        FONT_TYPE_WANTED);
+			QCtype, font_type_wanted);
 
 	  pango_font_description_free (desc);
 	  dupstring (&x_last_font_name, name);





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-20  2:54 ` YAMAMOTO Mitsuharu
@ 2019-06-20  7:51   ` Robert Pluim
  2019-06-20  8:32     ` Robert Pluim
  2019-06-23  6:34   ` YAMAMOTO Mitsuharu
  1 sibling, 1 reply; 11+ messages in thread
From: Robert Pluim @ 2019-06-20  7:51 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 36288

>>>>> On Thu, 20 Jun 2019 11:54:21 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:


    >> Maybe better to use the first entry of the font-backend frame
    >> parameter rather than hardcoded one?

Thanks, that works for me. Iʼve not tested what happens if I try to
use an X font rather than an xft one, but I think that usage will
eventually go away anyway.

Robert





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-20  7:51   ` Robert Pluim
@ 2019-06-20  8:32     ` Robert Pluim
  2019-06-20 12:56       ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Pluim @ 2019-06-20  8:32 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 36288

>>>>> On Thu, 20 Jun 2019 09:51:19 +0200, Robert Pluim <rpluim@gmail.com> said:

>>>>> On Thu, 20 Jun 2019 11:54:21 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:
    >>> Maybe better to use the first entry of the font-backend frame
    >>> parameter rather than hardcoded one?

    Robert> Thanks, that works for me. Iʼve not tested what happens if I try to
    Robert> use an X font rather than an xft one, but I think that usage will
    Robert> eventually go away anyway.

I tried a different variant:

(add-to-list 'default-frame-alist '(font-backend x xfthb))

then M-x menu-set-font

which gives (with your patch):

set-face-attribute: Font not available: #<font-spec x nil Ubuntu\ Mono nil nil normal normal nil 1.0 nil nil nil ((:name . "Ubuntu Mono"))>

Robert





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-20  8:32     ` Robert Pluim
@ 2019-06-20 12:56       ` Eli Zaretskii
  2019-06-20 14:19         ` Robert Pluim
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2019-06-20 12:56 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 36288

> From: Robert Pluim <rpluim@gmail.com>
> Date: Thu, 20 Jun 2019 10:32:34 +0200
> Cc: 36288@debbugs.gnu.org
> 
> I tried a different variant:
> 
> (add-to-list 'default-frame-alist '(font-backend x xfthb))

Where did you put this?  In the init file? or just evaluated it after
Emacs started?  In the latter case, it will be in effect only for
frames created henceforth.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-20 12:56       ` Eli Zaretskii
@ 2019-06-20 14:19         ` Robert Pluim
  2019-06-20 16:21           ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Pluim @ 2019-06-20 14:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 36288

>>>>> On Thu, 20 Jun 2019 15:56:52 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Date: Thu, 20 Jun 2019 10:32:34 +0200
    >> Cc: 36288@debbugs.gnu.org
    >> 
    >> I tried a different variant:
    >> 
    >> (add-to-list 'default-frame-alist '(font-backend x xfthb))

    Eli> Where did you put this?  In the init file? or just evaluated it after
    Eli> Emacs started?  In the latter case, it will be in effect only for
    Eli> frames created henceforth.

I evaluated it, and then created a new frame, and ran menu-set-font
from there. Although I just retested with it in init.el and the result
is the same.

Robert





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-20 14:19         ` Robert Pluim
@ 2019-06-20 16:21           ` Eli Zaretskii
  2019-06-21 13:52             ` Robert Pluim
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2019-06-20 16:21 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 36288

> From: Robert Pluim <rpluim@gmail.com>
> Cc: 36288@debbugs.gnu.org
> Date: Thu, 20 Jun 2019 16:19:05 +0200
> 
> >>>>> On Thu, 20 Jun 2019 15:56:52 +0300, Eli Zaretskii <eliz@gnu.org> said:
> 
>     >> From: Robert Pluim <rpluim@gmail.com>
>     >> Date: Thu, 20 Jun 2019 10:32:34 +0200
>     >> Cc: 36288@debbugs.gnu.org
>     >> 
>     >> I tried a different variant:
>     >> 
>     >> (add-to-list 'default-frame-alist '(font-backend x xfthb))
> 
>     Eli> Where did you put this?  In the init file? or just evaluated it after
>     Eli> Emacs started?  In the latter case, it will be in effect only for
>     Eli> frames created henceforth.
> 
> I evaluated it, and then created a new frame, and ran menu-set-font
> from there. Although I just retested with it in init.el and the result
> is the same.

This seems to be X- (and maybe also GTK-) specific.





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-20 16:21           ` Eli Zaretskii
@ 2019-06-21 13:52             ` Robert Pluim
  0 siblings, 0 replies; 11+ messages in thread
From: Robert Pluim @ 2019-06-21 13:52 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 36288

>>>>> On Thu, 20 Jun 2019 19:21:05 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Cc: 36288@debbugs.gnu.org
    >> Date: Thu, 20 Jun 2019 16:19:05 +0200
    >> 
    >> >>>>> On Thu, 20 Jun 2019 15:56:52 +0300, Eli Zaretskii <eliz@gnu.org> said:
    >> 
    >> >> From: Robert Pluim <rpluim@gmail.com>
    >> >> Date: Thu, 20 Jun 2019 10:32:34 +0200
    >> >> Cc: 36288@debbugs.gnu.org
    >> >> 
    >> >> I tried a different variant:
    >> >> 
    >> >> (add-to-list 'default-frame-alist '(font-backend x xfthb))
    >> 
    Eli> Where did you put this?  In the init file? or just evaluated it after
    Eli> Emacs started?  In the latter case, it will be in effect only for
    Eli> frames created henceforth.
    >> 
    >> I evaluated it, and then created a new frame, and ran menu-set-font
    >> from there. Although I just retested with it in init.el and the result
    >> is the same.

    Eli> This seems to be X- (and maybe also GTK-) specific.

And it doesnʼt happen in emacs-26, which makes me strongly suspect
something to do with either the HarfBuzz or Cairo changes.

Robert





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-20  2:54 ` YAMAMOTO Mitsuharu
  2019-06-20  7:51   ` Robert Pluim
@ 2019-06-23  6:34   ` YAMAMOTO Mitsuharu
  2019-06-23 13:50     ` Robert Pluim
  1 sibling, 1 reply; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2019-06-23  6:34 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 36288

On Thu, 20 Jun 2019 11:54:21 +0900,
YAMAMOTO Mitsuharu wrote:
> 
> On Wed, 19 Jun 2019 16:48:04 +0900,
> Robert Pluim wrote:
> > 
> > emacs -Q
> > M-x menu-set-font
> > select Ubuntu Mono Regular =>
> > 
> > "set-face-attribute: Font not available: #<font-spec xft nil Ubuntu\ Mono nil nil normal normal nil 10.0 nil nil nil ((:name . "Ubuntu Mono"))>"
> > 
> > I can select Ubuntu Mono using M-x customize-face. Why does
> > menu-set-font try to use an xft spec?
> > 
> > (frame-parameter nil 'font-backend) =>
> > (xfthb x)
> 
> Maybe better to use the first entry of the font-backend frame
> parameter rather than hardcoded one?

On second thought, it seems to be better to leave the font type
unspecified.  Hard-coding the wanted font type was introduced as a
"fix" for Bug#3228, but I suspect its reasoning is no longer valid (I
couldn't find fonts.alias in the Type1 font directory in CentOS or
Linux Mint).  Also, probably we should set the :family font property
instead of :name.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp

diff --git a/src/gtkutil.c b/src/gtkutil.c
index dccee159254..1d15aec253e 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2277,26 +2277,19 @@ xg_get_font (struct frame *f, const char *default_name)
 
       if (desc)
 	{
-	  const char *name   = pango_font_description_get_family (desc);
+	  const char *family = pango_font_description_get_family (desc);
 	  gint        size   = pango_font_description_get_size (desc);
 	  PangoWeight weight = pango_font_description_get_weight (desc);
 	  PangoStyle  style  = pango_font_description_get_style (desc);
 
-#ifdef USE_CAIRO
-#define FONT_TYPE_WANTED (Qftcr)
-#else
-#define FONT_TYPE_WANTED (Qxft)
-#endif
 	  font = CALLN (Ffont_spec,
-			QCname, build_string (name),
+			QCfamily, build_string (family),
 			QCsize, make_float (pango_units_to_double (size)),
 			QCweight, XG_WEIGHT_TO_SYMBOL (weight),
-			QCslant, XG_STYLE_TO_SYMBOL (style),
-			QCtype,
-                        FONT_TYPE_WANTED);
+			QCslant, XG_STYLE_TO_SYMBOL (style));
 
 	  pango_font_description_free (desc);
-	  dupstring (&x_last_font_name, name);
+	  dupstring (&x_last_font_name, family);
 	}
 
 #else /* Use old font selector, which just returns the font name.  */





^ permalink raw reply related	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-23  6:34   ` YAMAMOTO Mitsuharu
@ 2019-06-23 13:50     ` Robert Pluim
  2019-06-30  7:02       ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 11+ messages in thread
From: Robert Pluim @ 2019-06-23 13:50 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: 36288

>>>>> On Sun, 23 Jun 2019 15:34:23 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:
    >> On second thought, it seems to be better to leave the font type
    >> unspecified.  Hard-coding the wanted font type was introduced as a
    >> "fix" for Bug#3228, but I suspect its reasoning is no longer valid (I
    >> couldn't find fonts.alias in the Type1 font directory in CentOS or
    >> Linux Mint).  Also, probably we should set the :family font property
    >> instead of :name.

Thanks, that fixed things for me, with font-backend '(xfthb x) and '(x xfthb)

Iʼve not looked at Bug#3228, but at least on my Ubuntu machine I have:

/usr/share/fonts/X11/Type1/fonts.alias
/usr/share/fonts/X11/misc/fonts.alias

but given the prevalence of opentype and truetype fonts, Iʼm not sure
that thereʼs anything to worry about.

Robert





^ permalink raw reply	[flat|nested] 11+ messages in thread

* bug#36288: 27.0.50; Cannot use menu-set-font
  2019-06-23 13:50     ` Robert Pluim
@ 2019-06-30  7:02       ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 11+ messages in thread
From: YAMAMOTO Mitsuharu @ 2019-06-30  7:02 UTC (permalink / raw)
  To: Robert Pluim; +Cc: 36288-done

On Sun, 23 Jun 2019 22:50:11 +0900,
Robert Pluim wrote:
> 
> >>>>> On Sun, 23 Jun 2019 15:34:23 +0900, YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> said:
>     >> On second thought, it seems to be better to leave the font type
>     >> unspecified.  Hard-coding the wanted font type was introduced as a
>     >> "fix" for Bug#3228, but I suspect its reasoning is no longer valid (I
>     >> couldn't find fonts.alias in the Type1 font directory in CentOS or
>     >> Linux Mint).  Also, probably we should set the :family font property
>     >> instead of :name.
> 
> Thanks, that fixed things for me, with font-backend '(xfthb x) and '(x xfthb)
> 
> Iʼve not looked at Bug#3228, but at least on my Ubuntu machine I have:
> 
> /usr/share/fonts/X11/Type1/fonts.alias
> /usr/share/fonts/X11/misc/fonts.alias
> 
> but given the prevalence of opentype and truetype fonts, Iʼm not sure
> that thereʼs anything to worry about.

Ah, the package gsfonts-X11 seems to provide fonts.alias for URW Type1
fonts.  Anyway, I think the behavior originally reported as Bug#3228
is actually consistent in the sense that "% emacs -fn courier-12" also
displays the text in "ugly" font in OP's environment.

Also, x-select-font is a function for a generic font selection dialog,
not specific to menu-select-font.  So its result should not include
font type property only for menu-select-font.

I've pushed the patch to master as e2d8c1e8bcf.  Closing the bug.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp





^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-06-30  7:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-19  7:48 bug#36288: 27.0.50; Cannot use menu-set-font Robert Pluim
2019-06-20  2:54 ` YAMAMOTO Mitsuharu
2019-06-20  7:51   ` Robert Pluim
2019-06-20  8:32     ` Robert Pluim
2019-06-20 12:56       ` Eli Zaretskii
2019-06-20 14:19         ` Robert Pluim
2019-06-20 16:21           ` Eli Zaretskii
2019-06-21 13:52             ` Robert Pluim
2019-06-23  6:34   ` YAMAMOTO Mitsuharu
2019-06-23 13:50     ` Robert Pluim
2019-06-30  7:02       ` YAMAMOTO Mitsuharu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).