-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Font Ligature Support :GuiRenderLigatures #727
Conversation
I am posting this early because I assume users will be interested. There are code cleanup, I may work on integrating this with #690... |
c00580d
to
04283a2
Compare
The current logic prevents both of these modifiers from being rendered at the same time. If both are present, both should be rendered. While here, refactoring for pending font ligature changes.
Several distinct rendering tasks exist within paintEvent, and these should each be moved to their own function. This will prove useful for adding ligature rendering support. Functions: - Render Neovim Cursor Text - Render Neovim Cursor Background - Render Cell Text - Render Cell Background
This function checks if two cells have identical style, and is useful for ligature support where blocks of text must be rendered together. NOTE: Two cells may render identically, but not be stylistically equivalent. Differences in default colors vs explicit colors and reverse are treated as Differences.
b38fd78
to
6fab4d2
Compare
Codecov Report
@@ Coverage Diff @@
## master #727 +/- ##
==========================================
+ Coverage 20.80% 20.98% +0.17%
==========================================
Files 72 73 +1
Lines 27900 28100 +200
==========================================
+ Hits 5804 5896 +92
- Misses 22096 22204 +108
Continue to review full report at Codecov.
|
df8eecd
to
3291fa1
Compare
I think this one is ready for merge. Let me know if you have any final comments. The For As a side note, the Clazy Pipeline already caught a subtle Qt issue :) |
Looking glorious, go forth and press the merge button.
ooops :D |
Adds support for a :GuiRenderLigatures command, which will change the underlying ShellWidget render logic to paint segments of text with the same styling. Previously text was rendered character-by-character on the grid, preventing font ligatures from rendering. Code re-based from: equalsraf#470
This work would not have been done without @Nucearo 's efforts: equalsraf#470 Uses QTextLayout to render segments of similarly styled cells. QTextLayout provides greater control over Qt's font-rendering engine via QGlyphRun. With QGlyphRun, we are able to identify individual characters and their positions. QGlyphRun should provide a means of correcting the spacing for non-perfect monospace fonts. It also allows for identification of when a character sequence is converted to a glyph.
b5b70d4
to
e057308
Compare
Issue #166: Font ligatures support request.
Issue #723: Font ligatures support request.
Issue #705: Underline + Undercurl rendering incorrect.
Pull #470: Change printing to add ligature support
First, let me say... Thanks @Nuclearo!
This work would not have happened without your code as reference. The underlying rendering scheme is still being used.
The general approach here is very similar to Pull #470. We update the buffer on a line-by-line basis, and we draw blocks of similarly styled cells together. However, we now use
QTextLayout
andQGlyphRun
instead ofdrawText
. The new API should provide the extra control needed to adjust the spacing of non-monospace fonts and perform ligature detection.I have tried to structure this code so there is a known-good "old codepath" for
:GuiRenderLigatures 0
. Keeping the code exactly as-is would require large segments to be copy-pasted, so I have tried to decompose rendering tasks into functions. Each function should have code that is almost identical to segments of the old codepath.Algorithm:
update()
an entire line.Cell
's style.Cell
style change is detected.QTextLayout
, resulting in aQGlyphRun
.QGlyphRun
is a list of glyph indices and positions.Qt Documentation:
QTextLayout
QGlyphRun