You are not logged in.

#1 2015-02-28 19:54:54

kureta
Member
Registered: 2015-02-28
Posts: 18

[Solved] Setting URxvt font in .Xresources also changes all fonts

I set up URxvt font in .Xresources like this:

URxvt.font:     xft:Monaco for Powerline:size=10:antialias=true
URxvt.boldFont: xft:Monaco for Powerline:bold:size=10:antialias=true

It works and sets the correct font for URxvt. But it also changes all fonts.

I am using i3.

P.S. URxvt cannot display this character: ↵
But that is a completely unrelated problem.

Last edited by kureta (2015-02-28 23:27:29)

Offline

#2 2015-02-28 20:09:17

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

How are you setting your other fonts?

You could put the rxvt-unicode settings in ~/.Xdefaults instead -- this is parsed by urxvt automatically on startup (no need to `xrdb -merge` it).


Jin, Jîyan, Azadî

Offline

#3 2015-02-28 20:21:49

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

I don't do anything to set up any other fonts. I just want other applications to use whatever their default fonts are. Shouldn't "URxvt.font:" setting affect only URxvt and nothing else? Do I have to setup a default font for all applications?

I can move URxvt related settings from .Xresources into .Xdefaults but I setup this box to learn Linux in-depth, so I would like to know the cause of this problem before doing anything.

I don't install anything I don't need. I don't change any configuration files unless I know what I am doing, as opposed to just copy/pasting from the web.

Thanks for the quick response smile

Offline

#4 2015-02-28 20:24:41

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

Changes all fonts where? In GTK/Qt applications?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2015-02-28 20:25:14

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

The applications don't have "default fonts" -- the font needs to be set via (for example) ~/.gtkrc-2.0
https://bbs.archlinux.org/viewtopic.php?id=194250

I like your attitude.


Jin, Jîyan, Azadî

Offline

#6 2015-02-28 21:36:02

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

It changes fonts in Chromium and QJackCtl. I don't have any other GUI applications.
Chromium had a different font before I changed URxvt's font. That is what I meant by "default fonts".

Edit: I don't have any desktop environments installed. Just Xserver and i3 wm.

Last edited by kureta (2015-02-28 21:37:38)

Offline

#7 2015-02-28 21:38:10

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

Head_on_a_Stick wrote:

I like your attitude.

Thanks smile

Offline

#8 2015-02-28 22:41:56

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

I have found the cause of my problems.

% fc-match sans-serif -s
Monaco for Powerline.otf: "Monaco for Powerline" "標準體"
DroidSansFallbackFull.ttf: "Droid Sans Fallback" "Regular"
DroidSansFallbackLegacy.ttf: "Droid Sans Fallback" "Regular"
...

fc-match cursive -s
Monaco for Powerline.otf: "Monaco for Powerline" "標準體"
DroidSansFallbackFull.ttf: "Droid Sans Fallback" "Regular"
DroidSansFallbackLegacy.ttf: "Droid Sans Fallback" "Regular"
...

Monaco for Powerline is the top match for all font families. So all the applications select this font for everything. I don't know how to fix that but I am sure I can find the answer around the forum/wiki. Thanks for your help.

Also does anyone know how to make URxvt display this character: ↵ ?

Offline

#9 2015-02-28 23:18:04

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

For the posterity, tih is how I solved my problem:

I have created ~/.config/fontconfig/fonts.conf file with following content.

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <alias>
        <family>serif</family>
        <prefer>
            <family>Droid Serif</family>
            <family>DejaVu Serif</family>
            <family>Bitstream Vera Serif</family>
        </prefer>
    </alias>

    <alias>
        <family>sans-serif</family>
        <prefer>
            <family>Droid Sans</family>
            <family>DejaVu Sans</family>
            <family>Bitstream Vera Sans</family>
            <family>Verdana</family>
            <family>Arial</family>
        </prefer>
    </alias>

    <alias>
        <family>monospace</family>
        <prefer>
            <family>Monaco for Powerline</family>
            <family>Inconsolata</family>
            <family>Bitstream Vera Sans Mono</family>
        </prefer>
    </alias>
 <match target="font" >
  <edit mode="assign" name="rgba" >
   <const>none</const>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hinting" >
   <bool>true</bool>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="hintstyle" >
   <const>hintmedium</const>
  </edit>
 </match>
 <match target="font" >
  <edit mode="assign" name="antialias" >
   <bool>true</bool>
  </edit>
 </match>
</fontconfig>

Now I have another problem. URxvt uses Monaco for Powerline but everything else uses Inconsolata as default monospace font. For example the "code" sections in this forum in Chromium are all Inconsolata, despite the fact that the preferred monospace font is "Monaco for Powerline" in my user font.config

Offline

#10 2015-02-28 23:24:19

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

I have solved my final problem by adding the following into /etc/fonts/conf.d/45-latin.conf

<alias>
        <family>Monaco for Powerline</family>
        <default><family>monospace</family></default>
</alias>

It seems that the system did not know that "Monaco for Powerline" is a monospace font.

I will mark this thread as solved and look to elsewhere to solve my other " ↵  " problem.

Thank you guys!

Offline

#11 2015-02-28 23:27:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

Head_on_a_Stick wrote:

I like your attitude.

Yes, he seems to be one of us.  Care to teach him the secret handshake?

kureta wrote:

Also does anyone know how to make URxvt display this character: ↵ ?

It works fine here, but I use terminus font.  Are you sure that glyph is available with the font you selected?  If it is, I'd look into your locale settings (output of localectl for starters) to see if you have a utf-8 locale/LANG.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#12 2015-02-28 23:36:27

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

Trilby wrote:
Head_on_a_Stick wrote:

I like your attitude.

Yes, he seems to be one of us.  Care to teach him the secret handshake?

kureta wrote:

Also does anyone know how to make URxvt display this character: ↵ ?

It works fine here, but I use terminus font.  Are you sure that glyph is available with the font you selected?  If it is, I'd look into your locale settings (output of localectl for starters) to see if you have a utf-8 locale/LANG.

Secret handshake!!! Please do teach smile

Actually I am pretty sure my font does not have that glyph. I will try different fonts. Is there a way to test different fonts in URxvt without stopping and restarting the Xserver?

Offline

#13 2015-02-28 23:38:27

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

^ I wrote a shabby script to do just that:

https://github.com/AladW/scripts/blob/m … xvt-ttfont

Of course you'll have to adjust the lorem ipsum. smile

edit: I see it uses ls to populate the array. hmm edit2: fixed.

Last edited by Alad (2015-02-28 23:55:01)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#14 2015-02-28 23:47:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

You definitely don't need to restart X.  You can edit the Xresources file, then just re-merge it (xrdb -merge ...).  Or even better for testing, just use the -fn command line option for urxvt which will override and xrdb settings.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#15 2015-02-28 23:51:11

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

Alad wrote:

^ I wrote a shabby script to do just that:

https://github.com/AladW/scripts/blob/m … xvt-ttfont

Of course you'll have to adjust the lorem ipsum. smile

edit: I see it uses ls to populate the array. hmm


The script is nice, thank you, but it did not list any of the fonts I wanted to test. I changed the FONTPATH="/usr/share/fonts/TTF" to FONTPATH="/usr/share/fonts/OTF", then I was able to test Inconsolata and Monaco for Powerline. They both did not have the glyph for ↵. So I tried to test terminus too. but it is in "/usr/share/fonts/misc" folder and saved as many ter-***.psf.gz files. I tried to change FONTPATH to "/usr/share/fonts/misc" but the script loaded all ter-***.psf.gz files and when I selected any one of them Everything just went crazy smile

Offline

#16 2015-02-28 23:58:13

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

Everything just went crazy

Yeah, standard disclaimer for code of mine. Glad it somewhat helped anyway.


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#17 2015-03-01 00:14:31

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

I looked trough your script and understood what it did. Just manually did it for terminus font. It also did not have that glyph sad So I installed DejaVu fonts. It has many of the missing glyphs. So this is my final .Xresources file

URxvt.font:     xft:Monaco for Powerline:size=10:antialias=true, \
                xft:Droid Sans Mono:size=10:antialias=true, \
                xft:DejaVu Sans Mono:style=Book:antialias=true:size=10

URxvt.boldFont: xft:Monaco for Powerline:bold:size=10:antialias=true, \
                xft:Droid Sans Mono:bold:size=10:antialias=true
                xft:DejaVu Sans Mono:bold:style=Book:size=10:antialias=true

if URxvt cannot find a glyph in the first font it looks trough the listed fonts, and finally finds it in DeJavu. So I am able to use Monaco and only glyphs that do not exist in Monaco are rendered using different fonts.

Yay! smile

Thank you Alad!

Offline

#18 2015-03-01 00:15:02

kureta
Member
Registered: 2015-02-28
Posts: 18

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

Trilby wrote:

You definitely don't need to restart X.  You can edit the Xresources file, then just re-merge it (xrdb -merge ...).  Or even better for testing, just use the -fn command line option for urxvt which will override and xrdb settings.

Thanks! I totally forgot "xrdb -merge"

Offline

#19 2015-03-01 02:20:31

Knute
Member
From: Minot, ND
Registered: 2009-03-17
Posts: 604

Re: [Solved] Setting URxvt font in .Xresources also changes all fonts

kureta wrote:
Trilby wrote:

You definitely don't need to restart X.  You can edit the Xresources file, then just re-merge it (xrdb -merge ...).  Or even better for testing, just use the -fn command line option for urxvt which will override and xrdb settings.

Thanks! I totally forgot "xrdb -merge"

I don't use urxvt in server/client mode, so when I am playing with fonts, you can just leave the Xresources or Xdefault file up in a term window, save it, and then simply open another urxvt window.  The changes that you make are then applied.


Knute

Offline

Board footer

Powered by FluxBB