AnswerBun.com

Blank menus with Athena / Lucid

I compiled Emacs 27.1 with --with-x-toolkit=lucid, now the menus are blank.
I tried setting the colors in ~/.Xresources:

Emacs.pane.menubar.background: black
Emacs.pane.menubar.foreground: white
Emacs.pane.menubar.buttonForeground: white

But that only turned the menus black, I still see no text.

I started Emacs with xrdb ~/.Xresources && emacs -Q. GTK and Motif menus work fine.

Screenshot of a blank menu.

Emacs Asked by tastytea on December 31, 2020

1 Answers

One Answer

It is a bug in Emacs 27.1. The problem was that I have “Noto Color Emoji” as my second preferred font in my fontconfig configuration file (~/.config/fontconfig/fonts.conf):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <!-- […] -->
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Source Sans Pro</family>
      <family>Noto Color Emoji</family>
    </prefer>
  </alias>
</fontconfig>

fc-match -s sans | head -n2 looks like this:

SourceSansPro-Regular.otf: "Source Sans Pro" "Regular"
NotoColorEmoji.ttf: "Noto Color Emoji" "Regular"

Workaround

Remove “Noto Color Emoji” from your preferred fonts list. You will lose color emojis in a lot of programs.

Solution

Wait for Emacs 27.2 or apply this patch from the emacs-27 branch:

diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c
index f15cb603a8..2b3aa55c3e 100644
--- a/lwlib/lwlib-utils.c
+++ b/lwlib/lwlib-utils.c
@@ -148,6 +148,7 @@ XftFont *
 crxft_font_open_name (Display *dpy, int screen, const char *name)
 {
   XftFont *pub = NULL;
+  FcPattern *match = NULL;
   FcPattern *pattern = FcNameParse ((FcChar8 *) name);
   if (pattern)
     {
@@ -162,12 +163,18 @@ crxft_font_open_name (Display *dpy, int screen, const char *name)
      FcPatternAddDouble (pattern, FC_DPI, dpi);
    }
       FcDefaultSubstitute (pattern);
+      FcResult result;
+      match = FcFontMatch (NULL, pattern, &result);
+      FcPatternDestroy (pattern);
+    }
+  if (match)
+    {
       cairo_font_face_t *font_face
-   = cairo_ft_font_face_create_for_pattern (pattern);
+   = cairo_ft_font_face_create_for_pattern (match);
       if (font_face)
    {
      double pixel_size;
-     if ((FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &pixel_size)
+     if ((FcPatternGetDouble (match, FC_PIXEL_SIZE, 0, &pixel_size)
           != FcResultMatch)
          || pixel_size < 1)
        pixel_size = 10;
@@ -177,7 +184,7 @@ crxft_font_open_name (Display *dpy, int screen, const char *name)
      cairo_matrix_init_scale (&font_matrix, pixel_size, pixel_size);
      cairo_matrix_init_identity (&ctm);
      cairo_font_options_t *options = cairo_font_options_create ();
-     cairo_ft_font_options_substitute (options, pattern);
+     cairo_ft_font_options_substitute (options, match);
      pub->scaled_font = cairo_scaled_font_create (font_face, &font_matrix,
                               &ctm, options);
      cairo_font_face_destroy (font_face);
@@ -190,7 +197,7 @@ crxft_font_open_name (Display *dpy, int screen, const char *name)
      pub->height = lround (extents.height);
      pub->max_advance_width = lround (extents.max_x_advance);
    }
-      FcPatternDestroy (pattern);
+      FcPatternDestroy (match);
     }
   if (pub && pub->height <= 0)
     {

Correct answer by tastytea on December 31, 2020

Add your own answers!

Related Questions

Adding Spacemacs documented layers fails

1  Asked on September 2, 2021 by samusz

   

Easily accessing org files

1  Asked on September 2, 2021 by fraxture

 

View multiple emails at the same time with mu4e

1  Asked on September 2, 2021 by tyler

 

How can I set default paths for INCLUDE blocks under each heading in orgmode?

0  Asked on September 2, 2021 by scientific_explorer

 

In-line latex fragment position in org-mode

0  Asked on September 2, 2021 by a-blizzard

   

Filter list by regexps

2  Asked on September 2, 2021 by lorem-ipsum

       

Get a table of org-mode file from elisp to be passed to R

1  Asked on September 2, 2021 by omar113

 

Styling lists in org-export (html)

1  Asked on March 5, 2021 by user2699

   

Is there a way to show/open a file from a URI/URL

3  Asked on February 27, 2021 by carsten

   

cursor color depending on insert or overwrite mode

1  Asked on February 19, 2021 by tamifo

   

Syntax highlighting in C++ fails in user-defined literals

1  Asked on February 19, 2021 by vroomfondel

   

org-set-effort fast effort selection?

1  Asked on February 19, 2021 by whoever

 

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved.