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

Reduce lineheight #60

Open
jbirnick opened this issue Nov 11, 2023 · 2 comments
Open

Reduce lineheight #60

jbirnick opened this issue Nov 11, 2023 · 2 comments

Comments

@jbirnick
Copy link

jbirnick commented Nov 11, 2023

I use minimal height 0, but still the menu draws has a pretty big padding to the top and bottom (from the text of each line). How can I remove that padding/margin?

It's enough if you point me to the relevant line in the source code, I can patch it myself.

Thank you very much!

@jbirnick jbirnick changed the title Reduce height Reduce lineheight Nov 11, 2023
@Shizcow
Copy link
Owner

Shizcow commented Nov 13, 2023

The minimal height option is used to increase the height above the default rendering. It's not used to decrease the height from the default rendering (I guess this would be a maximum height option).

To further reduce the height, I think these lines are a good place to start looking. This sets the menu height to {the height of the font, AKA the height of the character which extends the highest above the baseline (tallest character) overlapped with the character that extends the lowest below the baseline (for example, 'g' extends below the baseline)} + 4 pixels for padding. IIRC this line make sure that the text is centered relative to that padding (ty is the y coordinate of the baseline). You could remove those 4 pixels of padding, but any more than that and you'd risk drawing text outside of the menu box.

Hopefully this points you in the right direction. If you're able to get a result you're happy with (maybe even adding a new flag to control this) please submit a PR for review -- I'm sure you're not the only one who wants this functionality. Let me know if you need any more info on how to achieve the desired result or how to make your chosen solution integrate cleanly with the existing program infrastructure.

Good luck!

@jbirnick
Copy link
Author

Thanks! This looks more low-level (or rather C-style) than I thought... I guess I have to postpone the analysis till when I have more free time.

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