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

Picker::from_termios() for windows #32

Open
josueBarretogit opened this issue Jul 26, 2024 · 4 comments
Open

Picker::from_termios() for windows #32

josueBarretogit opened this issue Jul 26, 2024 · 4 comments

Comments

@josueBarretogit
Copy link

I looked at the definition of Picker::from_termios() in the source code and noticed it only is defined in unix systems, I wonder what should be done in the case of compiling for windows (how to get the font size on windows or alternatives), it would be nice if in the documentation there was a note describing what to do in such case or maybe if this method is called on windows then change the implementation accordingly

@benjajaja
Copy link
Owner

The Windows console API has some font-size info, but in "logical units": https://learn.microsoft.com/en-us/windows/console/console-font-infoex#members

It may be possible to convert this "logical unit" into pixels if you also query some other windows API for the DPI.

Note that I think that even the window-size might not be implemented on windows, I think that one comes from the ratatui backend.

@josueBarretogit
Copy link
Author

I got a windows machine I'll try using the windows API, in the meantime what fontsize do you recommend for windows?

@benjajaja
Copy link
Owner

I have no idea, I guess that depends on the terminal and settings.

BTW I can confirm that not even window size is really implemented for windows for the ratatui backends: https://github.com/crossterm-rs/crossterm/blob/492b764f9f132d302903ff6f2f55e96c1b8cd0ec/src/terminal/sys/windows.rs#L64

I suggest playing around with the windows console API. Ultimately you would need both window size in pixels, not columns/rows, AND the font size in pixels, not some "logical unit".

@benjajaja
Copy link
Owner

If there's a way to get this information in any way, then we can try it out here and later move it all to the ratatui backends.

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