This is a snapshot of my work on supporting kerning and ligatures; the goal of this patch is to support those features for variable-pitch fonts in English, but I'm not ignoring RTL languages, or scripts that require shaping. Like the first patch, this is meant to demonstrate the behavior I would like to see, not the implementation. It's not meant for immediate inclusion; perhaps it can serve as a starting point for someone wishing to work on this further. That said, this patch does not re-use the composite.c code. I tried to, several times, but what it does is simply too different to allow useful code-sharing. What's it all about is entering text like "affiliation" or "AVATAR" while using a variable-pitch font. The proper way of displaying this, for many OpenType fonts with variable pitch, involves ligatures and kerning. A ligature is an OpenType glyph that represents several characters; for example, "ffi" in "affiliation". Kerning is the determination of each character's x advance based on its context; for example, in "AVATAR", the distance between "A", "V", and the following "A" is reduced. None of this complicated logic is in the patch; instead, it uses the HarfBuzz library. This is somewhat unfortunate because the HarfBuzz API is fairly limited: instead of requesting context incrementally from the calling program, it expects to be provided with a "complete" context which it then shapes. Doing that is probably too expensive, so we provide "enough" context based on a heuristic. (This is complicated because getting context is expensive, and too much of it can be harmful; the current approach is to take a lot of context so the horrible performance reminds me to do something about it :-) ). This code supports M-to-N correspondences between code points and glyphs points; it does so by first producing a single struct glyph covering all (N) glyphs, then slicing it into one slice for each of the (M) code points. Important differences between this code and the existing composite.c code: 1. You can "enter" ligatures, such as by moving point to the second "f" in "affiliation". This also applies to clusters of glyphs not usually thought of as ligatures: For accented letters written as two codepoints, such as á, this may be useful. For שָׁ, it's irritating. 2. This code does not allow HarfBuzz to default to the language your system is set to use. That prevents something as innocuous as a screenshot from revealing your likely location. (The current language default is "en"). 3. Ligatures and kerning work with display strings or overlay strings, rather than ending there or even revealing replaced buffer text as the existing code does. 4. This code breaks lines after every glyph slice. That is suboptimal for many languages. Can someone help with the Telugu "hello"? I wonder whether there should be a gap, and how much of one, between స్కా and రం in నమస్కారం? PS: Sorry for the amount of recent noise.