Script draw grid 10x10 cm on the screen. You measure it using ruler and enter measured value into entry below the grid. Then press a button and script calculates your real dots per inch value. You can than write it into x-server command line, and X would report real screen millimeters to programs.