Page 1 of 1

xft fonts in urxvt

Posted: Wed Mar 04, 2015 10:36 pm
by wuxmedia
right.
Install xrvtryxz*coff*-unilateral-4069/16

Ahem, I mean:

Code: Select all

rxvt-unicode-256color
Then your xft fonts will work.
urxvt-lite doesn't seem to give a fuck about xft's :)
2015030414255086021680x1050.png
Up to you if you want to move all this to a new thread.

Re: xft fonts in urxvt

Posted: Wed Mar 04, 2015 11:38 pm
by ivanovnegro
Ok, let's take it from here.

Exactly, make sure you have the fully featured rxvt-unicode-256color installed.

Then make sure you have the hinting right for use with xft fonts:

~/.Xresources look like this to begin with:

Code: Select all

Xft.autohint: 0
Xft.antialias: 1
Xft.hinting: true
Xft.hintstyle: hintslight
Xft.dpi: 96
Xft.rgba: rgb
Xft.lcdfilter: lcddefault
This is my example but you want hinting and xft only looks good with antialiasing IMO.

Now the fonts part, I have this:

Code: Select all

urxvt.xftAntialias: true
Those are the basics without the specific font.

Now let's change your fonts:

If you want to use Monaco as your font, an xft font:

Code: Select all

URxvt.font: xft:monaco:size=10
or Mono Space:

Code: Select all

URxvt*boldFont: xft:Monospace:pixelsize=11

Thing is there are some different ways to do it. You can also decide if you want to allow bold fonts or not.

I prefer Terminus, a bitmap font, not xft:

Code: Select all

URxvt*font: -*-terminus-medium-r-*-*-*-*-*-*-*-*-*-*
URxvt*boldFont: -*-terminus-medium-r-*-*-*-*-*-*-*-*-*-*
Assure to merge your changes.

Code: Select all

xrdb -merge ~/.Xresources
Of course you can put all that into your Xresources.

The difficult part is the syntax and even I am sometimes confused what to put there, so I try to find it online, for example, I want to use Dejavu Sans Mono as font, should look like this:

Code: Select all

URxvt.font:                xft:DejaVu Sans Mono:pixelsize=15
URxvt.boldFont:            xft:DejaVu Sans Mono:pixelsize=15:style=Bold
You decide the pixel size and you need the *correct* name of the font.

Re: xft fonts in urxvt

Posted: Wed Mar 04, 2015 11:55 pm
by wuxmedia
Pow, Black ivan font force in full effect!
for lovers of xft stylee, after taking Ivans advice, you can find a bunch in the repos:
"search" is for BBQ installs only:

Code: Select all

search fonts | grep ^fonts
then install - for example:

Code: Select all

ins fonts-anonymous-pro
you can see if you have them and what the name you should put into the .Xresources like this:

Code: Select all

fc-list|cut -d ':' -f 1|cut -d '/' -f 7 | sort | uniq | grep ttf
Anonymous Pro BI.ttf
Anonymous Pro B.ttf
Anonymous Pro I.ttf
Anonymous Pro.ttf
[...>8...]
(thanks Bacon)
So we'd use "URxvt.font: xft:Anonymous Pro"

There is a weird difference between 'pixelsize' and 'size' I guess the latter is in points, like the GTK thing. pixelsize obvious is a bit more precise.
You might find you need a:

Code: Select all

URxvt.letterSpace: -1
If there are a bit spaced out.

Re: xft fonts in urxvt

Posted: Wed Mar 04, 2015 11:58 pm
by dkeg
Also to note, you can leave other font styles blank and will automatically assume the basic font value. For instance

Code: Select all

*font: fontname
*boldFont:
*italicFont:
*bolditalicFont:

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 12:12 am
by ivanovnegro
Fantastic guys and especially Wux regarding searching, I have to do that a lot more like you describe.

Drew: You mean *boldFont* in the second line of code?

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 1:49 am
by pidsley
One more. Say you want to add a cool xft font you found, like http://www.dafont.com/unispace.font

Download the zip file and unpack it into ~/.fonts/<dir> :

Code: Select all

unzip <path>/unispace.zip -d ~/.fonts/unispace
For most xft fonts this should be enough to make the font show up in fc-list and be available for use.

Add it to your .Xresources:

Code: Select all

*font:             xft:Unispace:size=7
and reload .Xresources:

Code: Select all

xrdb ~/.Xresources
Image

As wux mentioned, some fonts need to have letterSpace adjusted, others need an adjustment to lineSpace (or both). See "man urxvt" for details.

Bitmap fonts can be a little more complicated. Someone should write a how-to for those. :)

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 9:07 am
by rhowaldt
^ i thought to get a new font recognized by the system you need to put it in a directory that is in your font path (i use /usr/share/fonts), then run

Code: Select all

fc-cache -fv
to update the cache. to check if it has worked, for example with unispace, do

Code: Select all

fc-list | grep unispace
thanks for the explanations guys, that is really helpful. the urxvt-lite explanation makes sense. i checked the urxvt options using this snippet:

Code: Select all

urxvt --help 2>&1 | grep options
and it doesnt say anything about xft, which is the point where i started thinking that maybe it wasnt me.

i cannot believe it is that difficult to get the fontname you need to use with urxvt. i might look into a script of sorts to make this easier. damn.

not at home now, will try later today! thanks again!

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 10:45 am
by pidsley
rhowaldt wrote:^ i thought to get a new font recognized by the system you need to put it in a directory that is in your font path (i use /usr/share/fonts)
Try putting the font in ~/.fonts (this is in your font path). I did, and it worked without running fc-cache (you know I do try these things before I post them :)

But I don't use xft fonts, so what do I know?

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 2:29 pm
by rhowaldt
^ hahaha, yeah, i know i can always trust you to try your own advice out first :) i didnt dispute it, i only mentioned what i read. i find that "rebuilding the font cache" such a needless action, that shit should work automagically, so i find your suggestion very interesting indeed. in fact, i'd prefer to use ~/.fonts, but reverted to using /usr/share/fonts in the hope that that would perhaps fix my issues. ah, the things one tries in desperate times, only to find out in the end that it was a problem with the urxvt version all along...

i must add that i am currently getting by perfectly well without xft fonts as well. it is just that something that should be working isnt working that is bugging me.

still not at home because i am a lazy unemployed stoner, but am mustering up strength to leave my GFs place in a bit and start getting active, after which i will start working with y'all suggestions!

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 4:34 pm
by rhowaldt
guys, thanks again, this has been really helpful. i have installed a bunch of fonts and tried them out and it all went smooth as a baby's bottom. the instructions in this thread are unequaled in clarity and brevity compared to all the other stuff i found through Google. is it perhaps best to move this thread to /home/bbq/readme ? or the wiki? or both? or none? or whatever?

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 5:04 pm
by ivanovnegro
^ Moved to /readme. ;)

Re: xft fonts in urxvt

Posted: Thu Mar 05, 2015 5:16 pm
by wuxmedia
what a team!