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

get current DPI of a window #3003

Closed
bog-dan-ro opened this issue Jun 28, 2023 · 4 comments · Fixed by #3004
Closed

get current DPI of a window #3003

bog-dan-ro opened this issue Jun 28, 2023 · 4 comments · Fixed by #3004
Labels
a:language-c++ C++ API, codegen, CMake build system (mS,mO) bug Something isn't working

Comments

@bog-dan-ro
Copy link

Right now there is no API to get the current DPI used by a slint::Window.

@tronical tronical added bug Something isn't working a:language-c++ C++ API, codegen, CMake build system (mS,mO) labels Jun 28, 2023
tronical added a commit that referenced this issue Jun 28, 2023
@tronical
Copy link
Member

We generally don't expose the DPI, but we do track the device pixel ratio (we call it scale factor). This is exposed in Rust, but not in C++. I've made a PR for the C++ side.

@bog-dan-ro
Copy link
Author

It will be nice if you'll expose also the DPI values .

@tronical
Copy link
Member

Maybe we could have API to expose the physical dimension of the monitor (along with other monitor related information). I think with Qt that could be computed, but with winit we don't have access to that information.

Out of curiosity, what information do you need (horizontal or vertical dpi? logical or physical dpi?) and how would you use it?

@bog-dan-ro
Copy link
Author

@tronical Logical DPI is needed to render text using 3rdparty libs e.g. render a scene with some texts into a texture then use Image::from_borrowed_gl_2d_rgba_texture to display it ( after you'll fix #2986 :-p ) .

I think Physical dimensions are also good to know, though right now I don't have a use-case for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:language-c++ C++ API, codegen, CMake build system (mS,mO) bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants