Open meh opened 7 years ago
It's also important to note the rendering of a single cell could affect the rendering of its neighbors, which means neighbors should always get re-rendered unless their cache is up to date, which also means neighbors would end up trickling down if one cell in the middle changes style/content.
Need to investigate if there's a way to see if a glyph has a ligature in it.
Supporting ligatures is not going to be easy considering how the rendering is currently done.
On the bright side Cairo and Pango easily support rendering text with ligatures, but they require the whole text to do the job (obviously).
As it currently stands the
Renderer
has aCache
with an LRU for glyph caching, what this does is using the value of the cell to store the font and compute the shape, which is then sent to Cairo for rendering, this means that each cell is rendered as a single grapheme.To support ligatures instead of using
PangoGlyphString
it should usePangoGlyphItem
, which is just a pair ofPangoItem
andPangoGlyphString
, looking through the Pango documentation I haven't found a way to "slice" aPangoGlyphString
, so I presume aPangoGlyphItem
must be used for that.To keep performance good, the cache should be computed based on neighboring cells, where a cell is a neighbor iff:
This does completely break the nice property of the LRU cache just storing the grapheme, which meant it could be reused for other cells containing the same grapheme.
Regardless, I think this could be done with an option without making the code too ugly, so people who do not care about ligatures (me) can opt-out and gain some performance.