Skip to content
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

Height changes weirdly for characters on current line #82

Open
UtkarshVerma opened this issue Sep 4, 2022 · 5 comments
Open

Height changes weirdly for characters on current line #82

UtkarshVerma opened this issue Sep 4, 2022 · 5 comments

Comments

@UtkarshVerma
Copy link
Contributor

I am observing this weird behaviour with the following key config:

chscale: 1.1
font: Comic Code Ligatures
vertcenter enabled
2022-09-04_11.40.40.mp4

You can quickly test this with my build of st: https://github.com/UtkarshVerma/st-flexipatch/tree/no-reflow

@bakkeby
Copy link
Owner

bakkeby commented Sep 4, 2022

Looks to be just a side effect of using fallback fonts that are of a different size (larger) than the primary font - not all fonts are created alike or at the same display size compared to point / pixel size.

If you disable the WIDE_GLYPHS_PATCH then you won't have this issue as the characters will be cropped when they are drawn.

This shouldn't have anything specifically to do with chscale or the vertcenter patch.

@UtkarshVerma
Copy link
Contributor Author

UtkarshVerma commented Sep 5, 2022

I investigated a bit and realised that it's not due to fallback. Some of the glyphs in Comic Code fonts are very large, especially the ones for box drawing. I increased chscale (=1.35) to match the glyph height and now it is fine.

However, that means I have to put additional line height unnecessarily. Is there some way I can specifically crop exceeding glyphs on in the vertical direction?

@bakkeby
Copy link
Owner

bakkeby commented Sep 5, 2022

You are right, the box drawing glyphs are larger in this font. I can only assume that the technical reasons for this is that the font does not come with built-in vertical padding (empty space above and below the characters) which allows for the text to be very compact or dense. The boxdrawing glyphs being larger would then be to compensate for when spacing is added.

Is there some way I can specifically crop exceeding glyphs on in the vertical direction?

If you remove the WIDE_GLYPHS_PATCH then glyphs should be cropped in the vertical direction as it is in a stock st. That patch is a hack that just avoids larger glyphs from being cropped when drawing the background; it doesn't actually fix the underlying issue that the wide glyph is reported as taking up one column rather than two.

@UtkarshVerma
Copy link
Contributor Author

How do I ensure that the glyphs take up two columns?

@bakkeby
Copy link
Owner

bakkeby commented Dec 10, 2022

I don't know. In #56 veltza referred to the implementation in kitty that works out the number of columns for a character. I tried but wasn't successful in porting that to st.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants