Widgets margins relative to character size (high DPI issue)

Recently I ported an Ruby application to GTK3. It is working fine so
far, but it seems that for GTK3 still stuff like widget margins and
window borders are specified in pixels. (some sizes, like text entry
size, can be specified already in characters, which is fine)

My application is in area of CAD
(http://www.ssalewski.de/PetEd.html.en), so it may be used with displays
of 200 DPI or more. Problem is, when a user has scaled text and widgets
sizes up, i.e. double the ordinary size. When I specify borders and
margins in pixesl, then it may look not really nice for 200 DPI with
scaled up widgets. I can offer the user a way to manually scale that
spaces, some sort of that scaling is already offered for cairo drawing
in my application, i.e. line width. But generally I would prefer
automatic scaling of widgets margins. LaTeX has sizes em and ex relative
to current font -- I think I can do something similar when I query users
default font size or users custom widgets size. For GTK3 label there
seems to be a method gtk_label_get_layout() and Pango offers methods to
query pixel size of that layout. That may work, I can calculate some
kind of ex and em values at program startup. (Unfortunately I am not
notified when user changes font size in gnome control center...)

Are there betters solution? I.e direct access to users default font size
in x and y pixels?

Best regards,

Stefan Salewski

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]