in reply to Tk screen and monitor size in mm, DPI and scaling
I get same under Tk.pm and Tcl::Tk.pm
screen name :0.0 pixel width 1024 pixel height 768 scaling 1.3330053300533 mm width 271 mm height 203 $ perl -MTcl::pTk::TkHijack pm11129491.pl screen name :0.0 pixel width 1024 pixel height 768 scaling 1.3330053300533 mm width 271 mm height 203
screenmmheigh tracks to https://iweb.dl.sourceforge.net/project/tcl/Tcl/8.6.11/tk8.6.11.1-src.tar.gz
$ ack -ri HeightMMOfScreen tk8.6.11 -B1 tk8.6.11\generic\tkCmds.c 843- WidthMMOfScreen(screenPtr) = width; 844: HeightMMOfScreen(screenPtr) = height; -- 1485- Tcl_SetObjResult(interp, 1486: Tcl_NewIntObj(HeightMMOfScreen(Tk_Screen(tkwin)))); tk8.6.11\unix\tkUnixEvent.c 201- } 202: if (HeightMMOfScreen(DefaultScreenOfDisplay(display)) <= 0) { -- 205- mm = HeightOfScreen(DefaultScreenOfDisplay(display)) * (25.4 / + 75.0); 206: HeightMMOfScreen(DefaultScreenOfDisplay(display)) = mm; tk8.6.11\xlib\X11\Xlib.h 115-#define WidthMMOfScreen(s) ((s)->mwidth) 116:#define HeightMMOfScreen(s) ((s)->mheight)
I recognize that 25.4micron = 0.001 inch = 0.0254 mm
#!/usr/bin/perl -- use strict; use warnings; use Wx(); my $name = Wx::Display->new->GetName; my $dc = Wx::ScreenDC->new; my( $width, $height ) = $dc->GetSizeWH ; my $scaling = ' ??? '; my $ppi = join ' x ', $dc->GetPPI->GetHeight, $dc->GetPPI->GetWidth; my( $widthmm , $heightmm ) = $dc->GetSizeMMWH(); print <<EOT; screen name $name pixel width $width pixel height $height scaling $scaling ppi $ppi mm width $widthmm mm height $heightmm EOT __END__ screen name \\.\DISPLAY1 pixel width 1024 pixel height 768 scaling ??? ppi 96 x 96 mm width 280 mm height 210
The mm width/height seem close enough, the 7-9 mm difference could be the BLACK margin borders of my display. I recall adjusting margins on monitors years ago.
As best I can tell with a ruler , not counting the black borders, my mm height is closer to 205mm , so neither tk 203 nor wx 210 are exact
|
|---|