You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 a Cache 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 use PangoGlyphItem, which is just a pair of PangoItem and PangoGlyphString, looking through the Pango documentation I haven't found a way to "slice" a PangoGlyphString, so I presume a PangoGlyphItem 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:
it's on the same row
it has the same style
is not an empty cell
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.
The text was updated successfully, but these errors were encountered:
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.
meh
changed the title
Support ligatures.
Add font ligature support
Nov 20, 2016
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.
The text was updated successfully, but these errors were encountered: