You are not logged in.

#1 2010-03-15 06:58:16

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

pickyfont - change your terminal font on the fly

While I'm getting older my eyes are too. I looked for some way to change the
terminal font on the fly, like you can do with 'setfont' in the VT. I found
none, so I came up with this, nothing fancy but quite handy.

Project: http://github.com/trapd00r/pickyfont
AUR: http://aur.archlinux.org/packages.php?ID=39032

Last edited by dmz (2010-08-22 19:34:31)

Offline

#2 2010-03-15 16:22:34

n0dix
Member
Registered: 2009-09-22
Posts: 956

Re: pickyfont - change your terminal font on the fly

Great  work dmz.
The program depends on the WM?
This work for any Wm, for example Wmii?

Offline

#3 2010-03-15 16:48:09

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: pickyfont - change your terminal font on the fly

All I see is

printf "\033]50;${font}\007"

Where did you find this trick dmz?

Edit: xlsfonts is a helpful tool for getting that list if you don't already use it.

Last edited by lolilolicon (2010-03-15 16:50:04)


This silver ladybug at line 28...

Offline

#4 2010-03-16 00:25:16

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

n0dix wrote:

Great  work dmz.
The program depends on the WM?
This work for any Wm, for example Wmii?

I see no reason why it shouldn't.

Offline

#5 2010-03-16 00:26:26

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

lolilolicon wrote:

All I see is

printf "\033]50;${font}\007"

Where did you find this trick dmz?

Edit: xlsfonts is a helpful tool for getting that list if you don't already use it.

Strange. What terminal are you using? Works in xterm and urxvt for me.
I found this in the urxvt manpage. Thanks for the xlsfont tip, that was indeed nice.

Edit:You don't have them fonts installed, which results in the raw string prints.. tongue Try with fixed, it's as default as it gets I think.

Last edited by dmz (2010-03-16 03:59:06)

Offline

#6 2010-03-16 04:24:13

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

I thought about parsing the xlsfonts output to provide a list that's up to date and correct for each system, but there were loads and loads of fonts and types, and no way to parse the 'friendly names' either, not even with -l(llll).
Oh well, I guess that most people have terminus and fixed at least. I think that profont is OK, too.

Offline

#7 2010-03-16 04:42:33

alterecco
Member
Registered: 2009-07-13
Posts: 152

Re: pickyfont - change your terminal font on the fly

This does not work for me in urxtv? I use rxvt-unicode (urxvt) v9.07

It works fine in xterm, so I am not sure why this would be. Are you sure it is from the urxvt man page, and not the xterm man page you got that escape sequence?

Offline

#8 2010-03-16 05:44:53

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

alterecco wrote:

This does not work for me in urxtv? I use rxvt-unicode (urxvt) v9.07

It works fine in xterm, so I am not sure why this would be. Are you sure it is from the urxvt man page, and not the xterm man page you got that escape sequence?

Line 1046 in 'man urxvt' my friend.

Edit: Does something like this work for you?

echo -en "\033]50;-*-terminus-*-*-*-*-14-*-72-72-*-*-*-*\007"
printf "\033]50;-*-terminus-*-*-*-*-14-*-72-72-*-*-*-*\007"

Also, how does it not work? What happens?

Last edited by dmz (2010-03-16 05:49:41)

Offline

#9 2010-03-16 10:09:42

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: pickyfont - change your terminal font on the fly

dmz wrote:
lolilolicon wrote:

All I see is

printf "\033]50;${font}\007"

Where did you find this trick dmz?

Edit: xlsfonts is a helpful tool for getting that list if you don't already use it.

Strange. What terminal are you using? Works in xterm and urxvt for me.
I found this in the urxvt manpage. Thanks for the xlsfont tip, that was indeed nice.

Edit:You don't have them fonts installed, which results in the raw string prints.. tongue Try with fixed, it's as default as it gets I think.

Haha, I meant `printf "\033]50;${font}\007"` was the tricky part which was new to me smile
This is a nice find indeed, thanks for sharing!


This silver ladybug at line 28...

Offline

#10 2010-03-16 12:39:01

alterecco
Member
Registered: 2009-07-13
Posts: 152

Re: pickyfont - change your terminal font on the fly

dmz wrote:

Line 1046 in 'man urxvt' my friend.
Edit: Does something like this work for you?

echo -en "\033]50;-*-terminus-*-*-*-*-14-*-72-72-*-*-*-*\007"
printf "\033]50;-*-terminus-*-*-*-*-14-*-72-72-*-*-*-*\007"

Also, how does it not work? What happens?

Ah, I see it smile

I tried both the print and the echo, but they do nothing. Absolutely nothing.

I wonder if this requires xft, or I have disabled something in my xrdb... hmmm

I suppose it works perfectly for you in urxvt?

[Edit]

Ok, it seems to work with some fonts, ie, I can switch to something like 9x15, and back to my normal font (dina), but there are several others that don't work (from xfontsel). I will tinker more with this and return...

[Edit2]
Ok, I am an oaf it seems. It seems to be a missing font issue, but I would swear that it did not work with fixed[1..8] at first... but everything seems fine now. roll

Thx for this find. It will come in handy

Last edited by alterecco (2010-03-16 12:49:00)

Offline

#11 2010-03-16 14:44:42

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: pickyfont - change your terminal font on the fly

Handy tool, dmz thanks.

In my case I often specify both *font and *boldFont values in my Xdefaults since terminus doesn't include bold letters at the smaller sizes.

Pickyfont doesn't appear to set/change the boldFont if it was previously specified.


thayer williams ~ cinderwick.ca

Offline

#12 2010-03-16 15:23:53

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

Re: pickyfont - change your terminal font on the fly

thayer wrote:

Handy tool, dmz thanks.

In my case I often specify both *font and *boldFont values in my Xdefaults since terminus doesn't include bold letters at the smaller sizes.

Pickyfont doesn't appear to set/change the boldFont if it was previously specified.

I found a different escape sequence to switch fonts at runtime:

# normal font
printf "\033]710;%s\007" "${font}"
# bold font
printf "\033]711;%s\007" "${bold_font}"

See http://lists.schmorp.de/pipermail/rxvt- … 00886.html for a urxvt perl extension.

Edit: it all in man 7 urxvt

XTerm Operating System Commands
       "ESC ] Ps;Pt ST"
           Ps = 50    Set fontset to Pt, with the following special values of Pt (rxvt) #+n change up n #-n change down n if n is missing of 0, a value of 1 is used empty change to font0 n change to font n
           Ps = 710   Set normal fontset to Pt. Same as Ps = 50.
           Ps = 711   Set bold fontset to Pt. Similar to Ps = 50 (Compile styles).
           Ps = 712   Set italic fontset to Pt. Similar to Ps = 50 (Compile styles).
           Ps = 713   Set bold-italic fontset to Pt. Similar to Ps = 50 (Compile styles).

Last edited by lolilolicon (2010-03-16 15:28:58)


This silver ladybug at line 28...

Offline

#13 2010-03-17 12:48:55

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

Ah... I noticed the same thing just now. Thanks lolilolicon!

Offline

#14 2010-03-17 13:11:06

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

Hm... I dont get neither of those to work in the script, though they work nicely in the shell. Strange.

Offline

#15 2010-03-20 07:35:16

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

Finally I had time to fix the bold/italic issue. http://github.com/trapd00r/pickyfont
Thanks for noticing.

Offline

#16 2010-05-12 05:20:10

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

And while I am getting older I also learn new stuff. tongue
I rewrote the whole thing and made it easier, added lots of fonts and a
description for each as well. Wasnt very informative with 'fixed18'.
Looks like...

pickyfont.png

Enjoy...

Offline

#17 2010-05-12 06:55:38

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: pickyfont - change your terminal font on the fly

It's cool smile

How can i save the font picked in .Xdefaults?


arst

Offline

#18 2010-05-12 07:29:23

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

teh wrote:

It's cool smile

How can i save the font picked in .Xdefaults?

Ah. Maybe that'd be a feature.
Or did you mean manually?
I do it like this;

URxvt.shiva*font:                  -*-profont-*-*-*-*-11-*-*-*-*-*-*-*

If you want the font for all urxvt's;

URxvt*font: *-profont-*-*-*-*-11-*-*-*-*-*-*-*

Offline

#19 2010-05-12 17:05:57

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: pickyfont - change your terminal font on the fly

Ah. Maybe that'd be a feature.
Or did you mean manually?

No, i was looking for an automatically way. But thanks, I hope you add that "feature" in next versions smile


arst

Offline

#20 2010-06-10 05:01:08

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

So I've finally added functionality for changing fonts based on typeface:

pickyfont set ter4 bold
pickyfont set pro3 italic
pickyfont set pro7 normal
pickyfont set pro2 all

Which means you can have different fonts for normal/bold/italic - good for small fonts that doesnt support a bold fontface.

Offline

#21 2010-06-15 08:07:41

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

+Support for arbitary fonts:

  pickyfont 0.4
  USAGE: pickyfont OPTIONS

  OPTIONS
    list  list available fonts
    set   font (typeface)
    arb   set font to arbitary string, see below

    Typeface can be normal, bold, italic or all

    You can specify arbitary font to use, like so:
      pickyfont arb lucidasanstypewriter-bold-24
    The 'arb' flag is optional:
      pickyfont 8x13
    is valid as well

I can highly recommend installing Monte Carlo and Profont, issue:

pickyfont monte1 normal
pickyfont monte2 bold
pickyfont pro1 italic

... and check the look of vim, or, why not, yaourt -Ss foo. My new favourite setup for sure.

Offline

#22 2010-08-22 19:33:19

dmz
Member
From: Sweden
Registered: 2008-08-27
Posts: 881
Website

Re: pickyfont - change your terminal font on the fly

Some updates since last time... and I need your help.

From the manpage:

There is no reliable way to get friendly font names from the X.org server. One could parse the output from xlsfonts, but that output could be insanely long and will only show the raw names and several duplicates as well.

Therefore I see no other way then to keeping a (configuration)? file with more or less standard font mappings that most people would (in many cases, should) have installed, and let them pick from that.

Any ideas, mates?

Offline

Board footer

Powered by FluxBB