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

Use real terminal font size #55

Closed
piranna opened this issue Feb 1, 2023 · 3 comments
Closed

Use real terminal font size #55

piranna opened this issue Feb 1, 2023 · 3 comments
Labels
enhancement New feature or request
Milestone

Comments

@piranna
Copy link

piranna commented Feb 1, 2023

Instead of have hardcoded values for the number of pixels of the font on screen, it's possible to get the real font size in pixels using the ws_xpixel and ws_ypixel values, between some other syscalls and tools, although they are poorly supported, but if they can be fetch, it's better to use the real values to do the calcs.

https://stackoverflow.com/questions/42936926/ws-xpixel-and-ws-ypixel

@fathyb fathyb added the enhancement New feature or request label Feb 1, 2023
@GottZ
Copy link

GottZ commented Feb 10, 2023

that's a client sided syscall right? you won't be able to use that through ssh or mosh if I'm not mistaken.
if you are using this locally, wouldn't it be more reasonable to approach command line flags for dpi first?

@fathyb
Copy link
Owner

fathyb commented Feb 11, 2023

You can access it through SSH or Docker (with -t or --tty) as those programs create a virtual PTY on the server which proxies requests back to the client.

Carbonyl currently uses the same syscall ioctl(STDOUT, TIOCGWINSZ) to retrieve the number of rows and columns, we just ignore ws_xpixel and ws_ypixel.

if libc::ioctl(libc::STDOUT_FILENO, libc::TIOCGWINSZ, ptr.as_mut_ptr()) == 0 {

I should release both this and a --dpi flag this week with #28.

@fathyb fathyb added this to the 0.0.3 milestone Feb 11, 2023
@piranna
Copy link
Author

piranna commented Feb 11, 2023

It seems my original idea was more related to chafa, but by the moment, current algorythm is fine :-)

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

No branches or pull requests

3 participants