1
1
/*
2
2
* Copyright © 2009 CNRS
3
3
* Copyright © 2009-2017 Inria. All rights reserved.
4
- * Copyright © 2009-2010, 2014 Université Bordeaux
4
+ * Copyright © 2009-2010, 2014, 2017 Université Bordeaux
5
5
* Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
6
6
* See COPYING in top-level directory.
7
7
*/
@@ -184,6 +184,7 @@ x11_init(void *_disp)
184
184
int scr ;
185
185
Screen * screen ;
186
186
int screen_width , screen_height ;
187
+ unsigned int dpi_x , dpi_y , dpi ;
187
188
188
189
/* create the toplevel window */
189
190
if (!(dpy = XOpenDisplay (NULL ))) {
@@ -195,6 +196,15 @@ x11_init(void *_disp)
195
196
disp -> scr = scr = DefaultScreen (dpy );
196
197
screen = ScreenOfDisplay (dpy , scr );
197
198
199
+ /* 25.4mm per inch */
200
+ dpi_x = ((double ) DisplayWidth (dpy , scr ) * 25.4 ) / DisplayWidthMM (dpy , scr );
201
+ dpi_y = ((double ) DisplayHeight (dpy , scr ) * 25.4 ) / DisplayHeightMM (dpy , scr );
202
+ dpi = (dpi_x + dpi_y ) / 2 ;
203
+
204
+ /* Original values for fontsize/gridsize were tuned for 96dpi */
205
+ coutput -> loutput .fontsize = (coutput -> loutput .fontsize * dpi ) / 96 ;
206
+ coutput -> loutput .gridsize = (coutput -> loutput .gridsize * dpi ) / 96 ;
207
+
198
208
/* recurse once for preparing sizes and positions using the root window surface */
199
209
root = RootWindow (dpy , scr );
200
210
disp -> top = root ;
0 commit comments