URxvt font ligatures support ?

Marc Lehmann schmorp at schmorp.de
Thu Aug 13 16:57:39 CEST 2015

On Thu, Aug 13, 2015 at 12:12:18PM +0000, Raito Bezarius <masterancpp at gmail.com> wrote:
> Why can't we draw those multiple characters as one glyph and when we select
> this one glyph, URxvt automatically _depack_ the glyph into multiple
> characters ?

Possibly, if they fit?

> Finally, how Apple Terminal is able to support ligatures ?

The same way as urxvt probably, both just draw the text, and the font
engine will do ligatures. I'm pretty confident urxvt does ligatures if
your font is a cell font (i.e. has the right size), because ligatures are
automatic when rendering and apps don't have to d anything. It's just that
urxvt doesn't guarantee it on e.g. refreshes, i.e. it might draw the "i"
in an "fi" ligature separately.

> > Feel free, if you think it can be done.
> >
> Can you just tell me at which files I should take a look or if I should pay
> attention to particular things ?

Since I don't really know what needs to be done, it's hard to say. First you
should find out why your font doesn't draw ligatures already - most likely,
your font isn't a cellfont so one glyph != one screen cell, in which case it
probably can't be done because the font is unsuitable.

Then you need to find a way to identify ligatures, I don't think Xft has
an interface to that. If you have that, you need a fast way of identifying
ligatures in text.

Then you need to look at all font drawing calls in screen.C and rxvtfont.C,
and adjust them so that ligatures are always included when drawn, i.e. when
you draw "i", you need to step back to see ifd the previous character will
form a ligture wiht it (e.g. "f") and draw "fi" in one go. Maybe there is a
way to draw half ligatures, but I doubt it, and I doubt it will make things
any simpler.

I don't think you can make an unsuitable font work in ay way, though, so
the whole effort might not work in the end.

                The choice of a       Deliantra, the free code+content MORPG
      -----==-     _GNU_              http://www.deliantra.net
      ----==-- _       generation
      ---==---(_)__  __ ____  __      Marc Lehmann
      --==---/ / _ \/ // /\ \/ /      schmorp at schmorp.de
      -=====/_/_//_/\_,_/ /_/\_\

More information about the rxvt-unicode mailing list