-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Configuration for undercurl vertical offset #17482
Comments
I'd like to reproduce the issue first, before adding any settings. It could be a bug in our renderer after all. Can you please tell me the following?
|
I think what I would like to see is a minimum integer number of pixels separation, no matter the font size. Even 1 pixel would be great. It would also be nice to be able to specify the pk-2-pk height of the curl, but that's just a nice to have. |
Note that the collision is not as bad if I can set the undercurl color to be different than the font color. And I do have that set in nvim. But there is some kind of problem such that color works when not in tmux, but does not work in tmux (EXCEPT in MateTerminal it does work??? You can see that in the MateTerm grab above.). One day, I'll figure it out. But for now... |
I think there are two problems:
In other words:
|
After spending way too much time in desmos's graphing calculator I realized that I can calculate the distance to the tangent of the sin curve quite easily while being a sufficient approximation. The tangent for That's such a fantastic coincidence because This is what we already have: float s = sin(data.position.x * frequency);
float d = abs(curlyLineHalfHeight - data.texcoord.y - s * amplitude); and all that was missing was a tiny float s = sin(data.position.x * frequency);
float d = abs(curlyLineHalfHeight - data.texcoord.y - s * amplitude) * rsqrt(2 - s * s); |
IMO The sine wave does not need antialiasing even at a few pixels scale since it is quite symmetrical. Antialiasing only blurs it (this is just as ugly as using vertical AA for a single underline). Here are examplesof aliased wavy underlines (first with aliased glyphs and the second with AA glyph rendering)Aliased glyphs: screen_record_Sat_06.29.2024_12-44-41.58.aliased.mp4Antialiased glyphs: screen_record_Sat_06.29.2024_12-49-16.50.aa.mp4You can play with it using built artifacts https://github.com/directvt/vtm/actions/runs/9722846266 (or just build https://github.com/o-sdn-o/vtm/tree/gui-bridge) with the following config in <config>
<gui>
<antialiasing = off />
<cellheight = 20 />
<gridsize = 0,0 />
<wincoor = 0,0 />
<winstate = normal />
<blinkrate = 400ms />
<fontlist> <!-- Font fallback list (LF-delimited (\n), ordered). The rest of the fonts available in the system will be loaded dynamically. -->
"Courier New\n" <!-- Primary font. Its metrics define the cell geometry. -->
"Cascadia Mono\n"
"Fira Code\n"
"NSimSun\n"
"Noto Sans Devanagari\n"
</fontlist>
</gui>
<menu>
<item id="Test" type=dtvt param="$0 -r test"/>
</menu>
</config> Use the |
Wow. No wonder WinTerm is looking so good. You guys are incredible! For comparison, here's some examples from whatever MS Office uses to render. You can see that they've just prerendered a simple squiggle and just roll with it. And what I'm seeing in Opera at the bottom. Seems like you could come up with a good pre-render (or render on fly + cache) for a given integer # vertical pixels, and then apply the right one given the space available. I would like to see 1-pixel of separation, which is what Opera [or WebKit/whatever] is obviously doing, But even abutment looks decent, especially if the undercurl color is different than the font. |
BTW, you can see that at 6pt, the Office curl does move into the bottom line of pixels of the font. Bug, IMO. |
We'd previously subtract one underline-height from the curly line offset, even though we already had subtracted its complete height. Additionally, the pixel shader received some fine tuning: * Shrink the stroke width so that the anti-aliasing can be seen all the way up to the horizontal edges of the bounding box. * Add a phase shift to break apart the symmetry of the curve. Closes #17482 Co-authored-by: Carlos Zamora <[email protected]>
We'd previously subtract one underline-height from the curly line offset, even though we already had subtracted its complete height. Additionally, the pixel shader received some fine tuning: * Shrink the stroke width so that the anti-aliasing can be seen all the way up to the horizontal edges of the bounding box. * Add a phase shift to break apart the symmetry of the curve. Closes #17482 Co-authored-by: Carlos Zamora <[email protected]> (cherry picked from commit ad3797a) Service-Card-Id: 92942049 Service-Version: 1.21
Undercurl is colliding with the bottom of the font. Requesting a configuration to apply a y-offset from the default vertical placement.
Here are some other-term links that may prevent having to think it through from scratch.
kovidgoyal/kitty#853
microsoft/cascadia-code#395
https://wezfurlong.org/wezterm/config/lua/config/underline_position.html
The text was updated successfully, but these errors were encountered: