You are not logged in.

#1 2008-02-17 23:34:53

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

[Solved] Change urxvt's font on the fly: Can YOU do it?

When I'm in a good mood, my terminal font is Terminus with pixelsize 12, and it's pretty.

Sometimes though I realize I'd be happier if my font was a bit bigger. Is there a way to change font size in an already-running urxvt?

Last edited by peets (2008-02-18 14:31:48)

Offline

#2 2008-02-18 05:17:25

mrcold
Member
Registered: 2008-01-24
Posts: 150

Re: [Solved] Change urxvt's font on the fly: Can YOU do it?

I would also like to know this...

Offline

#3 2008-02-18 10:44:33

badger
Member
From: Melb
Registered: 2004-07-21
Posts: 76

Re: [Solved] Change urxvt's font on the fly: Can YOU do it?

Something like this:

! :Bind C-0, C-+ and C-= to activate small, medium, and big font size resp.     
URxvt.keysym.C-0: command:\033]710;-*-dina-medium-r-normal--13-*-*-*-*-*-*-*\007
URxvt.keysym.C-minus: command:\033]710;-*-dina-medium-r-normal--15-*-*-*-*-*-*-*\007
URxvt.keysym.C-equal: command:\033]710;-*-dina-medium-r-normal--16-*-*-*-*-*-*-*\007

May cause your cat to hate you or your local garbage collector to knock your house down. Cheers.

Offline

#4 2008-02-18 10:55:11

semdornus
Member
From: Tokyo
Registered: 2007-08-07
Posts: 47

Re: [Solved] Change urxvt's font on the fly: Can YOU do it?

Besides setting up keys such as badger mentions you can also, for a quick change,  paste this in a running terminal:

printf '\33]50;%s\007' "xft:Terminus:pixelsize=20"

See man 7 urxvt ("Can I switch the fonts at runtime?" and "Can I see a typical configuration?") for more info.

Offline

#5 2008-02-18 14:31:04

peets
Member
From: Montreal
Registered: 2007-01-11
Posts: 936
Website

Re: [Solved] Change urxvt's font on the fly: Can YOU do it?

I won't bother finding out what those escapes actually mean this time smile

~ $ cat ~/bin/fsize
#!/bin/bash
printf '\33]50;%s%d\007' "xft:Terminus:pixelsize=" $1

Thanks guys.

Offline

#6 2015-11-08 09:50:44

qubodup
Member
From: Berlin, Germany
Registered: 2008-01-19
Posts: 62
Website

Re: [Solved] Change urxvt's font on the fly: Can YOU do it?

Thanks a lot for posting the solution!

'\33]50;%s%d\007'

Does anybody know what this means though? I have the following lines in my .Xdefaults

$ cat  .Xdefaults | grep pixel
urxvt*boldFont:	xft:terminus:pixelsize=13
urxvt*font:	xft:Terminus:pixelsize=13

And the result appears to be, that if I apply the solution in this thread, it will make bold fonts look wierd, like for example:
bxeIttP.jpgNI5XQMx.jpg

Experimenting with replacing the escaped values turned the terminal pink in one instance but I couldn't figure out how to set the bold font size...

It is possible to omit this problem by removing the boldFont line, since I'm using the same font for both normal and bold but it'd be still useful to know.

Last edited by qubodup (2015-11-08 10:22:12)

Offline

#7 2015-12-09 15:25:37

12foo
Member
Registered: 2015-12-09
Posts: 1

Re: [Solved] Change urxvt's font on the fly: Can YOU do it?

This:

URxvt.keysym.C-0: command:\033]710;xft:Hack:size=10:antialias=true\007

means that when Ctrl-0 is pressed:

\033] - send fake keystroke ESC-] (this announces a terminal control sequence)
710; - terminal control: set normal font, followed by the font description
\077 - end command

Other font control sequences are:

711; - set bold font
712; - set italic font
713; - set bold/italic font

So if you want to set normal and bold at the same time, you can just chain control sequences together:

URxvt.keysym.C-0: command:\033]710;xft:Hack:size=10:antialias=true\007\033]711;xft:Hack:size=10:bold:antialias=true\007

I only know the font control numbers off the top of my head; the others (like character spacing etc.) are probably somewhere in the urxvt docs.

Edit: I found the docs in man 7 urxvt and they explain why 50; doesn't work. 50; sets a new entire fontset (normal, bold, italic) and can dynamically increase/decrease font sizes, but it seems to work only for X11 fontsets (dashes and stars), not xft fonts. So AFAIK chaining multiple font sequences is the way to go (it works for me).

Last edited by 12foo (2015-12-09 15:42:42)

Offline

#8 2015-12-12 23:50:19

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,548

Re: [Solved] Change urxvt's font on the fly: Can YOU do it?

Wow, 7 year old necrobump, you should know better, qubodup.

https://wiki.archlinux.org/index.php/Fo … bumping.22

Closing.


Sakura:-
Mobo: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Offline

Board footer

Powered by FluxBB