Developer Extensions & High DPI Displays

I have searched the web and this forum in particular but have found no recent guides for developers to address the high DPI issue. I can provide larger pixel icons, but the WebDialog and their text don’t scale either. Is there a way to instruct SketchUp to scale dialog boxes in Ruby?

Joe…

1 Like

setting the fonts in mm using css should be the same for all screen factors…

does this render correctly on a high DPI monitor?

you should be able to measure it with a ruler…

html = %Q[<!DOCTYPE html>
<html>
<head>
<style>
body {font:caption;}  
h1 {font-size: 15mm;background-color:pink;}
h2 {font-size: 10mm;background-color:lightblue;}
p {background-color:lightgreen;
font-size: 5mm;
line-height: 10mm;
}
</style>
</head>
<body>

<h1> font-size is 15mm</h1>

<h2> font-size is 10mm</h2>

<p> font-size is 5mm, line-height is 10mm</p>

</body>
</html>
]

wd = UI::WebDialog.new("mm", true, '', 700, 300, 200, 200, true )
wd.set_html(html)
wd.show

john

Hi John,

Thanks very much for the reply and the test code. Here is what I measured on my 1920 px x 1200 px display, which measures 20.5" x 12.75".

Lines:
Pink - 20mm
Light Blue - 14mm
Light Green - 10mm

Text:
15mm - 11mm measured
10mm - 7mm measured
5mm - 4mm measured

I don’t have a high DPI monitor, but the user of my plugin, who brought this issue to me, does and I am going to have him run this test. I asked him to upgrade from SketchUp Make 2016 to SketchUp Make 2017 and the dialog boxes are now scaling. But my extension icons are still very small; they apparently don’t scale. Do you know a way to specify vector artwork for the icons in a Ruby extension?

Thanks again for your help.

Joe…

to handle all three options I just use…

    # to handle the new file formats for toolbar images...
    ext = '.png'
    ver = Sketchup.version.to_i
    if ver >= 16
      osx = Sketchup.platform == :platform_osx
      ext = osx ? '.pdf' : '.svg'
    end

    cmd.large_icon = cmd.small_icon = File.join(path, 'Resources', 'images', "#{NAME}#{ext}")

my images are all large [512 x 512] and I let SU deal with the scale…

john

1 Like

Thanks John. I am going to give that a try.

Joe…

John, that worked perfectly. Thanks again.

Joe…