You are not logged in.

#1 2020-11-29 08:35:15

anthonyclark
Member
From: WA,USA
Registered: 2007-10-07
Posts: 48

Electron applications invalidate font cache [SOLVED]

All,

I hope my title is OK. While I can't prove it, I can replicate it. I use dwm + dmenu with some basic fonts (dina-font). Everything is fine until I run `slack-desktop` or some AppImages for drawIO, or some other apps. The `electron` binary from the `electron` package does NOT cause this though.

The effect is dmenu reverts to it's default font on next execution and rxvt-unicode doesn't seem to load my (TTF) font on its next execution. I can fix it with `fc-cache -frv`, then dmenu and rxvt-unicode work fine on next execution.

I had this issue on some other machines and magically fixed it, but I cannot remember how sad

I would love some advice on fixing this and maybe some insights as to wtf is happening.

I'm not sure what to post, so here is some random things.

1. I do not use a fonts.conf or anything. I use `lxappearance` to build gtk rc

2. Here is my .Xresources. I remember Xft maybe being an issue

*.foreground: #DDDDDD
*.background: #0f0f0f

!black
*.color0: #393939
*.color8: #474747

!red
*.color1: #da4939
*.color9: #ff6c5c

!green
*.color2: #519f50
*.color10: #a5c261

!yellow
*.color3: #cc7833
*.color11: #bc9458

!blue
*.color4: #6d9cbe
*.color12: #6d9cbe

!magenta
*.color5: #9f5079
*.color13: #a761c2

!cyan
*.color6: #435d75
*.color14: #6e98a4

!white
*.color7: #dddddd
*.color15: #dddddd

! -------------------------- XTerm
! XTerm.vt100.locale: false
! XTerm.vt100.utf8: true
! XTerm.vt100.saveLines: 4096

! -------------------------- URxvt-specific stuff
URxvt*borderColor:    #0f0f0f
URxvt*colorBD:        #ffffff
URxvt*colorIT:        #a761c2
URxvt*colorUL:        #6d9cbe
URxvt*underlineColor: #333333

URxvt*highlightColor:     #a761c2
URxvt*highlightTextColor: #0f0f0f

URxvt*cursorColor:  #ff8939
URxvt*cursorColor2: #0f0f0f

URxvt*font:     xft:Dina:pixelsize=10:antialias=true:hinting:true
URxvt*boldFont: xft:Dina:bold:pixelsize=10:antialias=true:hinting:true

URxvt*cursorBlink     : true
URxvt*cursorUnderline : false

URxvt*geometry       : 75x15
URxvt*internalBorder : 3

URxvt*depth            : 24

URxvt*scrollBar        : false
URxvt*scrollBar_right  : true
URxvt*scrollstyle      : plain
URxvt*scrollColor      : #2873a2
URxvt*scrollWithBuffer : false
URxvt*scrollTtyOutput  : true
URxvt*saveLines        : 4096
URxvt.keysym.Home      : \033[1~
URxvt.keysym.End       : \033[4~

URxvt*urgentOnBell     : true

URxvt*pointerBlank     : true

URxvt.perl-ext-common   : default,tabbedex
URxvt.tabbedex.autohide   : true
URxvt.tabbedex.new-button : false
URxvt.tabbedex.title      : false
URxvt.tabbedex.tabbar-fg  : 8
URxvt.tabbedex.tabbar-bg  : 0
URxvt.tabbedex.tab-fg     : 6
URxvt.tabbedex.tab-bg     : 0

Xft.autohint  : 1
Xft.lcdfilter : lcddefault
Xft.hintstyle : hintfull
Xft.hinting   : 1
Xft.antialias : 1
Xft.dpi       : 96
Xft.rgba      : rgb

! --------------------------- DDD specific stuff
Ddd*enableThinThickness : True
Ddd*enableEtchedInMenu  : True
Ddd*enableToggleColor   : True
Ddd*enableToggleVisual  : True

! Use pure white for white backgrounds like modern widget themes and websites
Ddd*XmText.background      : #ffffff
Ddd*XmTextField.background : #ffffff
Ddd*XmList.background      : #ffffff
Ddd*GraphEdit.background   : #ffffff

! Thick borders and shadows everywhere are archaic
Ddd*shadowThickness           : 1
Ddd*borderThickness           : 0
Ddd*?*arg*shadowThickness     : 1
Ddd*?*arg*borderThickness     : 0
Ddd*?*buttons*shadowThickness : 1
Ddd*?*buttons*borderThickness : 0

! Un-cramp the menubar, menus, and toolbar to match modern compact sizing
Ddd*menubar*marginTop: 1
Ddd*menubar*marginBottom: 0
Ddd*XmMenuShell*marginTop: 2
Ddd*XmMenuShell*marginBottom: 2
Ddd*XmMenuShell.?.marginWidth: 2
Ddd*XmMenuShell.?.marginHeight: 2
Ddd*toolbar*marginWidth: 5

! Compact the menu tear-off buttons
Ddd*XmMenuShell*XmTearOffButton*borderWidth: 0
Ddd*XmMenuShell*XmTearOffButton*marginHeight: 0

! DDD's interpretation of a "toggle button" shouldn't have a raised border
Ddd*XmToggleButton*shadowThickness: 0
Ddd*XmToggleButton*borderThickness: 0

! The menu bar should not have a raised border
Ddd*menubar.shadowThickness: 0
Ddd*menubar.borderThickness: 0
Ddd*XmMenuShell*XmTearOffButton*ShadowThickness: 2

! ...and we do not want a border around the toolbar to make that stand out
Ddd*main_window.?.borderThickness: 0
Ddd*main_window.shadowThickness: 0

! Drop-down boxes in toolbars do not have raised borders these days
Ddd*toolbar.shadowThickness: 0
Ddd*toolbar.?.shadowThickness: 1

! DDD can sometimes get its GDB settings fatally messed up so duplicate
! GUI-exposed integration defaults here for when I want to nuke ~/.ddd/init
Ddd*cutCopyPasteBindings: KDE
Ddd*selectAllBindings: KDE
Ddd*buttonColorKey: c
Ddd*FlatButtons: on

! --------------------------- XCALC stuff
xcalc*geometry:                        200x275
xcalc.ti.bevel.background:             #111111
xcalc.ti.bevel.screen.background:      #000000
xcalc.ti.bevel.screen.DEG.background:  #000000
xcalc.ti.bevel.screen.DEG.foreground:  LightSeaGreen
xcalc.ti.bevel.screen.GRAD.background: #000000
xcalc.ti.bevel.screen.GRAD.foreground: LightSeaGreen
xcalc.ti.bevel.screen.RAD.background:  #000000
xcalc.ti.bevel.screen.RAD.foreground:  LightSeaGreen
xcalc.ti.bevel.screen.INV.background:  #000000
xcalc.ti.bevel.screen.INV.foreground:  Red
xcalc.ti.bevel.screen.LCD.background:  #000000
xcalc.ti.bevel.screen.LCD.foreground:  LightSeaGreen
xcalc.ti.bevel.screen.LCD.shadowWidth: 0
xcalc.ti.bevel.screen.M.background:    #000000
xcalc.ti.bevel.screen.M.foreground:    LightSeaGreen
xcalc.ti.bevel.screen.P.background:    #000000
xcalc.ti.bevel.screen.P.foreground:    Yellow
xcalc.ti.Command.foreground:  White
xcalc.ti.Command.background:  #777777
xcalc.ti.button5.background:  Orange3
xcalc.ti.button19.background: #611161
xcalc.ti.button18.background: #611161
xcalc.ti.button20.background: #611111
!uncomment to change label on division button
!xcalc.ti.button20.label:      /
xcalc.ti.button25.background: #722222
xcalc.ti.button30.background: #833333
xcalc.ti.button35.background: #944444
xcalc.ti.button40.background: #a55555
xcalc.ti.button22.background: #222262
xcalc.ti.button23.background: #222262
xcalc.ti.button24.background: #222272
xcalc.ti.button27.background: #333373
xcalc.ti.button28.background: #333373
xcalc.ti.button29.background: #333373
xcalc.ti.button32.background: #444484
xcalc.ti.button33.background: #444484
xcalc.ti.button34.background: #444484
xcalc.ti.button37.background: #555595
xcalc.ti.button38.background: #555595
xcalc.ti.button39.background: #555595
XCalc*Cursor:                 hand2
XCalc*ShapeStyle:             rectangle

! *TkTheme: clam



Thanks!

Last edited by anthonyclark (2020-11-29 20:21:10)

Offline

#2 2020-11-29 13:09:41

seth
Member
Registered: 2012-09-03
Posts: 49,992

Re: Electron applications invalidate font cache [SOLVED]

Your title is ok, but please use code tags, not quote tags for file contents and shell I/O.

On topic:
pango dropped bitmap pcf support and I guess somebody tries to be smart and removes dina from your xft/fontconfig resolution for that reason.
Because of the pango situation, try dina-font-otb or dina-font-ttf (AUR) instead.

Offline

#3 2020-11-29 13:11:19

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Electron applications invalidate font cache [SOLVED]

Have you tried running the app with system installed electron through  a wrapper [1] and does it have the same problem ?




[1]  https://wiki.archlinux.org/index.php/El … m_electron


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#4 2020-11-29 20:18:17

anthonyclark
Member
From: WA,USA
Registered: 2007-10-07
Posts: 48

Re: Electron applications invalidate font cache [SOLVED]

seth wrote:

Your title is ok, but please use code tags, not quote tags for file contents and shell I/O.

On topic:
pango dropped bitmap pcf support and I guess somebody tries to be smart and removes dina from your xft/fontconfig resolution for that reason.
Because of the pango situation, try dina-font-otb or dina-font-ttf (AUR) instead.

OK this was it. I had both `dina-font` and `dina-font-ttf` installed. I removed the base `dina-font` and installed `dina-font-otb` from AUR. So, dmenu/dwm can use TTF fonts so they're fixed now. And rxvt-unicode is using the `dina-font-otb` and is now working too. I'm not really sure WHY this fixed it, as I don't know what magic electron apps were doing. Anyway, thanks!

Such a weird issue.

Offline

#5 2020-11-29 20:20:37

anthonyclark
Member
From: WA,USA
Registered: 2007-10-07
Posts: 48

Re: Electron applications invalidate font cache [SOLVED]

Lone_Wolf wrote:

Have you tried running the app with system installed electron through  a wrapper [1] and does it have the same problem ?




[1]  https://wiki.archlinux.org/index.php/El … m_electron


I did try this with some patsh from the `slack-desktop` package. I know almost 0 about electron/js so I was shooting in the dark. Thanks for the tip though. It was interesting that the `electron` demo application didn't trigger this issue.

Offline

#6 2021-01-15 10:37:22

b3n10
Member
Registered: 2018-11-03
Posts: 14

Re: Electron applications invalidate font cache [SOLVED]

same here, every time i run an electron app, my terminus font is switched to a different font on both dmenu and st terminal

i tried running Signal via wrapper but getting an error:

#!/bin/sh

exec electron /usr/lib/signal-desktop/resources/app.asar "$@"
$ ./signal_electron_wrapper.sh
Set Windows Application User Model ID (AUMID) { appUserModelId: 'org.whispersystems.signal-desktop' }
NODE_ENV development
NODE_CONFIG_DIR /usr/lib/signal-desktop/resources/app.asar/config
NODE_CONFIG {}
ALLOW_CONFIG_MUTATIONS undefined
HOSTNAME undefined
NODE_APP_INSTANCE undefined
SUPPRESS_NO_CONFIG_WARNING undefined
SIGNAL_ENABLE_HTTP undefined
userData: /home/user/.config/Signal
config/get: Successfully read user config file
x-attr dependency did not load successfully
App threw an error during load
Error: /usr/lib/signal-desktop/resources/app.asar.unpacked/node_modules/curve25519-n/build/Release/curve.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:2039)
    at Module.load (internal/modules/cjs/loader.js:992:32)
    at Module._load (internal/modules/cjs/loader.js:885:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
    at Module.require (internal/modules/cjs/loader.js:1032:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at bindings (/usr/lib/signal-desktop/resources/app.asar/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/usr/lib/signal-desktop/resources/app.asar/node_modules/curve25519-n/index.js:2:34)
Unhandled Error: Error: /usr/lib/signal-desktop/resources/app.asar.unpacked/node_modules/curve25519-n/build/Release/curve.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:2039)
    at Module.load (internal/modules/cjs/loader.js:992:32)
    at Module._load (internal/modules/cjs/loader.js:885:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
    at Module.require (internal/modules/cjs/loader.js:1032:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at bindings (/usr/lib/signal-desktop/resources/app.asar/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/usr/lib/signal-desktop/resources/app.asar/node_modules/curve25519-n/index.js:2:34)
Unhandled Error
Error: /usr/lib/signal-desktop/resources/app.asar.unpacked/node_modules/curve25519-n/build/Release/curve.node: undefined symbol: _ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorENS_14SideEffectTypeE
    at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
    at Object.func [as .node] (electron/js2c/asar_bundle.js:5:2039)
    at Module.load (internal/modules/cjs/loader.js:992:32)
    at Module._load (internal/modules/cjs/loader.js:885:14)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12738)
    at Module.require (internal/modules/cjs/loader.js:1032:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at bindings (/usr/lib/signal-desktop/resources/app.asar/node_modules/bindings/bindings.js:112:48)
    at Object.<anonymous> (/usr/lib/signal-desktop/resources/app.asar/node_modules/curve25519-n/index.js:2:34)

also not familiar with electron js or how this works, but is this a problem with the Signal app?

Offline

#7 2021-10-03 12:19:03

dther
Member
Registered: 2021-10-03
Posts: 1

Re: Electron applications invalidate font cache [SOLVED]

b3n10 wrote:

same here, every time i run an electron app, my terminus font is switched to a different font on both dmenu and st terminal

i tried running Signal via wrapper but getting an error:
<snip>
also not familiar with electron js or how this works, but is this a problem with the Signal app?

Going to reply to this old thread because this thread is the first result on every search engine for this problem, and this post reflected my *exact* problem.
Yes, this is some weirdness with electron.js or Signal. Unfortunately, it can't easily be fixed: electron is meant to be repackaged and recompiled by individual apps, making each electron app different and annoying to debug in its own special way.

Thankfully, Terminus' maintainer(s) have a solution. To solve the problem of Terminus becoming unloaded due to being an "old format", in your config.h's, replace "xos4 Terminus" with "Terminus". Example:

-static char *font = "xos4 Terminus:pixelsize=14:antialias=true:autohint=true";
+static char *font = "Terminus:pixelsize=14:antialias=true:autohint=true";

"xos4 Terminus" maps to the old pcf format, which is in active use in low-power and low-resolution environments (e.g. the Linux tty terminal...), but gets deleted from the font cache by overzealous "optimisation features". "Terminus" maps to the new .otb format, which is "supposed" to be vector based, but "can" include bitmap glyphs. In this case, it's all bitmaps and retains that pixel-perfect crispness even on small displays.

If you use any other .bdf/.pcf fonts, they'll need to be converted too. If you use siji, there's a fork of siji, siji-ng, that does this automatically during installation.


"Only thing I know is that I don't know nothing." - Socrates probably

Offline

Board footer

Powered by FluxBB